[gnome-continuous-yocto/gnomeostree-3.28-rocko: 5559/8267] lib/oe/sstatesig: avoid reporting duplicate siginfo files from sstate



commit 23095a6b011c7473bbf9c5f6b79c22c364a10bac
Author: Paul Eggleton <paul eggleton linux intel com>
Date:   Fri Apr 7 10:01:44 2017 +1200

    lib/oe/sstatesig: avoid reporting duplicate siginfo files from sstate
    
    In find_siginfo(), which is used by bitbake-diffsigs among other things,
    avoid adding a siginfo file from the sstate-cache where we've already
    collected a sigdata file from the stamps directory with the same hash.
    This avoids the possibility that the top two files (as picked by default
    using the bitbake-diffsigs -t option) are for the same signature and
    thus the tool would report no differences. In order to do that, just use
    the hashfiles dict that we already have - we just need to change the
    code to populate that even if we're collecting matching files without
    looking for a fixed set of hashes (i.e. taskhashlist isn't set).
    
    This replaces previous code in bitbake-diffsigs that attempted to filter
    these out with limited success.
    
    (From OE-Core rev: 5b69eef40868180c59400624096d7ebbbbea446b)
    
    Signed-off-by: Paul Eggleton <paul eggleton linux intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 meta/lib/oe/sstatesig.py |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index a76a031..8d93013 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -254,9 +254,6 @@ def find_siginfo(pn, taskname, taskhashlist, d):
     import fnmatch
     import glob
 
-    if taskhashlist:
-        hashfiles = {}
-
     if not taskname:
         # We have to derive pn and taskname
         key = pn
@@ -266,8 +263,15 @@ def find_siginfo(pn, taskname, taskhashlist, d):
         if key.startswith('virtual:native:'):
             pn = pn + '-native'
 
+    hashfiles = {}
     filedates = {}
 
+    def get_hashval(siginfo):
+        if siginfo.endswith('.siginfo'):
+            return siginfo.rpartition(':')[2].partition('_')[0]
+        else:
+            return siginfo.rpartition('.')[2]
+
     # First search in stamps dir
     localdata = d.createCopy()
     localdata.setVar('MULTIMACH_TARGET_SYS', '*')
@@ -297,6 +301,8 @@ def find_siginfo(pn, taskname, taskhashlist, d):
                 filedates[fullpath] = os.stat(fullpath).st_mtime
             except OSError:
                 continue
+            hashval = get_hashval(fullpath)
+            hashfiles[hashval] = fullpath
 
     if not taskhashlist or (len(filedates) < 2 and not foundall):
         # That didn't work, look in sstate-cache
@@ -320,9 +326,11 @@ def find_siginfo(pn, taskname, taskhashlist, d):
 
             matchedfiles = glob.glob(filespec)
             for fullpath in matchedfiles:
-                if taskhashlist:
-                    hashfiles[hashval] = fullpath
-                else:
+                actual_hashval = get_hashval(fullpath)
+                if actual_hashval in hashfiles:
+                    continue
+                hashfiles[hashval] = fullpath
+                if not taskhashlist:
                     try:
                         filedates[fullpath] = os.stat(fullpath).st_mtime
                     except:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]