diff options
Diffstat (limited to 'bitbake/bin/bitbake-diffsigs')
| -rwxr-xr-x | bitbake/bin/bitbake-diffsigs | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs index eb2f859793..4e6bbddcd8 100755 --- a/bitbake/bin/bitbake-diffsigs +++ b/bitbake/bin/bitbake-diffsigs | |||
| @@ -34,18 +34,39 @@ import bb.msg | |||
| 34 | 34 | ||
| 35 | logger = bb.msg.logger_create('bitbake-diffsigs') | 35 | logger = bb.msg.logger_create('bitbake-diffsigs') |
| 36 | 36 | ||
| 37 | def find_siginfo(tinfoil, pn, taskname, sigs=None): | ||
| 38 | result = None | ||
| 39 | tinfoil.set_event_mask(['bb.event.FindSigInfoResult', | ||
| 40 | 'logging.LogRecord', | ||
| 41 | 'bb.command.CommandCompleted', | ||
| 42 | 'bb.command.CommandFailed']) | ||
| 43 | ret = tinfoil.run_command('findSigInfo', pn, taskname, sigs) | ||
| 44 | if ret: | ||
| 45 | while True: | ||
| 46 | event = tinfoil.wait_event(1) | ||
| 47 | if event: | ||
| 48 | if isinstance(event, bb.command.CommandCompleted): | ||
| 49 | break | ||
| 50 | elif isinstance(event, bb.command.CommandFailed): | ||
| 51 | logger.error(str(event)) | ||
| 52 | sys.exit(2) | ||
| 53 | elif isinstance(event, bb.event.FindSigInfoResult): | ||
| 54 | result = event.result | ||
| 55 | elif isinstance(event, logging.LogRecord): | ||
| 56 | logger.handle(event) | ||
| 57 | else: | ||
| 58 | logger.error('No result returned from findSigInfo command') | ||
| 59 | sys.exit(2) | ||
| 60 | return result | ||
| 61 | |||
| 37 | def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None, color=False): | 62 | def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None, color=False): |
| 38 | """ Find the most recent signature files for the specified PN/task and compare them """ | 63 | """ Find the most recent signature files for the specified PN/task and compare them """ |
| 39 | 64 | ||
| 40 | if not hasattr(bb.siggen, 'find_siginfo'): | ||
| 41 | logger.error('Metadata does not support finding signature data files') | ||
| 42 | sys.exit(1) | ||
| 43 | |||
| 44 | if not taskname.startswith('do_'): | 65 | if not taskname.startswith('do_'): |
| 45 | taskname = 'do_%s' % taskname | 66 | taskname = 'do_%s' % taskname |
| 46 | 67 | ||
| 47 | if sig1 and sig2: | 68 | if sig1 and sig2: |
| 48 | sigfiles = bb.siggen.find_siginfo(pn, taskname, [sig1, sig2], bbhandler.config_data) | 69 | sigfiles = find_siginfo(bbhandler, pn, taskname, [sig1, sig2]) |
| 49 | if len(sigfiles) == 0: | 70 | if len(sigfiles) == 0: |
| 50 | logger.error('No sigdata files found matching %s %s matching either %s or %s' % (pn, taskname, sig1, sig2)) | 71 | logger.error('No sigdata files found matching %s %s matching either %s or %s' % (pn, taskname, sig1, sig2)) |
| 51 | sys.exit(1) | 72 | sys.exit(1) |
| @@ -57,7 +78,7 @@ def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None, color=False | |||
| 57 | sys.exit(1) | 78 | sys.exit(1) |
| 58 | latestfiles = [sigfiles[sig1], sigfiles[sig2]] | 79 | latestfiles = [sigfiles[sig1], sigfiles[sig2]] |
| 59 | else: | 80 | else: |
| 60 | filedates = bb.siggen.find_siginfo(pn, taskname, None, bbhandler.config_data) | 81 | filedates = find_siginfo(bbhandler, pn, taskname) |
| 61 | latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-3:] | 82 | latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-3:] |
| 62 | if not latestfiles: | 83 | if not latestfiles: |
| 63 | logger.error('No sigdata files found matching %s %s' % (pn, taskname)) | 84 | logger.error('No sigdata files found matching %s %s' % (pn, taskname)) |
| @@ -69,7 +90,7 @@ def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None, color=False | |||
| 69 | # Define recursion callback | 90 | # Define recursion callback |
| 70 | def recursecb(key, hash1, hash2): | 91 | def recursecb(key, hash1, hash2): |
| 71 | hashes = [hash1, hash2] | 92 | hashes = [hash1, hash2] |
| 72 | hashfiles = bb.siggen.find_siginfo(key, None, hashes, bbhandler.config_data) | 93 | hashfiles = find_siginfo(bbhandler, key, None, hashes) |
| 73 | 94 | ||
| 74 | recout = [] | 95 | recout = [] |
| 75 | if len(hashfiles) == 0: | 96 | if len(hashfiles) == 0: |
