summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbitbake/bin/bitbake-diffsigs35
-rw-r--r--bitbake/lib/bb/command.py11
-rw-r--r--bitbake/lib/bb/event.py8
3 files changed, 47 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
35logger = bb.msg.logger_create('bitbake-diffsigs') 35logger = bb.msg.logger_create('bitbake-diffsigs')
36 36
37def 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
37def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None, color=False): 62def 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:
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 0e0a35af69..c44c7a6a5e 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -746,3 +746,14 @@ class CommandsAsync:
746 command.finishAsyncCommand() 746 command.finishAsyncCommand()
747 clientComplete.needcache = False 747 clientComplete.needcache = False
748 748
749 def findSigInfo(self, command, params):
750 """
751 Find signature info files via the signature generator
752 """
753 pn = params[0]
754 taskname = params[1]
755 sigs = params[2]
756 res = bb.siggen.find_siginfo(pn, taskname, sigs, command.cooker.data)
757 bb.event.fire(bb.event.FindSigInfoResult(res), command.cooker.data)
758 command.finishAsyncCommand()
759 findSigInfo.needcache = False
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 59cca61424..3827dcfba4 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -819,3 +819,11 @@ class NetworkTestFailed(Event):
819 """ 819 """
820 Event to indicate network test has failed 820 Event to indicate network test has failed
821 """ 821 """
822
823class FindSigInfoResult(Event):
824 """
825 Event to return results from findSigInfo command
826 """
827 def __init__(self, result):
828 Event.__init__(self)
829 self.result = result