summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2017-03-11 06:22:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-23 13:19:49 +0000
commit82982d3d974f70970f334925648c83423e57371b (patch)
treee6cc97be30da9340d113b7cba240ee76d441da08 /bitbake
parent99069699f1fd1f37f3fdc1435cae8ba702db65c9 (diff)
downloadpoky-82982d3d974f70970f334925648c83423e57371b.tar.gz
bitbake: 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. (Bitbake rev: bdc4356c7afc542b67b78e4e5225b813d7668ecd) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/bitbake-dumpsig53
1 files changed, 42 insertions, 11 deletions
diff --git a/bitbake/bin/bitbake-dumpsig b/bitbake/bin/bitbake-dumpsig
index 58ba1cad04..b1fce2510d 100755
--- a/bitbake/bin/bitbake-dumpsig
+++ b/bitbake/bin/bitbake-dumpsig
@@ -27,6 +27,7 @@ import pickle
27 27
28sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib')) 28sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
29 29
30import bb.tinfoil
30import bb.siggen 31import bb.siggen
31 32
32def logger_create(name, output=sys.stderr): 33def logger_create(name, output=sys.stderr):
@@ -42,24 +43,54 @@ def logger_create(name, output=sys.stderr):
42 43
43logger = logger_create('bitbake-dumpsig') 44logger = logger_create('bitbake-dumpsig')
44 45
46def find_siginfo_task(bbhandler, pn, taskname):
47 """ Find the most recent signature file for the specified PN/task """
48
49 if not hasattr(bb.siggen, 'find_siginfo'):
50 logger.error('Metadata does not support finding signature data files')
51 sys.exit(1)
52
53 if not taskname.startswith('do_'):
54 taskname = 'do_%s' % taskname
55
56 filedates = bb.siggen.find_siginfo(pn, taskname, None, bbhandler.config_data)
57 latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-1:]
58 if not latestfiles:
59 logger.error('No sigdata files found matching %s %s' % (pn, taskname))
60 sys.exit(1)
61
62 return latestfiles[0]
63
45parser = optparse.OptionParser( 64parser = optparse.OptionParser(
46 description = "Dumps siginfo/sigdata files written out by BitBake", 65 description = "Dumps siginfo/sigdata files written out by BitBake",
47 usage = """ 66 usage = """
67 %prog -t recipename taskname
48 %prog sigdatafile""") 68 %prog sigdatafile""")
49 69
70parser.add_option("-t", "--task",
71 help = "find the signature data file for the specified task",
72 action="store", dest="taskargs", nargs=2, metavar='recipename taskname')
73
50options, args = parser.parse_args(sys.argv) 74options, args = parser.parse_args(sys.argv)
51 75
52if len(args) == 1: 76if options.taskargs:
77 tinfoil = bb.tinfoil.Tinfoil()
78 tinfoil.prepare(config_only = True)
79 file = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1])
80elif len(args) == 1:
53 parser.print_help() 81 parser.print_help()
82 sys.exit(0)
54else: 83else:
55 try: 84 file = args[1]
56 output = bb.siggen.dump_sigfile(args[1]) 85
57 except IOError as e: 86try:
58 logger.error(str(e)) 87 output = bb.siggen.dump_sigfile(file)
59 sys.exit(1) 88except IOError as e:
60 except (pickle.UnpicklingError, EOFError): 89 logger.error(str(e))
61 logger.error('Invalid signature data - ensure you are specifying a sigdata/siginfo file') 90 sys.exit(1)
62 sys.exit(1) 91except (pickle.UnpicklingError, EOFError):
92 logger.error('Invalid signature data - ensure you are specifying a sigdata/siginfo file')
93 sys.exit(1)
63 94
64 if output: 95if output:
65 print('\n'.join(output)) 96 print('\n'.join(output))