diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2018-12-28 18:30:39 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-03 12:36:50 +0000 |
commit | 3635b829e4eb940ada2b52bfb5b5e5be93a3b0aa (patch) | |
tree | 089281f27495efce27af7401791b3ec7b769777a /bin/bitbake-dumpsig | |
parent | fb6de2057aae3fbdf37f007d2e47794b332020e1 (diff) | |
download | bitbake-contrib-3635b829e4eb940ada2b52bfb5b5e5be93a3b0aa.tar.gz |
bitbake-diffsigs: Merge with bitbake-dumpsig
The functionalities of bitbake-diffsigs and bitbake-dumpsig are so
similar that they can be merged into one. Add an option --dump to make
bitbake-diffsigs dump the last signature data instead of comparing it.
Keep bitbake-dumpsig as a symbolic link to bitbake-diffsigs. When it is
called as bitbake-dumpsig, it behaves as if --dump was specified.
Also make -D the short option for --debug again (the way it used to be,
and still was for bitbake-dumpsig), so that -d can be used as the short
option for --dump.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bin/bitbake-dumpsig')
l---------[-rwxr-xr-x] | bin/bitbake-dumpsig | 95 |
1 files changed, 1 insertions, 94 deletions
diff --git a/bin/bitbake-dumpsig b/bin/bitbake-dumpsig index 95ebd9354..b1e8489b4 100755..120000 --- a/bin/bitbake-dumpsig +++ b/bin/bitbake-dumpsig @@ -1,94 +1 @@ -#!/usr/bin/env python3 - -# bitbake-dumpsig -# BitBake task signature dump utility -# -# Copyright (C) 2013 Intel Corporation -# -# 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 -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -import os -import sys -import warnings -import optparse -import logging -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 -import bb.msg - -logger = bb.msg.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("-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) -else: - 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)) +bitbake-diffsigs
\ No newline at end of file |