]> code.ossystems Code Review - openembedded-core.git/commitdiff
cache: don't expand variables for skipped recipes
authorChris Larson <chris_larson@mentor.com>
Fri, 7 Jan 2011 15:38:41 +0000 (08:38 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 10 Jan 2011 13:24:03 +0000 (13:24 +0000)
Errors can result from these expansions, but for skipped recipes, we
shouldn't care about those failures.  This fixes the same issue which
Richard Purdie fixed in poky, commit 847b717.

(Bitbake rev: 96ee6840010c1ae1080e6bf7ff0f4eb2d361e84b)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/cache.py

index cde136083a34d041373b2d3b0676cf26d00fdf35..9a2e2d5298feac87a6191c3dce9db4cf556178ef 100644 (file)
@@ -105,8 +105,20 @@ class RecipeInfo(namedtuple('RecipeInfo', recipe_fields)):
     def getvar(cls, var, metadata):
         return metadata.getVar(var, True) or ''
 
+    @classmethod
+    def make_optional(cls, default=None, **kwargs):
+        """Construct the namedtuple from the specified keyword arguments,
+        with every value considered optional, using the default value if
+        it was not specified."""
+        for field in cls._fields:
+            kwargs[field] = kwargs.get(field, default)
+        return cls(**kwargs)
+
     @classmethod
     def from_metadata(cls, filename, metadata):
+        if cls.getvar('__SKIPPED', metadata):
+            return cls.make_optional(skipped=True)
+
         tasks = metadata.getVar('__BBTASKS', False)
 
         pn = cls.getvar('PN', metadata)
@@ -114,15 +126,6 @@ class RecipeInfo(namedtuple('RecipeInfo', recipe_fields)):
         if not pn in packages:
             packages.append(pn)
 
-        skip = cls.getvar('__SKIPPED', metadata)
-        if skip:
-            return RecipeInfo(None, None, None, None, None, 
-                              None, None, None, None, None, 
-                              None, skip, None, None, None, 
-                              None, None, None, None, None, 
-                              None, None, None, None, None,
-                              None, None)
-
         return RecipeInfo(
             tasks            = tasks,
             basetaskhashes   = cls.taskvar('BB_BASEHASH', tasks, metadata),
@@ -133,7 +136,7 @@ class RecipeInfo(namedtuple('RecipeInfo', recipe_fields)):
                                {'tasks': [], 'parents': {}},
             variants         = cls.listvar('__VARIANTS', metadata) + [''],
 
-            skipped          = skip,
+            skipped          = False,
             timestamp        = bb.parse.cached_mtime(filename),
             packages         = cls.listvar('PACKAGES', metadata),
             pn               = pn,