summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-21 12:47:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-23 13:49:11 +0100
commit3dfd4ed0ef61daa55745b3ab378593e653562a30 (patch)
treef8ba443877d58a480681a9d975221eb9fa2f4ab1
parent282d596b8cc81d650b6d20c6131fdc236bad2c20 (diff)
downloadpoky-3dfd4ed0ef61daa55745b3ab378593e653562a30.tar.gz
siteinfo/autotools: Ensure task checksums reflect site files
Currently, if you change the site files, nothing rebuilds since they are not accounted for in task checksums. They could/should be through the file-checksums task flag. We need to cache all the files looked for, whether the exist or not so that if they do exist and didn't, the checksum also changes. This gets complicated by the need to clean out hardcoded build paths from the variable and that other layers can have site files. This patch adds this functionality. A new variable, SITEINFO_PATHVARS is added which controls which substitutions to make on the file-checksum values to remove the hardcoded paths. Layers adding site files will need to set this to a variable that has the layer path in it and is excluded from task hashes (COREBASE is the one the core layer uses). This patch will cause yocto-check-layer to fail for some layers where site files are added yet the layer isn't a machine specific layer. This is arguable correct since these additional site files apply to all recipes and things from a layer like core could be changed by such changes so it is right they should rebuild. There is a determinism issue potentially there if not. meta-openembedded does have some such references but looking at them they should move to core or likely just be removed as most look obsolete anyway. [YOCTO #13729] (From OE-Core rev: 29daffc2410f06f36b779d5bf1fd1ef6e900ca8f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/autotools.bbclass8
-rw-r--r--meta/classes/siteinfo.bbclass34
-rw-r--r--meta/classes/toolchain-scripts.bbclass5
-rw-r--r--meta/recipes-core/meta/meta-environment.bb5
-rw-r--r--meta/recipes-core/meta/meta-ide-support.bb6
5 files changed, 49 insertions, 9 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
index 2c7968e659..bc0c2ea83e 100644
--- a/meta/classes/autotools.bbclass
+++ b/meta/classes/autotools.bbclass
@@ -145,7 +145,13 @@ ACLOCALEXTRAPATH:class-target = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
145ACLOCALEXTRAPATH:class-nativesdk = " -I ${STAGING_DATADIR_NATIVE}/aclocal/" 145ACLOCALEXTRAPATH:class-nativesdk = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
146 146
147python autotools_aclocals () { 147python autotools_aclocals () {
148 d.setVar("CONFIG_SITE", siteinfo_get_files(d, sysrootcache=True)) 148 sitefiles, searched = siteinfo_get_files(d, sysrootcache=True)
149 d.setVar("CONFIG_SITE", " ".join(sitefiles))
150}
151
152python () {
153 sitefiles, searched = siteinfo_get_files(d, sysrootcache=False)
154 d.appendVarFlag("do_configure", "file-checksums", " " + " ".join(searched))
149} 155}
150 156
151CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in ${S}/acinclude.m4 Makefile.am" 157CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in ${S}/acinclude.m4 Makefile.am"
diff --git a/meta/classes/siteinfo.bbclass b/meta/classes/siteinfo.bbclass
index 0bd1f36805..c5f4dfda41 100644
--- a/meta/classes/siteinfo.bbclass
+++ b/meta/classes/siteinfo.bbclass
@@ -176,17 +176,39 @@ python () {
176 bb.fatal("Please add your architecture to siteinfo.bbclass") 176 bb.fatal("Please add your architecture to siteinfo.bbclass")
177} 177}
178 178
179def siteinfo_get_files(d, sysrootcache = False): 179# Layers with siteconfig need to add a replacement path to this variable so the
180# sstate isn't path specific
181SITEINFO_PATHVARS = "COREBASE"
182
183def siteinfo_get_files(d, sysrootcache=False):
180 sitedata = siteinfo_data(d) 184 sitedata = siteinfo_data(d)
181 sitefiles = "" 185 sitefiles = []
186 searched = []
182 for path in d.getVar("BBPATH").split(":"): 187 for path in d.getVar("BBPATH").split(":"):
183 for element in sitedata: 188 for element in sitedata:
184 filename = os.path.join(path, "site", element) 189 filename = os.path.join(path, "site", element)
185 if os.path.exists(filename): 190 if os.path.exists(filename):
186 sitefiles += filename + " " 191 searched.append(filename + ":True")
192 sitefiles.append(filename)
193 else:
194 searched.append(filename + ":False")
195
196 # Have to parameterise out hardcoded paths such as COREBASE for the main site files
197 for var in d.getVar("SITEINFO_PATHVARS").split():
198 searched2 = []
199 replace = os.path.normpath(d.getVar(var))
200 for s in searched:
201 searched2.append(s.replace(replace, "${" + var + "}"))
202 searched = searched2
203
204 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d):
205 # We need sstate sigs for native/cross not to vary upon arch so we can't depend on the site files.
206 # In future we may want to depend upon all site files?
207 # This would show up as breaking sstatetests.SStateTests.test_sstate_32_64_same_hash for example
208 searched = []
187 209
188 if not sysrootcache: 210 if not sysrootcache:
189 return sitefiles 211 return sitefiles, searched
190 212
191 # Now check for siteconfig cache files in sysroots 213 # Now check for siteconfig cache files in sysroots
192 path_siteconfig = d.getVar('SITECONFIG_SYSROOTCACHE') 214 path_siteconfig = d.getVar('SITECONFIG_SYSROOTCACHE')
@@ -195,8 +217,8 @@ def siteinfo_get_files(d, sysrootcache = False):
195 if not i.endswith("_config"): 217 if not i.endswith("_config"):
196 continue 218 continue
197 filename = os.path.join(path_siteconfig, i) 219 filename = os.path.join(path_siteconfig, i)
198 sitefiles += filename + " " 220 sitefiles.append(filename)
199 return sitefiles 221 return sitefiles, searched
200 222
201# 223#
202# Make some information available via variables 224# Make some information available via variables
diff --git a/meta/classes/toolchain-scripts.bbclass b/meta/classes/toolchain-scripts.bbclass
index 479f3b706e..fb6261c91d 100644
--- a/meta/classes/toolchain-scripts.bbclass
+++ b/meta/classes/toolchain-scripts.bbclass
@@ -65,6 +65,7 @@ toolchain_create_sdk_env_script () {
65 65
66# This function creates an environment-setup-script in the TMPDIR which enables 66# This function creates an environment-setup-script in the TMPDIR which enables
67# a OE-core IDE to integrate with the build tree 67# a OE-core IDE to integrate with the build tree
68# Caller must ensure CONFIG_SITE is setup
68toolchain_create_tree_env_script () { 69toolchain_create_tree_env_script () {
69 script=${TMPDIR}/environment-setup-${REAL_MULTIMACH_TARGET_SYS} 70 script=${TMPDIR}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
70 rm -f $script 71 rm -f $script
@@ -73,7 +74,7 @@ toolchain_create_tree_env_script () {
73 echo 'export PATH=${STAGING_DIR_NATIVE}/usr/bin:${STAGING_BINDIR_TOOLCHAIN}:$PATH' >> $script 74 echo 'export PATH=${STAGING_DIR_NATIVE}/usr/bin:${STAGING_BINDIR_TOOLCHAIN}:$PATH' >> $script
74 echo 'export PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR}' >> $script 75 echo 'export PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR}' >> $script
75 echo 'export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}' >> $script 76 echo 'export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}' >> $script
76 echo 'export CONFIG_SITE="${@siteinfo_get_files(d)}"' >> $script 77 echo 'export CONFIG_SITE="${CONFIG_SITE}"' >> $script
77 echo 'export SDKTARGETSYSROOT=${STAGING_DIR_TARGET}' >> $script 78 echo 'export SDKTARGETSYSROOT=${STAGING_DIR_TARGET}' >> $script
78 echo 'export OECORE_NATIVE_SYSROOT="${STAGING_DIR_NATIVE}"' >> $script 79 echo 'export OECORE_NATIVE_SYSROOT="${STAGING_DIR_NATIVE}"' >> $script
79 echo 'export OECORE_TARGET_SYSROOT="${STAGING_DIR_TARGET}"' >> $script 80 echo 'export OECORE_TARGET_SYSROOT="${STAGING_DIR_TARGET}"' >> $script
@@ -161,7 +162,7 @@ EOF
161} 162}
162 163
163#we get the cached site config in the runtime 164#we get the cached site config in the runtime
164TOOLCHAIN_CONFIGSITE_NOCACHE = "${@siteinfo_get_files(d)}" 165TOOLCHAIN_CONFIGSITE_NOCACHE = "${@' '.join(siteinfo_get_files(d)[0])}"
165TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d" 166TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d"
166TOOLCHAIN_NEED_CONFIGSITE_CACHE ??= "virtual/${MLPREFIX}libc ncurses" 167TOOLCHAIN_NEED_CONFIGSITE_CACHE ??= "virtual/${MLPREFIX}libc ncurses"
167DEPENDS += "${TOOLCHAIN_NEED_CONFIGSITE_CACHE}" 168DEPENDS += "${TOOLCHAIN_NEED_CONFIGSITE_CACHE}"
diff --git a/meta/recipes-core/meta/meta-environment.bb b/meta/recipes-core/meta/meta-environment.bb
index 27f0103665..7118fb2aef 100644
--- a/meta/recipes-core/meta/meta-environment.bb
+++ b/meta/recipes-core/meta/meta-environment.bb
@@ -47,6 +47,11 @@ python do_generate_content() {
47} 47}
48addtask generate_content before do_install after do_compile 48addtask generate_content before do_install after do_compile
49 49
50python () {
51 sitefiles, searched = siteinfo_get_files(d, sysrootcache=False)
52 d.appendVarFlag("do_generate_content", "file-checksums", " " + " ".join(searched))
53}
54
50create_sdk_files() { 55create_sdk_files() {
51 # Setup site file for external use 56 # Setup site file for external use
52 toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS} 57 toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS}
diff --git a/meta/recipes-core/meta/meta-ide-support.bb b/meta/recipes-core/meta/meta-ide-support.bb
index 768f6f4bb6..5b23f78e51 100644
--- a/meta/recipes-core/meta/meta-ide-support.bb
+++ b/meta/recipes-core/meta/meta-ide-support.bb
@@ -12,4 +12,10 @@ do_populate_ide_support () {
12 toolchain_create_tree_env_script 12 toolchain_create_tree_env_script
13} 13}
14 14
15python () {
16 sitefiles, searched = siteinfo_get_files(d, sysrootcache=False)
17 d.setVar("CONFIG_SITE", " ".join(sitefiles))
18 d.appendVarFlag("do_populate_ide_support", "file-checksums", " " + " ".join(searched))
19}
20
15addtask populate_ide_support before do_build after do_install 21addtask populate_ide_support before do_build after do_install