From c0924452292049f1063ba8607af9093403565313 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Fri, 4 Oct 2013 11:55:45 +0100 Subject: meta/lib/oe/sstatesig: fix finding siginfo across sstate and stamps Enable comparisons with bitbake-diffsigs -t between a task whose output exists in sstate and a recently executed version of the same task, as well as produce the correct error message if only one signature is found in the stamps directory (not enough for a comparison but enough to tell the user that they at least got the task/recipe name correct.) Signed-off-by: Paul Eggleton --- meta/lib/oe/sstatesig.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py index 852fb7e64a..3ea0bfdb12 100644 --- a/meta/lib/oe/sstatesig.py +++ b/meta/lib/oe/sstatesig.py @@ -106,6 +106,7 @@ def find_siginfo(pn, taskname, taskhashlist, d): stamp = localdata.getVar('STAMP', True) filespec = '%s.%s.sigdata.*' % (stamp, taskname) foundall = False + skipsigs = [] import glob for fullpath in glob.glob(filespec): match = False @@ -118,6 +119,7 @@ def find_siginfo(pn, taskname, taskhashlist, d): break else: filedates[fullpath] = os.stat(fullpath).st_mtime + skipsigs.append(fullpath.rsplit('.', 1)[-1]) if len(filedates) < 2 and not foundall: # That didn't work, look in sstate-cache @@ -137,21 +139,31 @@ def find_siginfo(pn, taskname, taskhashlist, d): if not sstatename: sstatename = taskname filespec = '%s_%s.*.siginfo' % (localdata.getVar('SSTATE_PKG', True), sstatename) + # We want to ignore any sstate siginfo files with the same signature as we've already found in the stamps + skipfilespecs = [] + for skiphash in skipsigs: + localdata.setVar('BB_TASKHASH', skiphash) + skipfilespecs.append('%s_%s.*.siginfo' % (localdata.getVar('SSTATE_PKG', True), sstatename)) if hashval != '*': sstatedir = "%s/%s" % (d.getVar('SSTATE_DIR', True), hashval[:2]) else: sstatedir = d.getVar('SSTATE_DIR', True) - filedates = {} for root, dirs, files in os.walk(sstatedir): for fn in files: fullpath = os.path.join(root, fn) if fnmatch.fnmatch(fullpath, filespec): - if taskhashlist: - hashfiles[hashval] = fullpath - else: - filedates[fullpath] = os.stat(fullpath).st_mtime + skip = False + for skipfilespec in skipfilespecs: + if fnmatch.fnmatch(fullpath, skipfilespec): + skip = True + break + if not skip: + if taskhashlist: + hashfiles[hashval] = fullpath + else: + filedates[fullpath] = os.stat(fullpath).st_mtime if taskhashlist: return hashfiles -- cgit 1.2.3-korg