Fix dependency handling bug of remove operator
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest1 patch 0 repliesNew
- v11 patch 2 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | bitbake: data: Add missing dependency handling of remove operatorlib/ lib/ | +27 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/1] Fix dependency handling bug of remove operator
Unlike the meta layers under the Yocto projects, custom layers frequently use following style of overriding to disable something default in the base layer without touching it:
bb in the base layer:
OPTIONS = "foo bar"
bbappend in the custom layer:
OPTIONS:remove = "${@bb.utils.contains('CUSTOM_FEATURES', 'no-foo', 'foo', '', d)}"
The problem is that the value of "CUSTOM_FEATURES" is not shown in the task signature. Here is a test example.
test-override-operators.bb:
ANOTHERVAR = "testval"
ANOTHERVAR:prepend = "${@bb.utils.filter('TESTVAR1', 'testval1', d)} "
ANOTHERVAR:append = " ${@bb.utils.filter('TESTVAR2', 'testval2', d)}"
ANOTHERVAR:remove = "${@bb.utils.contains('TESTVAR3', 'no-testval', 'testval', '', d)}"local.conf:
TESTVAR1 = "blah"
TESTVAR2 = "testval2"
TESTVAR3 = "blah"
Signature dump (Bug):
Variable ANOTHERVAR value is ${@bb.utils.filter('TESTVAR1', 'testval1', d)} testval ${@bb.utils.filter('TESTVAR2', 'testval2', d)} TESTVAR1{testval1} = Unset
TESTVAR2{testval2} = Set
_remove of ${@bb.utils.contains('TESTVAR3', 'no-testval', 'testval', '', d)}
Note that the signature dump above doesn't take the value of TESTVAR3 into account. Therefore, even if the local.conf changes the TESTVAR3 value to "no-testval", the two different configs produce exactly same signature, so the recipe won't be re-built, even worse, its sstate-cache output is not deterministic (depend on the config it first met).
With the fixed code, the new signature recognizes the TESTVAR3, and the problem solved. Signature dump (Fixed):
(Same as above)
TESTVAR3{no-testval} = Unset
Now, the new test case fails without the fix:
|$ bitbake-selftest bb.tests.codeparser.DependencyReferenceTest.test_contains_vardeps_override_operators
|F
|======================================================================
|FAIL: test_contains_vardeps_override_operators (bb.tests.codeparser.DependencyReferenceTest)
|----------------------------------------------------------------------
|Traceback (most recent call last):
| File "/home/worker/work/poky-test/bitbake/lib/bb/tests/codeparser.py", line 454, in test_contains_vardeps_override_operators
| self.assertEqual(sorted(values.splitlines()),
|AssertionError: Lists differ: ['${@[155 chars]t', '_remove of ${@bb.utils.contains("TESTVAR3[32 chars]d)}'] != ['${@[155 chars]t', 'TESTVAR3{no-testval} = Set', '_remove of [62 chars]d)}']
|
|First differing element 3:
|'_remove of ${@bb.utils.contains("TESTVAR3", "no-testval", "testval", "", d)}'
|'TESTVAR3{no-testval} = Set'
|
|Second list contains 1 additional elements.
|First extra element 4:
|'_remove of ${@bb.utils.contains("TESTVAR3", "no-testval", "testval", "", d)}'
|
| ['${@bb.utils.filter("TESTVAR1", "testval1", d)} testval '
| '${@bb.utils.filter("TESTVAR2", "testval2", d)}',
| 'TESTVAR1{testval1} = Unset',
| 'TESTVAR2{testval2} = Set',
|+ 'TESTVAR3{no-testval} = Set',
| '_remove of ${@bb.utils.contains("TESTVAR3", "no-testval", "testval", "", d)}']
|
|----------------------------------------------------------------------
|Ran 1 test in 0.002s
|
|FAILED (failures=1)Insu Park (1):
bitbake: data: Add missing dependency handling of remove operator
lib/bb/data.py | 1 + lib/bb/tests/codeparser.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+)
Signature · 1 line
2.25.1