local_var, overridedata = self._findVar(var)
value = None
+ removes = set()
if flag == "_content" and overridedata is not None and not parsing:
match = False
active = {}
match = active[a]
del active[a]
if match:
- value = self.getVar(match, False)
+ value, subparser = self.getVarFlag(match, "_content", False, retparser=True)
+ if hasattr(subparser, "removes"):
+ # We have to carry the removes from the overridden variable to apply at the
+ # end of processing
+ removes = subparser.removes
if local_var is not None and value is None:
if flag in local_var:
value = parser.value
if value and flag == "_content" and local_var is not None and "_remove" in local_var and not parsing:
- removes = {}
self.need_overrides()
for (r, o) in local_var["_remove"]:
match = True
if not o2 in self.overrides:
match = False
if match:
- removes[r] = self.expand(r).split()
+ removes.add(r)
+ if value and flag == "_content" and not parsing:
if removes and parser:
+ expanded_removes = {}
+ for r in removes:
+ expanded_removes[r] = self.expand(r).split()
+
parser.removes = set()
val = ""
for v in __whitespace_split__.split(parser.value):
skip = False
for r in removes:
- if v in removes[r]:
+ if v in expanded_removes[r]:
parser.removes.add(r)
skip = True
if skip:
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("OVERRIDES", "foo:bar:some_val")
+ self.assertEqual(self.d.getVar("TEST"), " testvalue5")
+
+
class TestKeyExpansion(unittest.TestCase):
def setUp(self):
self.d = bb.data.init()