]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
data_smart: Move getVar expand cache handing to fix _remove operations
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 6 Sep 2013 20:14:25 +0000 (20:14 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 6 Sep 2013 21:17:04 +0000 (22:17 +0100)
DISTRO_FEATURES_remove = "opengl" wasn't working as expected. The reason
turned out the be the indirect reference to opengl and the fact _remove was
operating on unexpanded data.

This patch rearranges some code to ensure we operate on expanded data
by moving the expand cache handing into getVarFlags instead of getVar.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/data_smart.py

index d32501821d0946a3dae58e252e947c1c7b0e88fc..20e33a4870e23b84518ced32dffd0aa27ac57584 100644 (file)
@@ -505,12 +505,7 @@ class DataSmart(MutableMapping):
             self._seen_overrides[override].add( var )
 
     def getVar(self, var, expand=False, noweakdefault=False):
-        value = self.getVarFlag(var, "_content", False, noweakdefault)
-
-        # Call expand() separately to make use of the expand cache
-        if expand and value:
-            return self.expand(value, var)
-        return value
+        return self.getVarFlag(var, "_content", expand, noweakdefault)
 
     def renameVar(self, key, newkey, **loginfo):
         """
@@ -587,7 +582,11 @@ class DataSmart(MutableMapping):
             elif flag == "_content" and "defaultval" in local_var and not noweakdefault:
                 value = copy.copy(local_var["defaultval"])
         if expand and value:
-            value = self.expand(value, None)
+            # Only getvar (flag == _content) hits the expand cache
+            cachename = None
+            if flag == "_content":
+                cachename = var
+            value = self.expand(value, cachename)
         if value and flag == "_content" and local_var and "_removeactive" in local_var:
             filtered = filter(lambda v: v not in local_var["_removeactive"],
                               value.split(" "))