[bitbake-devel,1/2] bitbake-dumpsig: Make --task work again

Submitted by Peter Kjellerstedt on Nov. 14, 2018, 1:10 a.m. | Patch ID: 156268

Details

Message ID 20181114011019.878-1-pkj@axis.com
State New
Headers show

Commit Message

Peter Kjellerstedt Nov. 14, 2018, 1:10 a.m.
This corresponds to commit fdcea991 that fixed the --task option for
bitbake-diffsigs.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 bitbake/bin/bitbake-dumpsig | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/bitbake/bin/bitbake-dumpsig b/bitbake/bin/bitbake-dumpsig
index 95ebd93546..40e08e0439 100755
--- a/bitbake/bin/bitbake-dumpsig
+++ b/bitbake/bin/bitbake-dumpsig
@@ -3,7 +3,8 @@ 
 # bitbake-dumpsig
 # BitBake task signature dump utility
 #
-# Copyright (C) 2013 Intel Corporation
+# Copyright (C) 2013, 2017 Intel Corporation
+# Copyright (C) 2017-2018 Axis Communications AB
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License version 2 as
@@ -33,17 +34,38 @@  import bb.msg
 
 logger = bb.msg.logger_create('bitbake-dumpsig')
 
+def find_siginfo(tinfoil, pn, taskname, sigs=None):
+    result = None
+    tinfoil.set_event_mask(['bb.event.FindSigInfoResult',
+                            'logging.LogRecord',
+                            'bb.command.CommandCompleted',
+                            'bb.command.CommandFailed'])
+    ret = tinfoil.run_command('findSigInfo', pn, taskname, sigs)
+    if ret:
+        while True:
+            event = tinfoil.wait_event(1)
+            if event:
+                if isinstance(event, bb.command.CommandCompleted):
+                    break
+                elif isinstance(event, bb.command.CommandFailed):
+                    logger.error(str(event))
+                    sys.exit(2)
+                elif isinstance(event, bb.event.FindSigInfoResult):
+                    result = event.result
+                elif isinstance(event, logging.LogRecord):
+                    logger.handle(event)
+    else:
+        logger.error('No result returned from findSigInfo command')
+        sys.exit(2)
+    return result
+
 def find_siginfo_task(bbhandler, pn, taskname):
     """ Find the most recent signature file for the specified PN/task """
 
-    if not hasattr(bb.siggen, 'find_siginfo'):
-        logger.error('Metadata does not support finding signature data files')
-        sys.exit(1)
-
     if not taskname.startswith('do_'):
         taskname = 'do_%s' % taskname
 
-    filedates = bb.siggen.find_siginfo(pn, taskname, None, bbhandler.config_data)
+    filedates = find_siginfo(bbhandler, pn, taskname)
     latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-1:]
     if not latestfiles:
         logger.error('No sigdata files found matching %s %s' % (pn, taskname))