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:44:10 +0100 |
| commit | 4512f767eacfc0838de3d74f1de7aa84b2d7a617 (patch) | |
| tree | ef4e0f07eb96c3b03e15463bb134273d671d101a | |
| parent | 2d7cf6c056691b6de81bdbb029225d7e0e16f37b (diff) | |
| download | poky-4512f767eacfc0838de3d74f1de7aa84b2d7a617.tar.gz | |
bitbake: 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.
(Bitbake rev: a6c40eca1146c0160da7e4e0bd7ac52fef2029e0)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 24 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/data.py | 46 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/parse.py | 2 |
3 files changed, 36 insertions, 36 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst index db44e26fbd..372926064a 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | |||
| @@ -551,7 +551,7 @@ variable. | |||
| 551 | 551 | ||
| 552 | DEPENDS = "glibc ncurses" | 552 | DEPENDS = "glibc ncurses" |
| 553 | OVERRIDES = "machine:local" | 553 | OVERRIDES = "machine:local" |
| 554 | DEPENDS:append_machine = "libmad" | 554 | DEPENDS:append:machine = "libmad" |
| 555 | 555 | ||
| 556 | In this example, :term:`DEPENDS` becomes "glibc ncurses libmad". | 556 | In this example, :term:`DEPENDS` becomes "glibc ncurses libmad". |
| 557 | 557 | ||
| @@ -618,27 +618,27 @@ example:: | |||
| 618 | 618 | ||
| 619 | OVERRIDES = "foo" | 619 | OVERRIDES = "foo" |
| 620 | A = "Z" | 620 | A = "Z" |
| 621 | A_foo:append = "X" | 621 | A:foo:append = "X" |
| 622 | 622 | ||
| 623 | For this case, | 623 | For this case, |
| 624 | ``A`` is unconditionally set to "Z" and "X" is unconditionally and | 624 | ``A`` is unconditionally set to "Z" and "X" is unconditionally and |
| 625 | immediately appended to the variable ``A_foo``. Because overrides have | 625 | immediately appended to the variable ``A:foo``. Because overrides have |
| 626 | not been applied yet, ``A_foo`` is set to "X" due to the append and | 626 | not been applied yet, ``A:foo`` is set to "X" due to the append and |
| 627 | ``A`` simply equals "Z". | 627 | ``A`` simply equals "Z". |
| 628 | 628 | ||
| 629 | Applying overrides, however, changes things. Since "foo" is listed in | 629 | Applying overrides, however, changes things. Since "foo" is listed in |
| 630 | :term:`OVERRIDES`, the conditional variable ``A`` is replaced with the "foo" | 630 | :term:`OVERRIDES`, the conditional variable ``A`` is replaced with the "foo" |
| 631 | version, which is equal to "X". So effectively, ``A_foo`` replaces | 631 | version, which is equal to "X". So effectively, ``A:foo`` replaces |
| 632 | ``A``. | 632 | ``A``. |
| 633 | 633 | ||
| 634 | This next example changes the order of the override and the append:: | 634 | This next example changes the order of the override and the append:: |
| 635 | 635 | ||
| 636 | OVERRIDES = "foo" | 636 | OVERRIDES = "foo" |
| 637 | A = "Z" | 637 | A = "Z" |
| 638 | A:append_foo = "X" | 638 | A:append:foo = "X" |
| 639 | 639 | ||
| 640 | For this case, before | 640 | For this case, before |
| 641 | overrides are handled, ``A`` is set to "Z" and ``A_append_foo`` is set | 641 | overrides are handled, ``A`` is set to "Z" and ``A:append:foo`` is set |
| 642 | to "X". Once the override for "foo" is applied, however, ``A`` gets | 642 | to "X". Once the override for "foo" is applied, however, ``A`` gets |
| 643 | appended with "X". Consequently, ``A`` becomes "ZX". Notice that spaces | 643 | appended with "X". Consequently, ``A`` becomes "ZX". Notice that spaces |
| 644 | are not appended. | 644 | are not appended. |
| @@ -648,15 +648,15 @@ back as in the first example:: | |||
| 648 | 648 | ||
| 649 | OVERRIDES = "foo" | 649 | OVERRIDES = "foo" |
| 650 | A = "Y" | 650 | A = "Y" |
| 651 | A_foo:append = "Z" | 651 | A:foo:append = "Z" |
| 652 | A_foo:append = "X" | 652 | A:foo:append = "X" |
| 653 | 653 | ||
| 654 | For this case, before any overrides are resolved, | 654 | For this case, before any overrides are resolved, |
| 655 | ``A`` is set to "Y" using an immediate assignment. After this immediate | 655 | ``A`` is set to "Y" using an immediate assignment. After this immediate |
| 656 | assignment, ``A_foo`` is set to "Z", and then further appended with "X" | 656 | assignment, ``A:foo`` is set to "Z", and then further appended with "X" |
| 657 | leaving the variable set to "ZX". Finally, applying the override for | 657 | leaving the variable set to "ZX". Finally, applying the override for |
| 658 | "foo" results in the conditional variable ``A`` becoming "ZX" (i.e. | 658 | "foo" results in the conditional variable ``A`` becoming "ZX" (i.e. |
| 659 | ``A`` is replaced with ``A_foo``). | 659 | ``A`` is replaced with ``A:foo``). |
| 660 | 660 | ||
| 661 | This final example mixes in some varying operators:: | 661 | This final example mixes in some varying operators:: |
| 662 | 662 | ||
| @@ -752,7 +752,7 @@ parsed. One way to achieve a conditional inherit in this case is to use | |||
| 752 | overrides:: | 752 | overrides:: |
| 753 | 753 | ||
| 754 | VARIABLE = "" | 754 | VARIABLE = "" |
| 755 | VARIABLE_someoverride = "myclass" | 755 | VARIABLE:someoverride = "myclass" |
| 756 | 756 | ||
| 757 | Another method is by using anonymous Python. Here is an example:: | 757 | Another method is by using anonymous Python. Here is an example:: |
| 758 | 758 | ||
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index add1b13600..7f1d3ffbbc 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
| @@ -281,7 +281,7 @@ class TestConcatOverride(unittest.TestCase): | |||
| 281 | # (including that whitespace is preserved) | 281 | # (including that whitespace is preserved) |
| 282 | def test_remove_inactive_override(self): | 282 | def test_remove_inactive_override(self): |
| 283 | self.d.setVar("TEST", "${VAL} ${BAR} 123") | 283 | self.d.setVar("TEST", "${VAL} ${BAR} 123") |
| 284 | self.d.setVar("TEST:remove_inactiveoverride", "val") | 284 | self.d.setVar("TEST:remove:inactiveoverride", "val") |
| 285 | self.assertEqual(self.d.getVar("TEST"), "val bar 123") | 285 | self.assertEqual(self.d.getVar("TEST"), "val bar 123") |
| 286 | 286 | ||
| 287 | def test_doubleref_remove(self): | 287 | def test_doubleref_remove(self): |
| @@ -329,35 +329,35 @@ class TestOverrides(unittest.TestCase): | |||
| 329 | self.assertEqual(self.d.getVar("TEST"), "testvalue") | 329 | self.assertEqual(self.d.getVar("TEST"), "testvalue") |
| 330 | 330 | ||
| 331 | def test_one_override(self): | 331 | def test_one_override(self): |
| 332 | self.d.setVar("TEST_bar", "testvalue2") | 332 | self.d.setVar("TEST:bar", "testvalue2") |
| 333 | self.assertEqual(self.d.getVar("TEST"), "testvalue2") | 333 | self.assertEqual(self.d.getVar("TEST"), "testvalue2") |
| 334 | 334 | ||
| 335 | def test_one_override_unset(self): | 335 | def test_one_override_unset(self): |
| 336 | self.d.setVar("TEST2_bar", "testvalue2") | 336 | self.d.setVar("TEST2:bar", "testvalue2") |
| 337 | 337 | ||
| 338 | self.assertEqual(self.d.getVar("TEST2"), "testvalue2") | 338 | self.assertEqual(self.d.getVar("TEST2"), "testvalue2") |
| 339 | self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST2', 'OVERRIDES', 'TEST2_bar']) | 339 | self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST2', 'OVERRIDES', 'TEST2:bar']) |
| 340 | 340 | ||
| 341 | def test_multiple_override(self): | 341 | def test_multiple_override(self): |
| 342 | self.d.setVar("TEST_bar", "testvalue2") | 342 | self.d.setVar("TEST:bar", "testvalue2") |
| 343 | self.d.setVar("TEST_local", "testvalue3") | 343 | self.d.setVar("TEST:local", "testvalue3") |
| 344 | self.d.setVar("TEST_foo", "testvalue4") | 344 | self.d.setVar("TEST:foo", "testvalue4") |
| 345 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") | 345 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") |
| 346 | self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST_foo', 'OVERRIDES', 'TEST_bar', 'TEST_local']) | 346 | self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST:foo', 'OVERRIDES', 'TEST:bar', 'TEST:local']) |
| 347 | 347 | ||
| 348 | def test_multiple_combined_overrides(self): | 348 | def test_multiple_combined_overrides(self): |
| 349 | self.d.setVar("TEST_local_foo_bar", "testvalue3") | 349 | self.d.setVar("TEST:local:foo:bar", "testvalue3") |
| 350 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") | 350 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") |
| 351 | 351 | ||
| 352 | def test_multiple_overrides_unset(self): | 352 | def test_multiple_overrides_unset(self): |
| 353 | self.d.setVar("TEST2_local_foo_bar", "testvalue3") | 353 | self.d.setVar("TEST2:local:foo:bar", "testvalue3") |
| 354 | self.assertEqual(self.d.getVar("TEST2"), "testvalue3") | 354 | self.assertEqual(self.d.getVar("TEST2"), "testvalue3") |
| 355 | 355 | ||
| 356 | def test_keyexpansion_override(self): | 356 | def test_keyexpansion_override(self): |
| 357 | self.d.setVar("LOCAL", "local") | 357 | self.d.setVar("LOCAL", "local") |
| 358 | self.d.setVar("TEST_bar", "testvalue2") | 358 | self.d.setVar("TEST:bar", "testvalue2") |
| 359 | self.d.setVar("TEST_${LOCAL}", "testvalue3") | 359 | self.d.setVar("TEST:${LOCAL}", "testvalue3") |
| 360 | self.d.setVar("TEST_foo", "testvalue4") | 360 | self.d.setVar("TEST:foo", "testvalue4") |
| 361 | bb.data.expandKeys(self.d) | 361 | bb.data.expandKeys(self.d) |
| 362 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") | 362 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") |
| 363 | 363 | ||
| @@ -368,31 +368,31 @@ class TestOverrides(unittest.TestCase): | |||
| 368 | self.assertEqual(self.d.getVar("ALTERNATIVE:lib32-ncurses-tools"), "a") | 368 | self.assertEqual(self.d.getVar("ALTERNATIVE:lib32-ncurses-tools"), "a") |
| 369 | 369 | ||
| 370 | def test_underscore_override(self): | 370 | def test_underscore_override(self): |
| 371 | self.d.setVar("TEST_bar", "testvalue2") | 371 | self.d.setVar("TEST:bar", "testvalue2") |
| 372 | self.d.setVar("TEST_some_val", "testvalue3") | 372 | self.d.setVar("TEST:some_val", "testvalue3") |
| 373 | self.d.setVar("TEST_foo", "testvalue4") | 373 | self.d.setVar("TEST:foo", "testvalue4") |
| 374 | self.d.setVar("OVERRIDES", "foo:bar:some_val") | 374 | self.d.setVar("OVERRIDES", "foo:bar:some_val") |
| 375 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") | 375 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") |
| 376 | 376 | ||
| 377 | def test_remove_with_override(self): | 377 | def test_remove_with_override(self): |
| 378 | self.d.setVar("TEST_bar", "testvalue2") | 378 | self.d.setVar("TEST:bar", "testvalue2") |
| 379 | self.d.setVar("TEST_some_val", "testvalue3 testvalue5") | 379 | self.d.setVar("TEST:some_val", "testvalue3 testvalue5") |
| 380 | self.d.setVar("TEST_some_val:remove", "testvalue3") | 380 | self.d.setVar("TEST:some_val:remove", "testvalue3") |
| 381 | self.d.setVar("TEST_foo", "testvalue4") | 381 | self.d.setVar("TEST:foo", "testvalue4") |
| 382 | self.d.setVar("OVERRIDES", "foo:bar:some_val") | 382 | self.d.setVar("OVERRIDES", "foo:bar:some_val") |
| 383 | self.assertEqual(self.d.getVar("TEST"), " testvalue5") | 383 | self.assertEqual(self.d.getVar("TEST"), " testvalue5") |
| 384 | 384 | ||
| 385 | def test_append_and_override_1(self): | 385 | def test_append_and_override_1(self): |
| 386 | self.d.setVar("TEST:append", "testvalue2") | 386 | self.d.setVar("TEST:append", "testvalue2") |
| 387 | self.d.setVar("TEST_bar", "testvalue3") | 387 | self.d.setVar("TEST:bar", "testvalue3") |
| 388 | self.assertEqual(self.d.getVar("TEST"), "testvalue3testvalue2") | 388 | self.assertEqual(self.d.getVar("TEST"), "testvalue3testvalue2") |
| 389 | 389 | ||
| 390 | def test_append_and_override_2(self): | 390 | def test_append_and_override_2(self): |
| 391 | self.d.setVar("TEST:append_bar", "testvalue2") | 391 | self.d.setVar("TEST:append:bar", "testvalue2") |
| 392 | self.assertEqual(self.d.getVar("TEST"), "testvaluetestvalue2") | 392 | self.assertEqual(self.d.getVar("TEST"), "testvaluetestvalue2") |
| 393 | 393 | ||
| 394 | def test_append_and_override_3(self): | 394 | def test_append_and_override_3(self): |
| 395 | self.d.setVar("TEST_bar:append", "testvalue2") | 395 | self.d.setVar("TEST:bar:append", "testvalue2") |
| 396 | self.assertEqual(self.d.getVar("TEST"), "testvalue2") | 396 | self.assertEqual(self.d.getVar("TEST"), "testvalue2") |
| 397 | 397 | ||
| 398 | # Test an override with _<numeric> in it based on a real world OE issue | 398 | # Test an override with _<numeric> in it based on a real world OE issue |
diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index 02a5c4952a..1b6b6d412e 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py | |||
| @@ -144,7 +144,7 @@ PN = "bc" | |||
| 144 | 144 | ||
| 145 | 145 | ||
| 146 | classextend = """ | 146 | classextend = """ |
| 147 | VAR_var_override1 = "B" | 147 | VAR_var:override1 = "B" |
| 148 | EXTRA = ":override1" | 148 | EXTRA = ":override1" |
| 149 | OVERRIDES = "nothing${EXTRA}" | 149 | OVERRIDES = "nothing${EXTRA}" |
| 150 | 150 | ||
