summaryrefslogtreecommitdiffstats
path: root/recipes-core
diff options
context:
space:
mode:
authorErkka Kääriä <erkka.kaaria@intel.com>2015-12-10 10:45:45 +0200
committerMaxin B. John <maxin.john@intel.com>2015-12-11 15:07:25 +0200
commita7586e45a2b89ab8ce66ac00a54c0223f08f6804 (patch)
treef2dcabef5c20898ad66f5469f551fd279ade86de /recipes-core
parentbac3b9acee5110390d15d38dacdb1622e31b2238 (diff)
downloadmeta-java-a7586e45a2b89ab8ce66ac00a54c0223f08f6804.tar.gz
gnumail: Fix race condition in makefile
Parallel make does not handle multiple javac invocations correctly, as javac compiles any uncompiled dependencies on its own. This leads to a race condition where make may see incomplete class files and incorrectly assume that the class files has already been compiled. This ultimately causes incomplete class files to be included in one of the jars, causing build failures later one when javac attempts to use such class file. This issue is fixed by patching the makefile so that only one instance of javac is invoked, which compiles all the java files in one go. Signed-off-by: Erkka Kääriä <erkka.kaaria@intel.com> Signed-off-by: Maxin B. John <maxin.john@intel.com>
Diffstat (limited to 'recipes-core')
-rw-r--r--recipes-core/classpathx/gnumail-1.1.2/fix_makefile_race_condition.patch129
-rw-r--r--recipes-core/classpathx/gnumail_1.1.2.bb1
2 files changed, 130 insertions, 0 deletions
diff --git a/recipes-core/classpathx/gnumail-1.1.2/fix_makefile_race_condition.patch b/recipes-core/classpathx/gnumail-1.1.2/fix_makefile_race_condition.patch
new file mode 100644
index 0000000..7f847e8
--- /dev/null
+++ b/recipes-core/classpathx/gnumail-1.1.2/fix_makefile_race_condition.patch
@@ -0,0 +1,129 @@
1From 81a63484820c3f8ac2808c74957a62b773f7f342 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Erkka=20K=C3=A4=C3=A4ri=C3=A4?= <erkka.kaaria@intel.com>
3Date: Fri, 11 Dec 2015 14:24:23 +0200
4Subject: [PATCH] gnumail: Fix race condition in makefile
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Parallel make does not handle multiple javac invocations correctly, as javac
10compiles any uncompiled dependencies on its own. This leads to a race condition
11where make may see incomplete class files and incorrectly assume that the class
12file has already been compiled. This ultimately causes incomplete class files
13to be included in one of the jars, causing build failures later on when javac
14attempts to use such class file.
15
16This issue is fixed by patching the makefile in such way that only one instance
17of javac is invoked, which compiles all the java files in one go.
18
19Upstream-Status: Inappropriate [dead project]
20
21Signed-off-by: Erkka Kääriä <erkka.kaaria@intel.com>
22---
23 Makefile.am | 70 +++++++++----------------------------------------------------
24 1 file changed, 10 insertions(+), 60 deletions(-)
25
26diff --git a/Makefile.am b/Makefile.am
27index 8116b55..5c78dbc 100644
28--- a/Makefile.am
29+++ b/Makefile.am
30@@ -295,18 +295,6 @@ classpath = $(src):$(activation_jar):$(inetlib_jar):$(jsse_jar)
31 # Targets
32 BUILT_SOURCES = $(gnumail_jar) $(providers_jar)
33
34-#£EXTRA_DIST = jarcompiler $(API_JAVASRC) $(GNU_SRC) $(MAIL_META)
35-
36-gnumail_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(gnumail_sources))
37-util_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(util_sources))
38-provider_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(provider_sources))
39-smtp_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(smtp_sources))
40-imap_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(imap_sources))
41-pop3_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(pop3_sources))
42-nntp_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(nntp_sources))
43-mbox_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(mbox_sources))
44-maildir_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(maildir_sources))
45-
46 META-INF:
47 mkdir -p META-INF
48
49@@ -361,16 +349,14 @@ $(dst):
50
51 # Jars
52
53-$(gnumail_jar): $(dst) $(gnumail_meta) $(gnumail_classes) $(util_classes)
54+$(gnumail_jar): $(dst) $(gnumail_meta) build_sources
55 $(JAR) cfm $(gnumail_jar) $(manifest_mf) \
56 $(gnumail_meta) \
57 -C $(dst) javax \
58 -C $(dst) gnu/mail/handler \
59 -C $(dst) gnu/mail/util
60
61-$(providers_jar): $(dst) $(providers_meta) $(provider_classes) $(smtp_classes) \
62- $(imap_classes) $(pop3_classes) $(nntp_classes) $(mbox_classes) \
63- $(maildir_classes)
64+$(providers_jar): $(dst) $(providers_meta) build_sources
65 $(JAR) cfm $(providers_jar) $(manifest_mf) \
66 $(providers_meta) \
67 -C $(dst) gnu/mail/providers \
68@@ -378,50 +364,14 @@ $(providers_jar): $(dst) $(providers_meta) $(provider_classes) $(smtp_classes) \
69
70 # Compilation
71
72-#gnumail: util $(gnumail_classes)
73-
74-$(gnumail_classes): $(dst)/%.class: $(src)/%.java
75- $(JAVAC) $(JAVACFLAGS) -classpath $(classpath) -d $(dst) $<
76-
77-#util: $(util_classes)
78-
79-$(util_classes): $(dst)/%.class: $(src)/%.java
80- $(JAVAC) $(JAVACFLAGS) -classpath $(classpath) -d $(dst) $<
81-
82-#provider_util: $(gnumail_jar) $(provider_classes)
83-
84-$(provider_classes): $(dst)/%.class: $(src)/%.java
85- $(JAVAC) $(JAVACFLAGS) -classpath $(classpath) -d $(dst) $<
86-
87-#smtp: provider_util $(smtp_classes)
88-
89-$(smtp_classes): $(dst)/%.class: $(src)/%.java
90- $(JAVAC) $(JAVACFLAGS) -classpath $(classpath) -d $(dst) $<
91-
92-#imap: provider_util $(imap_classes)
93-
94-$(imap_classes): $(dst)/%.class: $(src)/%.java
95- $(JAVAC) $(JAVACFLAGS) -classpath $(classpath) -d $(dst) $<
96-
97-#pop3: provider_util $(pop3_classes)
98-
99-$(pop3_classes): $(dst)/%.class: $(src)/%.java
100- $(JAVAC) $(JAVACFLAGS) -classpath $(classpath) -d $(dst) $<
101-
102-#nntp: provider_util $(nntp_classes)
103-
104-$(nntp_classes): $(dst)/%.class: $(src)/%.java
105- $(JAVAC) $(JAVACFLAGS) -classpath $(classpath) -d $(dst) $<
106-
107-#mbox: provider_util $(mbox_classes)
108-
109-$(mbox_classes): $(dst)/%.class: $(src)/%.java
110- $(JAVAC) $(JAVACFLAGS) -classpath $(classpath) -d $(dst) $<
111-
112-#maildir: provider_util $(maildir_classes)
113-
114-$(maildir_classes): $(dst)/%.class: $(src)/%.java
115- $(JAVAC) $(JAVACFLAGS) -classpath $(classpath) -d $(dst) $<
116+build_sources: $(gnumail_sources) $(util_sources) $(provider_sources) \
117+ $(smtp_sources) $(imap_sources) $(pop3_sources) $(nntp_sources) \
118+ $(mbox_sources) $(maildir_sources)
119+ $(JAVAC) $(JAVACFLAGS) -classpath $(classpath) -d $(dst) \
120+ $(gnumail_sources) $(util_sources) $(provider_sources) \
121+ $(smtp_sources) $(imap_sources) $(pop3_sources) \
122+ $(nntp_sources) $(mbox_sources) $(maildir_sources)
123+ touch build_sources
124
125 # Javadoc
126 javadoc:
127--
1282.1.4
129
diff --git a/recipes-core/classpathx/gnumail_1.1.2.bb b/recipes-core/classpathx/gnumail_1.1.2.bb
index 41417c0..b498c2b 100644
--- a/recipes-core/classpathx/gnumail_1.1.2.bb
+++ b/recipes-core/classpathx/gnumail_1.1.2.bb
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=14bc6ee8b2e2b409be599212867d126e"
6 6
7SRC_URI = "http://ftp.gnu.org/gnu/classpathx/mail-${PV}.tar.gz \ 7SRC_URI = "http://ftp.gnu.org/gnu/classpathx/mail-${PV}.tar.gz \
8 file://datadir_java.patch \ 8 file://datadir_java.patch \
9 file://fix_makefile_race_condition.patch \
9 " 10 "
10 11
11inherit java-library java-bootstrap-components autotools 12inherit java-library java-bootstrap-components autotools