summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-21 11:53:57 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-22 11:13:24 +0100
commit577ff4e3dd4efe3b129a10eabedf620cfb7a2fa8 (patch)
tree200a9cf45efe8c39c559099c353634d5d9939caf /meta
parent99284c3c8316ce1ae042eaf5909106a241dc6e36 (diff)
downloadpoky-577ff4e3dd4efe3b129a10eabedf620cfb7a2fa8.tar.gz
autotools/siteinfo: Tweak CONFIG_SITE handling for determism/races
As things stand there are multiple races in the CONFIG_SITE handling where checksums can change depending on whether site directories exist or not when parsing happens. This is bad. Secondly, there is a build race that occurs if you build virtuals in parallel with the "main" recipe, since the main recipe is parsed when the virtual is (since it sets variables like BBCLASSEXTEND) and with the current code, it may look for files and directories which could be created/destroyed which the loop is executing. This is also bad. The aclocal-copy directory should only ever be accessed by the call from autotools.bbclass. This changes the parameter name to make it clear and ensures all callers have the right usage, neatly avoiding all the problems above. Also added better comments. (From OE-Core rev: 3207244004c612c1a0e13921251003e5e635d1b1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/autotools.bbclass7
-rw-r--r--meta/classes/siteinfo.bbclass17
-rw-r--r--meta/classes/toolchain-scripts.bbclass2
3 files changed, 16 insertions, 10 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
index 4c32c84fa8..e5f527ec07 100644
--- a/meta/classes/autotools.bbclass
+++ b/meta/classes/autotools.bbclass
@@ -25,7 +25,7 @@ inherit siteinfo
25 25
26# Space separated list of shell scripts with variables defined to supply test 26# Space separated list of shell scripts with variables defined to supply test
27# results for autoconf tests we cannot run at build time. 27# results for autoconf tests we cannot run at build time.
28export CONFIG_SITE = "${@siteinfo_get_files(d, False)}" 28export CONFIG_SITE = "${@siteinfo_get_files(d)}"
29 29
30acpaths = "default" 30acpaths = "default"
31EXTRA_AUTORECONF = "--exclude=autopoint" 31EXTRA_AUTORECONF = "--exclude=autopoint"
@@ -253,8 +253,9 @@ python autotools_copy_aclocals () {
253 t = os.path.join(aclocaldir, os.path.basename(c)) 253 t = os.path.join(aclocaldir, os.path.basename(c))
254 if not os.path.exists(t): 254 if not os.path.exists(t):
255 os.symlink(c, t) 255 os.symlink(c, t)
256 256
257 d.setVar("CONFIG_SITE", siteinfo_get_files(d, False)) 257 # Refresh variable with cache files
258 d.setVar("CONFIG_SITE", siteinfo_get_files(d, aclocalcache=True))
258} 259}
259autotools_copy_aclocals[vardepsexclude] += "MACHINE SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA" 260autotools_copy_aclocals[vardepsexclude] += "MACHINE SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA"
260 261
diff --git a/meta/classes/siteinfo.bbclass b/meta/classes/siteinfo.bbclass
index 03d4c4fd20..6a2e4bf560 100644
--- a/meta/classes/siteinfo.bbclass
+++ b/meta/classes/siteinfo.bbclass
@@ -153,7 +153,7 @@ python () {
153 bb.fatal("Please add your architecture to siteinfo.bbclass") 153 bb.fatal("Please add your architecture to siteinfo.bbclass")
154} 154}
155 155
156def siteinfo_get_files(d, no_cache = False): 156def siteinfo_get_files(d, aclocalcache = False):
157 sitedata = siteinfo_data(d) 157 sitedata = siteinfo_data(d)
158 sitefiles = "" 158 sitefiles = ""
159 for path in d.getVar("BBPATH", True).split(":"): 159 for path in d.getVar("BBPATH", True).split(":"):
@@ -162,11 +162,17 @@ def siteinfo_get_files(d, no_cache = False):
162 if os.path.exists(filename): 162 if os.path.exists(filename):
163 sitefiles += filename + " " 163 sitefiles += filename + " "
164 164
165 if no_cache: return sitefiles 165 if not aclocalcache:
166 return sitefiles
166 167
167 # Now check for siteconfig cache files 168 # Now check for siteconfig cache files in the directory setup by autotools.bbclass to
168 # Use the files copied to the aclocal cache generated by autotools.bbclass 169 # avoid races.
169 # to avoid races 170 #
171 # ACLOCALDIR may or may not exist so cache should only be set to True from autotools.bbclass
172 # after files have been copied into this location. To do otherwise risks parsing/signature
173 # issues and the directory being created/removed whilst this code executes. This can happen
174 # when a multilib recipe is parsed along with its base variant which may be running at the time
175 # causing rare but nasty failures
170 path_siteconfig = d.getVar('ACLOCALDIR', True) 176 path_siteconfig = d.getVar('ACLOCALDIR', True)
171 if path_siteconfig and os.path.isdir(path_siteconfig): 177 if path_siteconfig and os.path.isdir(path_siteconfig):
172 for i in os.listdir(path_siteconfig): 178 for i in os.listdir(path_siteconfig):
@@ -174,7 +180,6 @@ def siteinfo_get_files(d, no_cache = False):
174 continue 180 continue
175 filename = os.path.join(path_siteconfig, i) 181 filename = os.path.join(path_siteconfig, i)
176 sitefiles += filename + " " 182 sitefiles += filename + " "
177
178 return sitefiles 183 return sitefiles
179 184
180# 185#
diff --git a/meta/classes/toolchain-scripts.bbclass b/meta/classes/toolchain-scripts.bbclass
index 57874f38dc..997ff8865f 100644
--- a/meta/classes/toolchain-scripts.bbclass
+++ b/meta/classes/toolchain-scripts.bbclass
@@ -105,7 +105,7 @@ EOF
105} 105}
106 106
107#we get the cached site config in the runtime 107#we get the cached site config in the runtime
108TOOLCHAIN_CONFIGSITE_NOCACHE = "${@siteinfo_get_files(d, True)}" 108TOOLCHAIN_CONFIGSITE_NOCACHE = "${@siteinfo_get_files(d)}"
109TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d" 109TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d"
110TOOLCHAIN_NEED_CONFIGSITE_CACHE ??= "virtual/${MLPREFIX}libc ncurses" 110TOOLCHAIN_NEED_CONFIGSITE_CACHE ??= "virtual/${MLPREFIX}libc ncurses"
111 111