diff options
author | Insu Park <insu0.park@gmail.com> | 2023-12-27 23:56:17 +0900 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2024-01-05 03:25:38 -1000 |
commit | e25b0dcc9e82389f48bd8c4ab7c729b9cf6dcbd5 (patch) | |
tree | 47e29291144eb82b8593c077a931772d389eccaa /bitbake/lib/bb | |
parent | 80cc03ec403a4901e0d8ccb353a4770d13b88e0f (diff) | |
download | poky-e25b0dcc9e82389f48bd8c4ab7c729b9cf6dcbd5.tar.gz |
bitbake: data: Add missing dependency handling of remove operator
A recipe variable handles its dependencies even on the "contains"
variables within the "inline Python expressions" like bb.utils.filter().
And it also handles those in the append operator correctly, but the
problem is that it does not so in the remove operator.
Fix it by adding the missing dependencies every time the remove
operator has been handled.
Also add a test case to check if the override operators handle
dependencies correctly.
(Bitbake rev: 48799c68b69b7921c809e0fc970303866643eb2a)
Signed-off-by: Insu Park <insu0.park@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Cherry-picked from master: b90520eedb1dbc7f6a3928d089fe74fafb864eb5
- Conflicts in data.py are resolved as the master branch moved
handle_contains() and handle_remove() out of the try block
and added the 3rd argument, "exclusions", to handle_contains().
- The test code in codeparser.py are modified as the master branch
added three more arguments to the build_dependencies().
Signed-off-by: Insu Park <insu0.park@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/data.py | 1 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/codeparser.py | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index b0683c5180..1d21e00a1c 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py | |||
@@ -301,6 +301,7 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): | |||
301 | value += "\n_remove of %s" % r | 301 | value += "\n_remove of %s" % r |
302 | deps |= r2.references | 302 | deps |= r2.references |
303 | deps = deps | (keys & r2.execs) | 303 | deps = deps | (keys & r2.execs) |
304 | value = handle_contains(value, r2.contains, d) | ||
304 | return value | 305 | return value |
305 | 306 | ||
306 | if "vardepvalue" in varflags: | 307 | if "vardepvalue" in varflags: |
diff --git a/bitbake/lib/bb/tests/codeparser.py b/bitbake/lib/bb/tests/codeparser.py index f485204791..f1c4f618d8 100644 --- a/bitbake/lib/bb/tests/codeparser.py +++ b/bitbake/lib/bb/tests/codeparser.py | |||
@@ -412,6 +412,32 @@ esac | |||
412 | # Check final value | 412 | # Check final value |
413 | self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['anothervalue', 'yetanothervalue', 'lastone']) | 413 | self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['anothervalue', 'yetanothervalue', 'lastone']) |
414 | 414 | ||
415 | def test_contains_vardeps_override_operators(self): | ||
416 | # Check override operators handle dependencies correctly with the contains functionality | ||
417 | expr_plain = 'testval' | ||
418 | expr_prepend = '${@bb.utils.filter("TESTVAR1", "testval1", d)} ' | ||
419 | expr_append = ' ${@bb.utils.filter("TESTVAR2", "testval2", d)}' | ||
420 | expr_remove = '${@bb.utils.contains("TESTVAR3", "no-testval", "testval", "", d)}' | ||
421 | # Check dependencies | ||
422 | self.d.setVar('ANOTHERVAR', expr_plain) | ||
423 | self.d.prependVar('ANOTHERVAR', expr_prepend) | ||
424 | self.d.appendVar('ANOTHERVAR', expr_append) | ||
425 | self.d.setVar('ANOTHERVAR:remove', expr_remove) | ||
426 | self.d.setVar('TESTVAR1', 'blah') | ||
427 | self.d.setVar('TESTVAR2', 'testval2') | ||
428 | self.d.setVar('TESTVAR3', 'no-testval') | ||
429 | deps, values = bb.data.build_dependencies("ANOTHERVAR", set(self.d.keys()), set(), set(), self.d) | ||
430 | self.assertEqual(sorted(values.splitlines()), | ||
431 | sorted([ | ||
432 | expr_prepend + expr_plain + expr_append, | ||
433 | '_remove of ' + expr_remove, | ||
434 | 'TESTVAR1{testval1} = Unset', | ||
435 | 'TESTVAR2{testval2} = Set', | ||
436 | 'TESTVAR3{no-testval} = Set', | ||
437 | ])) | ||
438 | # Check final value | ||
439 | self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['testval2']) | ||
440 | |||
415 | #Currently no wildcard support | 441 | #Currently no wildcard support |
416 | #def test_vardeps_wildcards(self): | 442 | #def test_vardeps_wildcards(self): |
417 | # self.d.setVar("oe_libinstall", "echo test") | 443 | # self.d.setVar("oe_libinstall", "echo test") |