mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:49:46 +00:00
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>
This commit is contained in:
@@ -551,7 +551,7 @@ variable.
|
|||||||
|
|
||||||
DEPENDS = "glibc ncurses"
|
DEPENDS = "glibc ncurses"
|
||||||
OVERRIDES = "machine:local"
|
OVERRIDES = "machine:local"
|
||||||
DEPENDS:append_machine = "libmad"
|
DEPENDS:append:machine = "libmad"
|
||||||
|
|
||||||
In this example, :term:`DEPENDS` becomes "glibc ncurses libmad".
|
In this example, :term:`DEPENDS` becomes "glibc ncurses libmad".
|
||||||
|
|
||||||
@@ -618,27 +618,27 @@ example::
|
|||||||
|
|
||||||
OVERRIDES = "foo"
|
OVERRIDES = "foo"
|
||||||
A = "Z"
|
A = "Z"
|
||||||
A_foo:append = "X"
|
A:foo:append = "X"
|
||||||
|
|
||||||
For this case,
|
For this case,
|
||||||
``A`` is unconditionally set to "Z" and "X" is unconditionally and
|
``A`` is unconditionally set to "Z" and "X" is unconditionally and
|
||||||
immediately appended to the variable ``A_foo``. Because overrides have
|
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
|
not been applied yet, ``A:foo`` is set to "X" due to the append and
|
||||||
``A`` simply equals "Z".
|
``A`` simply equals "Z".
|
||||||
|
|
||||||
Applying overrides, however, changes things. Since "foo" is listed in
|
Applying overrides, however, changes things. Since "foo" is listed in
|
||||||
:term:`OVERRIDES`, the conditional variable ``A`` is replaced with the "foo"
|
: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``.
|
``A``.
|
||||||
|
|
||||||
This next example changes the order of the override and the append::
|
This next example changes the order of the override and the append::
|
||||||
|
|
||||||
OVERRIDES = "foo"
|
OVERRIDES = "foo"
|
||||||
A = "Z"
|
A = "Z"
|
||||||
A:append_foo = "X"
|
A:append:foo = "X"
|
||||||
|
|
||||||
For this case, before
|
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
|
to "X". Once the override for "foo" is applied, however, ``A`` gets
|
||||||
appended with "X". Consequently, ``A`` becomes "ZX". Notice that spaces
|
appended with "X". Consequently, ``A`` becomes "ZX". Notice that spaces
|
||||||
are not appended.
|
are not appended.
|
||||||
@@ -648,15 +648,15 @@ back as in the first example::
|
|||||||
|
|
||||||
OVERRIDES = "foo"
|
OVERRIDES = "foo"
|
||||||
A = "Y"
|
A = "Y"
|
||||||
A_foo:append = "Z"
|
A:foo:append = "Z"
|
||||||
A_foo:append = "X"
|
A:foo:append = "X"
|
||||||
|
|
||||||
For this case, before any overrides are resolved,
|
For this case, before any overrides are resolved,
|
||||||
``A`` is set to "Y" using an immediate assignment. After this immediate
|
``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
|
leaving the variable set to "ZX". Finally, applying the override for
|
||||||
"foo" results in the conditional variable ``A`` becoming "ZX" (i.e.
|
"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::
|
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::
|
overrides::
|
||||||
|
|
||||||
VARIABLE = ""
|
VARIABLE = ""
|
||||||
VARIABLE_someoverride = "myclass"
|
VARIABLE:someoverride = "myclass"
|
||||||
|
|
||||||
Another method is by using anonymous Python. Here is an example::
|
Another method is by using anonymous Python. Here is an example::
|
||||||
|
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ class TestConcatOverride(unittest.TestCase):
|
|||||||
# (including that whitespace is preserved)
|
# (including that whitespace is preserved)
|
||||||
def test_remove_inactive_override(self):
|
def test_remove_inactive_override(self):
|
||||||
self.d.setVar("TEST", "${VAL} ${BAR} 123")
|
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")
|
self.assertEqual(self.d.getVar("TEST"), "val bar 123")
|
||||||
|
|
||||||
def test_doubleref_remove(self):
|
def test_doubleref_remove(self):
|
||||||
@@ -329,35 +329,35 @@ class TestOverrides(unittest.TestCase):
|
|||||||
self.assertEqual(self.d.getVar("TEST"), "testvalue")
|
self.assertEqual(self.d.getVar("TEST"), "testvalue")
|
||||||
|
|
||||||
def test_one_override(self):
|
def test_one_override(self):
|
||||||
self.d.setVar("TEST_bar", "testvalue2")
|
self.d.setVar("TEST:bar", "testvalue2")
|
||||||
self.assertEqual(self.d.getVar("TEST"), "testvalue2")
|
self.assertEqual(self.d.getVar("TEST"), "testvalue2")
|
||||||
|
|
||||||
def test_one_override_unset(self):
|
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.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):
|
def test_multiple_override(self):
|
||||||
self.d.setVar("TEST_bar", "testvalue2")
|
self.d.setVar("TEST:bar", "testvalue2")
|
||||||
self.d.setVar("TEST_local", "testvalue3")
|
self.d.setVar("TEST:local", "testvalue3")
|
||||||
self.d.setVar("TEST_foo", "testvalue4")
|
self.d.setVar("TEST:foo", "testvalue4")
|
||||||
self.assertEqual(self.d.getVar("TEST"), "testvalue3")
|
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):
|
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")
|
self.assertEqual(self.d.getVar("TEST"), "testvalue3")
|
||||||
|
|
||||||
def test_multiple_overrides_unset(self):
|
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")
|
self.assertEqual(self.d.getVar("TEST2"), "testvalue3")
|
||||||
|
|
||||||
def test_keyexpansion_override(self):
|
def test_keyexpansion_override(self):
|
||||||
self.d.setVar("LOCAL", "local")
|
self.d.setVar("LOCAL", "local")
|
||||||
self.d.setVar("TEST_bar", "testvalue2")
|
self.d.setVar("TEST:bar", "testvalue2")
|
||||||
self.d.setVar("TEST_${LOCAL}", "testvalue3")
|
self.d.setVar("TEST:${LOCAL}", "testvalue3")
|
||||||
self.d.setVar("TEST_foo", "testvalue4")
|
self.d.setVar("TEST:foo", "testvalue4")
|
||||||
bb.data.expandKeys(self.d)
|
bb.data.expandKeys(self.d)
|
||||||
self.assertEqual(self.d.getVar("TEST"), "testvalue3")
|
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")
|
self.assertEqual(self.d.getVar("ALTERNATIVE:lib32-ncurses-tools"), "a")
|
||||||
|
|
||||||
def test_underscore_override(self):
|
def test_underscore_override(self):
|
||||||
self.d.setVar("TEST_bar", "testvalue2")
|
self.d.setVar("TEST:bar", "testvalue2")
|
||||||
self.d.setVar("TEST_some_val", "testvalue3")
|
self.d.setVar("TEST:some_val", "testvalue3")
|
||||||
self.d.setVar("TEST_foo", "testvalue4")
|
self.d.setVar("TEST:foo", "testvalue4")
|
||||||
self.d.setVar("OVERRIDES", "foo:bar:some_val")
|
self.d.setVar("OVERRIDES", "foo:bar:some_val")
|
||||||
self.assertEqual(self.d.getVar("TEST"), "testvalue3")
|
self.assertEqual(self.d.getVar("TEST"), "testvalue3")
|
||||||
|
|
||||||
def test_remove_with_override(self):
|
def test_remove_with_override(self):
|
||||||
self.d.setVar("TEST_bar", "testvalue2")
|
self.d.setVar("TEST:bar", "testvalue2")
|
||||||
self.d.setVar("TEST_some_val", "testvalue3 testvalue5")
|
self.d.setVar("TEST:some_val", "testvalue3 testvalue5")
|
||||||
self.d.setVar("TEST_some_val:remove", "testvalue3")
|
self.d.setVar("TEST:some_val:remove", "testvalue3")
|
||||||
self.d.setVar("TEST_foo", "testvalue4")
|
self.d.setVar("TEST:foo", "testvalue4")
|
||||||
self.d.setVar("OVERRIDES", "foo:bar:some_val")
|
self.d.setVar("OVERRIDES", "foo:bar:some_val")
|
||||||
self.assertEqual(self.d.getVar("TEST"), " testvalue5")
|
self.assertEqual(self.d.getVar("TEST"), " testvalue5")
|
||||||
|
|
||||||
def test_append_and_override_1(self):
|
def test_append_and_override_1(self):
|
||||||
self.d.setVar("TEST:append", "testvalue2")
|
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")
|
self.assertEqual(self.d.getVar("TEST"), "testvalue3testvalue2")
|
||||||
|
|
||||||
def test_append_and_override_2(self):
|
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")
|
self.assertEqual(self.d.getVar("TEST"), "testvaluetestvalue2")
|
||||||
|
|
||||||
def test_append_and_override_3(self):
|
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")
|
self.assertEqual(self.d.getVar("TEST"), "testvalue2")
|
||||||
|
|
||||||
# Test an override with _<numeric> in it based on a real world OE issue
|
# Test an override with _<numeric> in it based on a real world OE issue
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ PN = "bc"
|
|||||||
|
|
||||||
|
|
||||||
classextend = """
|
classextend = """
|
||||||
VAR_var_override1 = "B"
|
VAR_var:override1 = "B"
|
||||||
EXTRA = ":override1"
|
EXTRA = ":override1"
|
||||||
OVERRIDES = "nothing${EXTRA}"
|
OVERRIDES = "nothing${EXTRA}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user