diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-09-21 12:47:02 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-09-23 13:49:11 +0100 |
commit | 3dfd4ed0ef61daa55745b3ab378593e653562a30 (patch) | |
tree | f8ba443877d58a480681a9d975221eb9fa2f4ab1 /meta/classes/siteinfo.bbclass | |
parent | 282d596b8cc81d650b6d20c6131fdc236bad2c20 (diff) | |
download | poky-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>
Diffstat (limited to 'meta/classes/siteinfo.bbclass')
-rw-r--r-- | meta/classes/siteinfo.bbclass | 34 |
1 files changed, 28 insertions, 6 deletions
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 | ||
179 | def 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 | ||
181 | SITEINFO_PATHVARS = "COREBASE" | ||
182 | |||
183 | def 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 |