[oe-commits] [bitbake] 02/04: bitbake-dumpsig: Allow recipe and task to be specified
git at git.openembedded.org
git at git.openembedded.org
Wed Mar 22 14:55:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository bitbake.
commit bdc4356c7afc542b67b78e4e5225b813d7668ecd
Author: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
AuthorDate: Sat Mar 11 06:22:15 2017 +0100
bitbake-dumpsig: Allow recipe and task to be specified
Use --task <recipe> <task> to dump the signature info for a given
recipe and task. This is similar to the --task option of
bitbake-diffsigs.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
bin/bitbake-dumpsig | 53 ++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 42 insertions(+), 11 deletions(-)
diff --git a/bin/bitbake-dumpsig b/bin/bitbake-dumpsig
index 58ba1ca..b1fce25 100755
--- a/bin/bitbake-dumpsig
+++ b/bin/bitbake-dumpsig
@@ -27,6 +27,7 @@ import pickle
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
+import bb.tinfoil
import bb.siggen
def logger_create(name, output=sys.stderr):
@@ -42,24 +43,54 @@ def logger_create(name, output=sys.stderr):
logger = logger_create('bitbake-dumpsig')
+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)
+ latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-1:]
+ if not latestfiles:
+ logger.error('No sigdata files found matching %s %s' % (pn, taskname))
+ sys.exit(1)
+
+ return latestfiles[0]
+
parser = optparse.OptionParser(
description = "Dumps siginfo/sigdata files written out by BitBake",
usage = """
+ %prog -t recipename taskname
%prog sigdatafile""")
+parser.add_option("-t", "--task",
+ help = "find the signature data file for the specified task",
+ action="store", dest="taskargs", nargs=2, metavar='recipename taskname')
+
options, args = parser.parse_args(sys.argv)
-if len(args) == 1:
+if options.taskargs:
+ tinfoil = bb.tinfoil.Tinfoil()
+ tinfoil.prepare(config_only = True)
+ file = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1])
+elif len(args) == 1:
parser.print_help()
+ sys.exit(0)
else:
- try:
- output = bb.siggen.dump_sigfile(args[1])
- except IOError as e:
- logger.error(str(e))
- sys.exit(1)
- except (pickle.UnpicklingError, EOFError):
- logger.error('Invalid signature data - ensure you are specifying a sigdata/siginfo file')
- sys.exit(1)
+ file = args[1]
+
+try:
+ output = bb.siggen.dump_sigfile(file)
+except IOError as e:
+ logger.error(str(e))
+ sys.exit(1)
+except (pickle.UnpicklingError, EOFError):
+ logger.error('Invalid signature data - ensure you are specifying a sigdata/siginfo file')
+ sys.exit(1)
- if output:
- print('\n'.join(output))
+if output:
+ print('\n'.join(output))
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list