From 6ad45f110e2249c7e3c372462aff101e43c9c0a3 Mon Sep 17 00:00:00 2001 From: Insu Park Date: Tue, 19 Sep 2023 15:59:38 +0900 Subject: 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: b90520eedb1dbc7f6a3928d089fe74fafb864eb5) Signed-off-by: Insu Park Signed-off-by: Richard Purdie --- bitbake/lib/bb/tests/codeparser.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'bitbake/lib/bb/tests') diff --git a/bitbake/lib/bb/tests/codeparser.py b/bitbake/lib/bb/tests/codeparser.py index a64c614b0b..b6f2b77ee3 100644 --- a/bitbake/lib/bb/tests/codeparser.py +++ b/bitbake/lib/bb/tests/codeparser.py @@ -436,6 +436,32 @@ esac self.assertEqual(deps, set(["TESTVAR2"])) self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['testval3', 'anothervalue']) + def test_contains_vardeps_override_operators(self): + # Check override operators handle dependencies correctly with the contains functionality + expr_plain = 'testval' + expr_prepend = '${@bb.utils.filter("TESTVAR1", "testval1", d)} ' + expr_append = ' ${@bb.utils.filter("TESTVAR2", "testval2", d)}' + expr_remove = '${@bb.utils.contains("TESTVAR3", "no-testval", "testval", "", d)}' + # Check dependencies + self.d.setVar('ANOTHERVAR', expr_plain) + self.d.prependVar('ANOTHERVAR', expr_prepend) + self.d.appendVar('ANOTHERVAR', expr_append) + self.d.setVar('ANOTHERVAR:remove', expr_remove) + self.d.setVar('TESTVAR1', 'blah') + self.d.setVar('TESTVAR2', 'testval2') + self.d.setVar('TESTVAR3', 'no-testval') + deps, values = bb.data.build_dependencies("ANOTHERVAR", set(self.d.keys()), set(), set(), set(), set(), self.d, self.d) + self.assertEqual(sorted(values.splitlines()), + sorted([ + expr_prepend + expr_plain + expr_append, + '_remove of ' + expr_remove, + 'TESTVAR1{testval1} = Unset', + 'TESTVAR2{testval2} = Set', + 'TESTVAR3{no-testval} = Set', + ])) + # Check final value + self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['testval2']) + #Currently no wildcard support #def test_vardeps_wildcards(self): # self.d.setVar("oe_libinstall", "echo test") -- cgit v1.2.3-54-g00ecf