diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-10-16 17:15:20 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-10-18 10:59:27 +0100 |
commit | f7f5e30667e1ad8e1ca76ee331be2843f2976bfa (patch) | |
tree | 2c865125c7a0a315a0f6e08470cf73ee38dda689 /bitbake | |
parent | 9248bc1c53417e6581aa33fda683e765ad866426 (diff) | |
download | poky-f7f5e30667e1ad8e1ca76ee331be2843f2976bfa.tar.gz |
bitbake: bitbake: data: Ensure task checksums account for remove data
Currently remove operations are not being accounted for in the task
checksums. This is a fairly serious oversight and needs to be fixed.
To do so, we need internal data from getVarFlag combined with the
expanded variable data so that only "active" remove operators are
accounted for in the task checksum. We can get this from the new
optional removes attribute in the returned parser object.
The code can then use the data on active remove operators to account
for the removals in task checksum but only when the removal is active.
We have to be careful here not to reference any expanded data since this
may for example contain build paths. This means we can only map back
and reference the unsplit (and hence unexpanded) remove string which may
expand to multiple removal values.
[YOCTO #12913]
(Bitbake rev: 57d2ee17ae83a139a37081eb082e6184fa883581)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/data.py | 12 | ||||
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 27 |
2 files changed, 30 insertions, 9 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index e2700077c3..fde4cba6bb 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py | |||
@@ -307,6 +307,14 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): | |||
307 | return newvalue | 307 | return newvalue |
308 | return value + newvalue | 308 | return value + newvalue |
309 | 309 | ||
310 | def handle_remove(value, deps, removes, d): | ||
311 | for r in sorted(removes): | ||
312 | r2 = d.expandWithRefs(r, None) | ||
313 | value += "\n_remove of %s" % r | ||
314 | deps |= r2.references | ||
315 | deps = deps | (keys & r2.execs) | ||
316 | return value | ||
317 | |||
310 | if "vardepvalue" in varflags: | 318 | if "vardepvalue" in varflags: |
311 | value = varflags.get("vardepvalue") | 319 | value = varflags.get("vardepvalue") |
312 | elif varflags.get("func"): | 320 | elif varflags.get("func"): |
@@ -327,6 +335,8 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): | |||
327 | deps = deps | parsedvar.references | 335 | deps = deps | parsedvar.references |
328 | deps = deps | (keys & parser.execs) | (keys & parsedvar.execs) | 336 | deps = deps | (keys & parser.execs) | (keys & parsedvar.execs) |
329 | value = handle_contains(value, parsedvar.contains, d) | 337 | value = handle_contains(value, parsedvar.contains, d) |
338 | if hasattr(parsedvar, "removes"): | ||
339 | value = handle_remove(value, deps, parsedvar.removes, d) | ||
330 | if vardeps is None: | 340 | if vardeps is None: |
331 | parser.log.flush() | 341 | parser.log.flush() |
332 | if "prefuncs" in varflags: | 342 | if "prefuncs" in varflags: |
@@ -340,6 +350,8 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): | |||
340 | deps |= parser.references | 350 | deps |= parser.references |
341 | deps = deps | (keys & parser.execs) | 351 | deps = deps | (keys & parser.execs) |
342 | value = handle_contains(value, parser.contains, d) | 352 | value = handle_contains(value, parser.contains, d) |
353 | if hasattr(parser, "removes"): | ||
354 | value = handle_remove(value, deps, parser.removes, d) | ||
343 | 355 | ||
344 | if "vardepvalueexclude" in varflags: | 356 | if "vardepvalueexclude" in varflags: |
345 | exclude = varflags.get("vardepvalueexclude") | 357 | exclude = varflags.get("vardepvalueexclude") |
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 4ad0567c9a..8c4c6a9a32 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -805,7 +805,7 @@ class DataSmart(MutableMapping): | |||
805 | value = parser.value | 805 | value = parser.value |
806 | 806 | ||
807 | if value and flag == "_content" and local_var is not None and "_remove" in local_var and not parsing: | 807 | if value and flag == "_content" and local_var is not None and "_remove" in local_var and not parsing: |
808 | removes = [] | 808 | removes = {} |
809 | self.need_overrides() | 809 | self.need_overrides() |
810 | for (r, o) in local_var["_remove"]: | 810 | for (r, o) in local_var["_remove"]: |
811 | match = True | 811 | match = True |
@@ -814,14 +814,23 @@ class DataSmart(MutableMapping): | |||
814 | if not o2 in self.overrides: | 814 | if not o2 in self.overrides: |
815 | match = False | 815 | match = False |
816 | if match: | 816 | if match: |
817 | removes.extend(self.expand(r).split()) | 817 | removes[r] = self.expand(r).split() |
818 | 818 | ||
819 | if removes: | 819 | if removes and parser: |
820 | filtered = filter(lambda v: v not in removes, | 820 | parser.removes = set() |
821 | __whitespace_split__.split(value)) | 821 | val = "" |
822 | value = "".join(filtered) | 822 | for v in __whitespace_split__.split(parser.value): |
823 | if parser: | 823 | skip = False |
824 | parser.value = value | 824 | for r in removes: |
825 | if v in removes[r]: | ||
826 | parser.removes.add(r) | ||
827 | skip = True | ||
828 | if skip: | ||
829 | continue | ||
830 | val = val + v | ||
831 | parser.value = val | ||
832 | if expand: | ||
833 | value = parser.value | ||
825 | 834 | ||
826 | if parser: | 835 | if parser: |
827 | self.expand_cache[cachename] = parser | 836 | self.expand_cache[cachename] = parser |