summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-05-21 15:29:40 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-05-29 13:18:24 +0100
commit7631f6bbfc0678899324a46ee3f966f965bb0d60 (patch)
tree97da5a3a0030824510bb87d735d736b11caa2104 /bitbake
parent08e2f06d36ceaec36a8d5af92f4c22439cf0d225 (diff)
downloadpoky-7631f6bbfc0678899324a46ee3f966f965bb0d60.tar.gz
bitbake: data_smart: Fix an unusual variable reference bug
If you try: Y = "" Y_remove = "X" in OE-Core, bitbake will crash with a KeyError during expansion. The reason is that no expansion of the empty value is attempted but removal from is it and hence no varparse data is present for it in the expand_cache. If the value is empty, there is nothing to remove so the best fix is simply not to check for None but check it has any value. Also add a test for this error so it doesn't get reintroduced. (Bitbake rev: af3ce0fc0280e6642fa35de400f75fdbabf329b1) (Bitbake rev: 2d3478c97b7c7a2f5b12a8be302d8ea5ba4e1277) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/data_smart.py2
-rw-r--r--bitbake/lib/bb/tests/data.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index e4bdb2fdd9..2a1ef90190 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -610,7 +610,7 @@ class DataSmart(MutableMapping):
610 else: 610 else:
611 cachename = var + "[" + flag + "]" 611 cachename = var + "[" + flag + "]"
612 value = self.expand(value, cachename) 612 value = self.expand(value, cachename)
613 if value is not None and flag == "_content" and local_var is not None and "_removeactive" in local_var: 613 if value and flag == "_content" and local_var is not None and "_removeactive" in local_var:
614 filtered = filter(lambda v: v not in local_var["_removeactive"], 614 filtered = filter(lambda v: v not in local_var["_removeactive"],
615 value.split(" ")) 615 value.split(" "))
616 value = " ".join(filtered) 616 value = " ".join(filtered)
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py
index ee66b22e25..228f72c1f5 100644
--- a/bitbake/lib/bb/tests/data.py
+++ b/bitbake/lib/bb/tests/data.py
@@ -253,6 +253,11 @@ class TestConcatOverride(unittest.TestCase):
253 bb.data.update_data(self.d) 253 bb.data.update_data(self.d)
254 self.assertEqual(self.d.getVar("TEST_TEST", True), "bar bar") 254 self.assertEqual(self.d.getVar("TEST_TEST", True), "bar bar")
255 255
256 def test_empty_remove(self):
257 self.d.setVar("TEST", "")
258 self.d.setVar("TEST_remove", "val")
259 bb.data.update_data(self.d)
260 self.assertEqual(self.d.getVar("TEST", True), "")
256 261
257class TestOverrides(unittest.TestCase): 262class TestOverrides(unittest.TestCase):
258 def setUp(self): 263 def setUp(self):