Improve bitbake-dumpsig
cover Improve bitbake-dumpsig
This adds support to bitbake-dumpsig to specify the signature file to dump by specifying a recipie and task using --task (-t), the same way it is possible to do for bitbake-diffsigs.
It also adds support to bitbake-dumpsig and bitbake-diffsigs to output some debug data (currently the names of the identified signature files) by specifying --debug (-D).
//Peter
The following changes since commit 760e81678cec80dcdaab12c2a0a0148e3e0ba275:
go: Add recipes for golang compilers and tools (2017-03-10 15:51:55 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib pkj/bitbake-dumpsig
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/bitbake-dumpsig
Peter Kjellerstedt (3):
bitbake-dumpsig: Allow recipe and task to be specified
bitbake-dumpsig: Add debug support
bitbake-diffsigs: Add debug support
bitbake/bin/bitbake-diffsigs | 9 +++++++ bitbake/bin/bitbake-dumpsig | 61 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 59 insertions(+), 11 deletions(-)
Signature · 1 line
2.12.0
PATCH 2/3 bitbake-dumpsig: Add debug support
Currently shows the name of the signature file that was found when --task is used.
--- bitbake/bin/bitbake-dumpsig | 8 ++++++++ 1 file changed, 8 insertions(+)
bitbake/bin/bitbake-dumpsig +8 -0
@@ -67,16 +67,24 @@ parser = optparse.OptionParser( %prog -t recipename taskname %prog sigdatafile""") +parser.add_option("-D", "--debug", + help = "enable debug", + action = "store_true", dest="debug", default = False) + 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 options.debug: + logger.setLevel(logging.DEBUG) + if options.taskargs: tinfoil = bb.tinfoil.Tinfoil() tinfoil.prepare(config_only = True) file = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1]) + logger.debug("Signature file: %s" % file) elif len(args) == 1: parser.print_help() sys.exit(0)
Signature · 1 line
2.12.0
PATCH 1/3 bitbake-dumpsig: Allow recipe and task to be specified
In reply to Peter KjellerstedtUse --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/bin/bitbake-dumpsig | 53 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 11 deletions(-)
bitbake/bin/bitbake-dumpsig +42 -11
@@ -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))
Signature · 1 line
2.12.0
PATCH 3/3 bitbake-diffsigs: Add debug support
In reply to Peter KjellerstedtCurrently shows the name of the signature files that were found when --task is used.
--- bitbake/bin/bitbake-diffsigs | 9 +++++++++ 1 file changed, 9 insertions(+)
bitbake/bin/bitbake-diffsigs +9 -0
@@ -94,6 +94,8 @@ def find_compare_task(bbhandler, pn, taskname): return recout # Recurse into signature comparison + logger.debug("Signature file (previous): %s" % latestfiles[0]) + logger.debug("Signature file (latest): %s" % latestfiles[1]) output = bb.siggen.compare_sigfiles(latestfiles[0], latestfiles[1], recursecb) if output: print('\n'.join(output))
@@ -108,12 +110,19 @@ parser = optparse.OptionParser( %prog sigdatafile1 sigdatafile2 %prog sigdatafile1""") +parser.add_option("-D", "--debug", + help = "enable debug", + action = "store_true", dest="debug", default = False) + parser.add_option("-t", "--task", help = "find the signature data files for last two runs of the specified task and compare them", action="store", dest="taskargs", nargs=2, metavar='recipename taskname') options, args = parser.parse_args(sys.argv) +if options.debug: + logger.setLevel(logging.DEBUG) + if options.taskargs: with bb.tinfoil.Tinfoil() as tinfoil: tinfoil.prepare(config_only=True)
Signature · 1 line
2.12.0