diff options
| -rw-r--r-- | bitbake/lib/bb/data_smart.py | 17 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/data.py | 9 |
2 files changed, 22 insertions, 4 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 8c4c6a9a32..6b94fc4b42 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
| @@ -736,6 +736,7 @@ class DataSmart(MutableMapping): | |||
| 736 | 736 | ||
| 737 | local_var, overridedata = self._findVar(var) | 737 | local_var, overridedata = self._findVar(var) |
| 738 | value = None | 738 | value = None |
| 739 | removes = set() | ||
| 739 | if flag == "_content" and overridedata is not None and not parsing: | 740 | if flag == "_content" and overridedata is not None and not parsing: |
| 740 | match = False | 741 | match = False |
| 741 | active = {} | 742 | active = {} |
| @@ -762,7 +763,11 @@ class DataSmart(MutableMapping): | |||
| 762 | match = active[a] | 763 | match = active[a] |
| 763 | del active[a] | 764 | del active[a] |
| 764 | if match: | 765 | if match: |
| 765 | value = self.getVar(match, False) | 766 | value, subparser = self.getVarFlag(match, "_content", False, retparser=True) |
| 767 | if hasattr(subparser, "removes"): | ||
| 768 | # We have to carry the removes from the overridden variable to apply at the | ||
| 769 | # end of processing | ||
| 770 | removes = subparser.removes | ||
| 766 | 771 | ||
| 767 | if local_var is not None and value is None: | 772 | if local_var is not None and value is None: |
| 768 | if flag in local_var: | 773 | if flag in local_var: |
| @@ -805,7 +810,6 @@ class DataSmart(MutableMapping): | |||
| 805 | value = parser.value | 810 | value = parser.value |
| 806 | 811 | ||
| 807 | if value and flag == "_content" and local_var is not None and "_remove" in local_var and not parsing: | 812 | if value and flag == "_content" and local_var is not None and "_remove" in local_var and not parsing: |
| 808 | removes = {} | ||
| 809 | self.need_overrides() | 813 | self.need_overrides() |
| 810 | for (r, o) in local_var["_remove"]: | 814 | for (r, o) in local_var["_remove"]: |
| 811 | match = True | 815 | match = True |
| @@ -814,15 +818,20 @@ class DataSmart(MutableMapping): | |||
| 814 | if not o2 in self.overrides: | 818 | if not o2 in self.overrides: |
| 815 | match = False | 819 | match = False |
| 816 | if match: | 820 | if match: |
| 817 | removes[r] = self.expand(r).split() | 821 | removes.add(r) |
| 818 | 822 | ||
| 823 | if value and flag == "_content" and not parsing: | ||
| 819 | if removes and parser: | 824 | if removes and parser: |
| 825 | expanded_removes = {} | ||
| 826 | for r in removes: | ||
| 827 | expanded_removes[r] = self.expand(r).split() | ||
| 828 | |||
| 820 | parser.removes = set() | 829 | parser.removes = set() |
| 821 | val = "" | 830 | val = "" |
| 822 | for v in __whitespace_split__.split(parser.value): | 831 | for v in __whitespace_split__.split(parser.value): |
| 823 | skip = False | 832 | skip = False |
| 824 | for r in removes: | 833 | for r in removes: |
| 825 | if v in removes[r]: | 834 | if v in expanded_removes[r]: |
| 826 | parser.removes.add(r) | 835 | parser.removes.add(r) |
| 827 | skip = True | 836 | skip = True |
| 828 | if skip: | 837 | if skip: |
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index 9ac78e3683..db3e2010a9 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
| @@ -386,6 +386,15 @@ class TestOverrides(unittest.TestCase): | |||
| 386 | self.d.setVar("OVERRIDES", "foo:bar:some_val") | 386 | self.d.setVar("OVERRIDES", "foo:bar:some_val") |
| 387 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") | 387 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") |
| 388 | 388 | ||
| 389 | def test_remove_with_override(self): | ||
| 390 | self.d.setVar("TEST_bar", "testvalue2") | ||
| 391 | self.d.setVar("TEST_some_val", "testvalue3 testvalue5") | ||
| 392 | self.d.setVar("TEST_some_val_remove", "testvalue3") | ||
| 393 | self.d.setVar("TEST_foo", "testvalue4") | ||
| 394 | self.d.setVar("OVERRIDES", "foo:bar:some_val") | ||
| 395 | self.assertEqual(self.d.getVar("TEST"), " testvalue5") | ||
| 396 | |||
| 397 | |||
| 389 | class TestKeyExpansion(unittest.TestCase): | 398 | class TestKeyExpansion(unittest.TestCase): |
| 390 | def setUp(self): | 399 | def setUp(self): |
| 391 | self.d = bb.data.init() | 400 | self.d = bb.data.init() |
