summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2015-03-11 11:21:06 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-28 09:39:06 +0100
commite14873d6847fae8abd3baf4bdc804d52d3b0c4f5 (patch)
tree12c2791275d518abe7f190ce5246fdc96191da74
parentcb8224f0c73c06879783665e2de39ecca7f6a350 (diff)
downloadbitbake-e14873d6847fae8abd3baf4bdc804d52d3b0c4f5.tar.gz
bitbake-diffsigs: consider the situation where sigdata and siginfo files having the same hash values
For now, `bitbake-diffsigs -t <recipe> <task>' doesn't work. It always outputs nothing. The problem is that bitbake-diffsigs are comparing sigdata and siginfo files that have the same hash value. This is not what we want. These two files are actually duplicates considering the purpose of bitbake-diffsigs. So we need to remove one of them so that bitbake-diffsigs could actually compare the correct signature files. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbin/bitbake-diffsigs18
1 files changed, 17 insertions, 1 deletions
diff --git a/bin/bitbake-diffsigs b/bin/bitbake-diffsigs
index 08ae00db0..196f0b73e 100755
--- a/bin/bitbake-diffsigs
+++ b/bin/bitbake-diffsigs
@@ -46,6 +46,12 @@ logger = logger_create('bitbake-diffsigs')
def find_compare_task(bbhandler, pn, taskname):
""" Find the most recent signature files for the specified PN/task and compare them """
+ def get_hashval(siginfo):
+ if siginfo.endswith('.siginfo'):
+ return siginfo.rpartition(':')[2].partition('_')[0]
+ else:
+ return siginfo.rpartition('.')[2]
+
if not hasattr(bb.siggen, 'find_siginfo'):
logger.error('Metadata does not support finding signature data files')
sys.exit(1)
@@ -54,7 +60,7 @@ def find_compare_task(bbhandler, pn, taskname):
taskname = 'do_%s' % taskname
filedates = bb.siggen.find_siginfo(pn, taskname, None, bbhandler.config_data)
- latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-2:]
+ latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-3:]
if not latestfiles:
logger.error('No sigdata files found matching %s %s' % (pn, taskname))
sys.exit(1)
@@ -62,6 +68,16 @@ def find_compare_task(bbhandler, pn, taskname):
logger.error('Only one matching sigdata file found for the specified task (%s %s)' % (pn, taskname))
sys.exit(1)
else:
+ # It's possible that latestfiles contain 3 elements and the first two have the same hash value.
+ # In this case, we delete the second element.
+ # The above case is actually the most common one. Because we may have sigdata file and siginfo
+ # file having the same hash value. Comparing such two files makes no sense.
+ if len(latestfiles) == 3:
+ hash0 = get_hashval(latestfiles[0])
+ hash1 = get_hashval(latestfiles[1])
+ if hash0 == hash1:
+ latestfiles.pop(1)
+
# Define recursion callback
def recursecb(key, hash1, hash2):
hashes = [hash1, hash2]