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:55 +0000 |
| commit | c83f272ac74062eaad727bd4a43db3407b881e5e (patch) | |
| tree | c2bb84dc2bf14f8a91a914b92338657de0f4c096 /bitbake/bin/bitbake-dumpsig | |
| parent | 3df2f71748f3ae8ca316f570f403eeafb7af3215 (diff) | |
| download | poky-c83f272ac74062eaad727bd4a43db3407b881e5e.tar.gz | |
bitbake: 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.
(Bitbake rev: 3635b829e4eb940ada2b52bfb5b5e5be93a3b0aa)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin/bitbake-dumpsig')
| l---------[-rwxr-xr-x] | bitbake/bin/bitbake-dumpsig | 95 |
1 files changed, 1 insertions, 94 deletions
diff --git a/bitbake/bin/bitbake-dumpsig b/bitbake/bin/bitbake-dumpsig index 95ebd93546..b1e8489b45 100755..120000 --- a/bitbake/bin/bitbake-dumpsig +++ b/bitbake/bin/bitbake-dumpsig | |||
| @@ -1,94 +1 @@ | |||
| 1 | #!/usr/bin/env python3 | bitbake-diffsigs \ No newline at end of file | |
| 2 | |||
| 3 | # bitbake-dumpsig | ||
| 4 | # BitBake task signature dump utility | ||
| 5 | # | ||
| 6 | # Copyright (C) 2013 Intel Corporation | ||
| 7 | # | ||
| 8 | # This program is free software; you can redistribute it and/or modify | ||
| 9 | # it under the terms of the GNU General Public License version 2 as | ||
| 10 | # published by the Free Software Foundation. | ||
| 11 | # | ||
| 12 | # This program is distributed in the hope that it will be useful, | ||
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | # GNU General Public License for more details. | ||
| 16 | # | ||
| 17 | # You should have received a copy of the GNU General Public License along | ||
| 18 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
| 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | |||
| 21 | import os | ||
| 22 | import sys | ||
| 23 | import warnings | ||
| 24 | import optparse | ||
| 25 | import logging | ||
| 26 | import pickle | ||
| 27 | |||
| 28 | sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib')) | ||
| 29 | |||
| 30 | import bb.tinfoil | ||
| 31 | import bb.siggen | ||
| 32 | import bb.msg | ||
| 33 | |||
| 34 | logger = bb.msg.logger_create('bitbake-dumpsig') | ||
| 35 | |||
| 36 | def find_siginfo_task(bbhandler, pn, taskname): | ||
| 37 | """ Find the most recent signature file for the specified PN/task """ | ||
| 38 | |||
| 39 | if not hasattr(bb.siggen, 'find_siginfo'): | ||
| 40 | logger.error('Metadata does not support finding signature data files') | ||
| 41 | sys.exit(1) | ||
| 42 | |||
| 43 | if not taskname.startswith('do_'): | ||
| 44 | taskname = 'do_%s' % taskname | ||
| 45 | |||
| 46 | filedates = bb.siggen.find_siginfo(pn, taskname, None, bbhandler.config_data) | ||
| 47 | latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-1:] | ||
| 48 | if not latestfiles: | ||
| 49 | logger.error('No sigdata files found matching %s %s' % (pn, taskname)) | ||
| 50 | sys.exit(1) | ||
| 51 | |||
| 52 | return latestfiles[0] | ||
| 53 | |||
| 54 | parser = optparse.OptionParser( | ||
| 55 | description = "Dumps siginfo/sigdata files written out by BitBake", | ||
| 56 | usage = """ | ||
| 57 | %prog -t recipename taskname | ||
| 58 | %prog sigdatafile""") | ||
| 59 | |||
| 60 | parser.add_option("-D", "--debug", | ||
| 61 | help = "enable debug", | ||
| 62 | action = "store_true", dest="debug", default = False) | ||
| 63 | |||
| 64 | parser.add_option("-t", "--task", | ||
| 65 | help = "find the signature data file for the specified task", | ||
| 66 | action="store", dest="taskargs", nargs=2, metavar='recipename taskname') | ||
| 67 | |||
| 68 | options, args = parser.parse_args(sys.argv) | ||
| 69 | |||
| 70 | if options.debug: | ||
| 71 | logger.setLevel(logging.DEBUG) | ||
| 72 | |||
| 73 | if options.taskargs: | ||
| 74 | tinfoil = bb.tinfoil.Tinfoil() | ||
| 75 | tinfoil.prepare(config_only = True) | ||
| 76 | file = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1]) | ||
| 77 | logger.debug("Signature file: %s" % file) | ||
| 78 | elif len(args) == 1: | ||
| 79 | parser.print_help() | ||
| 80 | sys.exit(0) | ||
| 81 | else: | ||
| 82 | file = args[1] | ||
| 83 | |||
| 84 | try: | ||
| 85 | output = bb.siggen.dump_sigfile(file) | ||
| 86 | except IOError as e: | ||
| 87 | logger.error(str(e)) | ||
| 88 | sys.exit(1) | ||
| 89 | except (pickle.UnpicklingError, EOFError): | ||
| 90 | logger.error('Invalid signature data - ensure you are specifying a sigdata/siginfo file') | ||
| 91 | sys.exit(1) | ||
| 92 | |||
| 93 | if output: | ||
| 94 | print('\n'.join(output)) | ||
