[oe-commits] [bitbake] 02/02: data: Ensure task checksums account for remove data

git at git.openembedded.org git at git.openembedded.org
Tue Oct 16 16:46:22 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 8701e8dba33b16e7f95922a7f73d19c05a1a832d
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Tue Oct 16 17:15:20 2018 +0100

    data: Ensure task checksums account for remove data
    
    Currently remove operations are not being accounted for in the task
    checksums. This is a fairly serious oversight and needs to be fixed.
    
    To do so, we need internal data from getVarFlag combined with the
    expanded variable data so that only "active" remove operators are
    accounted for in the task checksum.
    
    This code adds in an internal hook to get the data and accounts
    for the operator in the task checksum when the removal is active.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/data.py       | 16 +++++++++++++++-
 lib/bb/data_smart.py |  7 +++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/lib/bb/data.py b/lib/bb/data.py
index 80a7879..55ba7b1 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -290,7 +290,7 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d):
             return deps, value
         varflags = d.getVarFlags(key, ["vardeps", "vardepvalue", "vardepsexclude", "exports", "postfuncs", "prefuncs", "lineno", "filename"]) or {}
         vardeps = varflags.get("vardeps")
-        value = d.getVarFlag(key, "_content", False)
+        value, removes = d.getVarFlag(key, "_content", False, retremoves=True)
 
         def handle_contains(value, contains, d):
             newvalue = ""
@@ -309,6 +309,16 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d):
                 return newvalue
             return value + newvalue
 
+        def handle_remove(value, deps, expandedval, removes, d):
+            activeremoves = []
+            for r in removes:
+                r2 = d.expandWithRefs(r, None)
+                if r2.value in expandedval.split():
+                    value += "\n_remove of %s(%s)" % (r, r2.value)
+                    deps |= r2.references
+                    deps = deps | (keys & r2.execs)
+            return value
+
         if "vardepvalue" in varflags:
            value = varflags.get("vardepvalue")
         elif varflags.get("func"):
@@ -328,6 +338,8 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d):
                 deps = deps | parsedvar.references
                 deps = deps | (keys & parser.execs) | (keys & parsedvar.execs)
                 value = handle_contains(value, parsedvar.contains, d)
+                if removes:
+                    value = handle_remove(value, deps, parser.value, removes, d)
             if vardeps is None:
                 parser.log.flush()
             if "prefuncs" in varflags:
@@ -341,6 +353,8 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d):
             deps |= parser.references
             deps = deps | (keys & parser.execs)
             value = handle_contains(value, parser.contains, d)
+            if removes:
+                value = handle_remove(value, deps, parser.value, removes, d)
 
         if "vardepvalueexclude" in varflags:
             exclude = varflags.get("vardepvalueexclude")
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 0a8488c..60ea675 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -731,7 +731,7 @@ class DataSmart(MutableMapping):
                 self.dict["__exportlist"]["_content"] = set()
             self.dict["__exportlist"]["_content"].add(var)
 
-    def getVarFlag(self, var, flag, expand=True, noweakdefault=False, parsing=False):
+    def getVarFlag(self, var, flag, expand=True, noweakdefault=False, parsing=False, retremoves=False):
         local_var, overridedata = self._findVar(var)
         value = None
         if flag == "_content" and overridedata is not None and not parsing:
@@ -805,8 +805,8 @@ class DataSmart(MutableMapping):
                 cachename = var + "[" + flag + "]"
             value = self.expand(value, cachename)
 
+        removes = []
         if value and flag == "_content" and local_var is not None and "_remove" in local_var:
-            removes = []
             self.need_overrides()
             for (r, o) in local_var["_remove"]:
                 match = True
@@ -825,6 +825,9 @@ class DataSmart(MutableMapping):
                     # We need to ensure the expand cache has the correct value
                     # flag == "_content" here
                     self.expand_cache[var].value = value
+
+        if retremoves:
+            return value, removes
         return value
 
     def delVarFlag(self, var, flag, **loginfo):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list