diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-07-30 13:50:22 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-08-02 15:39:28 +0100 |
commit | a6c40eca1146c0160da7e4e0bd7ac52fef2029e0 (patch) | |
tree | 1741d6150a0949b90de75a9300ade5df75180896 | |
parent | 47f8d3b24fd52381bf3b41e2f55a53e57841344c (diff) | |
download | bitbake-a6c40eca1146c0160da7e4e0bd7ac52fef2029e0.tar.gz |
doc/lib: Add fixes for issues missed by the automated conversion
The examples and tests use non-standard override names, convert these to
the new syntax by hand.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 24 | ||||
-rw-r--r-- | lib/bb/tests/data.py | 46 | ||||
-rw-r--r-- | lib/bb/tests/parse.py | 2 |
3 files changed, 36 insertions, 36 deletions
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst index db44e26fb..372926064 100644 --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst @@ -551,7 +551,7 @@ variable. DEPENDS = "glibc ncurses" OVERRIDES = "machine:local" - DEPENDS:append_machine = "libmad" + DEPENDS:append:machine = "libmad" In this example, :term:`DEPENDS` becomes "glibc ncurses libmad". @@ -618,27 +618,27 @@ example:: OVERRIDES = "foo" A = "Z" - A_foo:append = "X" + A:foo:append = "X" For this case, ``A`` is unconditionally set to "Z" and "X" is unconditionally and -immediately appended to the variable ``A_foo``. Because overrides have -not been applied yet, ``A_foo`` is set to "X" due to the append and +immediately appended to the variable ``A:foo``. Because overrides have +not been applied yet, ``A:foo`` is set to "X" due to the append and ``A`` simply equals "Z". Applying overrides, however, changes things. Since "foo" is listed in :term:`OVERRIDES`, the conditional variable ``A`` is replaced with the "foo" -version, which is equal to "X". So effectively, ``A_foo`` replaces +version, which is equal to "X". So effectively, ``A:foo`` replaces ``A``. This next example changes the order of the override and the append:: OVERRIDES = "foo" A = "Z" - A:append_foo = "X" + A:append:foo = "X" For this case, before -overrides are handled, ``A`` is set to "Z" and ``A_append_foo`` is set +overrides are handled, ``A`` is set to "Z" and ``A:append:foo`` is set to "X". Once the override for "foo" is applied, however, ``A`` gets appended with "X". Consequently, ``A`` becomes "ZX". Notice that spaces are not appended. @@ -648,15 +648,15 @@ back as in the first example:: OVERRIDES = "foo" A = "Y" - A_foo:append = "Z" - A_foo:append = "X" + A:foo:append = "Z" + A:foo:append = "X" For this case, before any overrides are resolved, ``A`` is set to "Y" using an immediate assignment. After this immediate -assignment, ``A_foo`` is set to "Z", and then further appended with "X" +assignment, ``A:foo`` is set to "Z", and then further appended with "X" leaving the variable set to "ZX". Finally, applying the override for "foo" results in the conditional variable ``A`` becoming "ZX" (i.e. -``A`` is replaced with ``A_foo``). +``A`` is replaced with ``A:foo``). This final example mixes in some varying operators:: @@ -752,7 +752,7 @@ parsed. One way to achieve a conditional inherit in this case is to use overrides:: VARIABLE = "" - VARIABLE_someoverride = "myclass" + VARIABLE:someoverride = "myclass" Another method is by using anonymous Python. Here is an example:: diff --git a/lib/bb/tests/data.py b/lib/bb/tests/data.py index add1b1360..7f1d3ffbb 100644 --- a/lib/bb/tests/data.py +++ b/lib/bb/tests/data.py @@ -281,7 +281,7 @@ class TestConcatOverride(unittest.TestCase): # (including that whitespace is preserved) def test_remove_inactive_override(self): self.d.setVar("TEST", "${VAL} ${BAR} 123") - self.d.setVar("TEST:remove_inactiveoverride", "val") + self.d.setVar("TEST:remove:inactiveoverride", "val") self.assertEqual(self.d.getVar("TEST"), "val bar 123") def test_doubleref_remove(self): @@ -329,35 +329,35 @@ class TestOverrides(unittest.TestCase): self.assertEqual(self.d.getVar("TEST"), "testvalue") def test_one_override(self): - self.d.setVar("TEST_bar", "testvalue2") + self.d.setVar("TEST:bar", "testvalue2") self.assertEqual(self.d.getVar("TEST"), "testvalue2") def test_one_override_unset(self): - self.d.setVar("TEST2_bar", "testvalue2") + self.d.setVar("TEST2:bar", "testvalue2") self.assertEqual(self.d.getVar("TEST2"), "testvalue2") - self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST2', 'OVERRIDES', 'TEST2_bar']) + self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST2', 'OVERRIDES', 'TEST2:bar']) def test_multiple_override(self): - self.d.setVar("TEST_bar", "testvalue2") - self.d.setVar("TEST_local", "testvalue3") - self.d.setVar("TEST_foo", "testvalue4") + self.d.setVar("TEST:bar", "testvalue2") + self.d.setVar("TEST:local", "testvalue3") + self.d.setVar("TEST:foo", "testvalue4") self.assertEqual(self.d.getVar("TEST"), "testvalue3") - self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST_foo', 'OVERRIDES', 'TEST_bar', 'TEST_local']) + self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST:foo', 'OVERRIDES', 'TEST:bar', 'TEST:local']) def test_multiple_combined_overrides(self): - self.d.setVar("TEST_local_foo_bar", "testvalue3") + self.d.setVar("TEST:local:foo:bar", "testvalue3") self.assertEqual(self.d.getVar("TEST"), "testvalue3") def test_multiple_overrides_unset(self): - self.d.setVar("TEST2_local_foo_bar", "testvalue3") + self.d.setVar("TEST2:local:foo:bar", "testvalue3") self.assertEqual(self.d.getVar("TEST2"), "testvalue3") def test_keyexpansion_override(self): self.d.setVar("LOCAL", "local") - self.d.setVar("TEST_bar", "testvalue2") - self.d.setVar("TEST_${LOCAL}", "testvalue3") - self.d.setVar("TEST_foo", "testvalue4") + self.d.setVar("TEST:bar", "testvalue2") + self.d.setVar("TEST:${LOCAL}", "testvalue3") + self.d.setVar("TEST:foo", "testvalue4") bb.data.expandKeys(self.d) self.assertEqual(self.d.getVar("TEST"), "testvalue3") @@ -368,31 +368,31 @@ class TestOverrides(unittest.TestCase): self.assertEqual(self.d.getVar("ALTERNATIVE:lib32-ncurses-tools"), "a") def test_underscore_override(self): - self.d.setVar("TEST_bar", "testvalue2") - self.d.setVar("TEST_some_val", "testvalue3") - self.d.setVar("TEST_foo", "testvalue4") + self.d.setVar("TEST:bar", "testvalue2") + self.d.setVar("TEST:some_val", "testvalue3") + self.d.setVar("TEST:foo", "testvalue4") self.d.setVar("OVERRIDES", "foo:bar:some_val") self.assertEqual(self.d.getVar("TEST"), "testvalue3") def test_remove_with_override(self): - self.d.setVar("TEST_bar", "testvalue2") - self.d.setVar("TEST_some_val", "testvalue3 testvalue5") - self.d.setVar("TEST_some_val:remove", "testvalue3") - self.d.setVar("TEST_foo", "testvalue4") + self.d.setVar("TEST:bar", "testvalue2") + self.d.setVar("TEST:some_val", "testvalue3 testvalue5") + self.d.setVar("TEST:some_val:remove", "testvalue3") + self.d.setVar("TEST:foo", "testvalue4") self.d.setVar("OVERRIDES", "foo:bar:some_val") self.assertEqual(self.d.getVar("TEST"), " testvalue5") def test_append_and_override_1(self): self.d.setVar("TEST:append", "testvalue2") - self.d.setVar("TEST_bar", "testvalue3") + self.d.setVar("TEST:bar", "testvalue3") self.assertEqual(self.d.getVar("TEST"), "testvalue3testvalue2") def test_append_and_override_2(self): - self.d.setVar("TEST:append_bar", "testvalue2") + self.d.setVar("TEST:append:bar", "testvalue2") self.assertEqual(self.d.getVar("TEST"), "testvaluetestvalue2") def test_append_and_override_3(self): - self.d.setVar("TEST_bar:append", "testvalue2") + self.d.setVar("TEST:bar:append", "testvalue2") self.assertEqual(self.d.getVar("TEST"), "testvalue2") # Test an override with _<numeric> in it based on a real world OE issue diff --git a/lib/bb/tests/parse.py b/lib/bb/tests/parse.py index 02a5c4952..1b6b6d412 100644 --- a/lib/bb/tests/parse.py +++ b/lib/bb/tests/parse.py @@ -144,7 +144,7 @@ PN = "bc" classextend = """ -VAR_var_override1 = "B" +VAR_var:override1 = "B" EXTRA = ":override1" OVERRIDES = "nothing${EXTRA}" |