diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2015-03-11 11:21:06 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-17 11:55:44 +0100 |
commit | 547b189951283e1ea1fabd135d32bcb59124d8c3 (patch) | |
tree | 4d5fe80bfd2bf229f2189b0ad2bbb6088c980ef2 /bitbake/bin/bitbake-diffsigs | |
parent | abc7f15960b0ae2c13e6ca34b2452f7baa353370 (diff) | |
download | poky-547b189951283e1ea1fabd135d32bcb59124d8c3.tar.gz |
bitbake: 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.
(Bitbake rev: c34613eb69fd19770cbfc78ab8384221f10d5587)
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin/bitbake-diffsigs')
-rwxr-xr-x | bitbake/bin/bitbake-diffsigs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs index 08ae00db0f..196f0b73e8 100755 --- a/bitbake/bin/bitbake-diffsigs +++ b/bitbake/bin/bitbake-diffsigs | |||
@@ -46,6 +46,12 @@ logger = logger_create('bitbake-diffsigs') | |||
46 | def find_compare_task(bbhandler, pn, taskname): | 46 | def find_compare_task(bbhandler, pn, taskname): |
47 | """ Find the most recent signature files for the specified PN/task and compare them """ | 47 | """ Find the most recent signature files for the specified PN/task and compare them """ |
48 | 48 | ||
49 | def get_hashval(siginfo): | ||
50 | if siginfo.endswith('.siginfo'): | ||
51 | return siginfo.rpartition(':')[2].partition('_')[0] | ||
52 | else: | ||
53 | return siginfo.rpartition('.')[2] | ||
54 | |||
49 | if not hasattr(bb.siggen, 'find_siginfo'): | 55 | if not hasattr(bb.siggen, 'find_siginfo'): |
50 | logger.error('Metadata does not support finding signature data files') | 56 | logger.error('Metadata does not support finding signature data files') |
51 | sys.exit(1) | 57 | sys.exit(1) |
@@ -54,7 +60,7 @@ def find_compare_task(bbhandler, pn, taskname): | |||
54 | taskname = 'do_%s' % taskname | 60 | taskname = 'do_%s' % taskname |
55 | 61 | ||
56 | filedates = bb.siggen.find_siginfo(pn, taskname, None, bbhandler.config_data) | 62 | filedates = bb.siggen.find_siginfo(pn, taskname, None, bbhandler.config_data) |
57 | latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-2:] | 63 | latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-3:] |
58 | if not latestfiles: | 64 | if not latestfiles: |
59 | logger.error('No sigdata files found matching %s %s' % (pn, taskname)) | 65 | logger.error('No sigdata files found matching %s %s' % (pn, taskname)) |
60 | sys.exit(1) | 66 | sys.exit(1) |
@@ -62,6 +68,16 @@ def find_compare_task(bbhandler, pn, taskname): | |||
62 | logger.error('Only one matching sigdata file found for the specified task (%s %s)' % (pn, taskname)) | 68 | logger.error('Only one matching sigdata file found for the specified task (%s %s)' % (pn, taskname)) |
63 | sys.exit(1) | 69 | sys.exit(1) |
64 | else: | 70 | else: |
71 | # It's possible that latestfiles contain 3 elements and the first two have the same hash value. | ||
72 | # In this case, we delete the second element. | ||
73 | # The above case is actually the most common one. Because we may have sigdata file and siginfo | ||
74 | # file having the same hash value. Comparing such two files makes no sense. | ||
75 | if len(latestfiles) == 3: | ||
76 | hash0 = get_hashval(latestfiles[0]) | ||
77 | hash1 = get_hashval(latestfiles[1]) | ||
78 | if hash0 == hash1: | ||
79 | latestfiles.pop(1) | ||
80 | |||
65 | # Define recursion callback | 81 | # Define recursion callback |
66 | def recursecb(key, hash1, hash2): | 82 | def recursecb(key, hash1, hash2): |
67 | hashes = [hash1, hash2] | 83 | hashes = [hash1, hash2] |