diff options
| -rwxr-xr-x | bitbake/bin/bitbake-diffsigs | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs index 11b40b4e94..78757b0aae 100755 --- a/bitbake/bin/bitbake-diffsigs +++ b/bitbake/bin/bitbake-diffsigs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | # bitbake-diffsigs | 3 | # bitbake-diffsigs |
| 4 | # BitBake task signature data comparison utility | 4 | # BitBake task signature data comparison utility |
| 5 | # | 5 | # |
| 6 | # Copyright (C) 2012 Intel Corporation | 6 | # Copyright (C) 2012-2013 Intel Corporation |
| 7 | # | 7 | # |
| 8 | # This program is free software; you can redistribute it and/or modify | 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 | 9 | # it under the terms of the GNU General Public License version 2 as |
| @@ -30,7 +30,18 @@ sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), ' | |||
| 30 | import bb.tinfoil | 30 | import bb.tinfoil |
| 31 | import bb.siggen | 31 | import bb.siggen |
| 32 | 32 | ||
| 33 | logger = logging.getLogger('BitBake') | 33 | def logger_create(name, output=sys.stderr): |
| 34 | logger = logging.getLogger(name) | ||
| 35 | console = logging.StreamHandler(output) | ||
| 36 | format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") | ||
| 37 | if output.isatty(): | ||
| 38 | format.enable_color() | ||
| 39 | console.setFormatter(format) | ||
| 40 | logger.addHandler(console) | ||
| 41 | logger.setLevel(logging.INFO) | ||
| 42 | return logger | ||
| 43 | |||
| 44 | logger = logger_create('bitbake-diffsigs') | ||
| 34 | 45 | ||
| 35 | def find_compare_task(bbhandler, pn, taskname): | 46 | def find_compare_task(bbhandler, pn, taskname): |
| 36 | """ Find the most recent signature files for the specified PN/task and compare them """ | 47 | """ Find the most recent signature files for the specified PN/task and compare them """ |
| @@ -93,10 +104,19 @@ if options.taskargs: | |||
| 93 | else: | 104 | else: |
| 94 | if len(args) == 1: | 105 | if len(args) == 1: |
| 95 | parser.print_help() | 106 | parser.print_help() |
| 96 | elif len(args) == 2: | ||
| 97 | output = bb.siggen.dump_sigfile(sys.argv[1]) | ||
| 98 | else: | 107 | else: |
| 99 | output = bb.siggen.compare_sigfiles(sys.argv[1], sys.argv[2]) | 108 | import cPickle |
| 109 | try: | ||
| 110 | if len(args) == 2: | ||
| 111 | output = bb.siggen.dump_sigfile(sys.argv[1]) | ||
| 112 | else: | ||
| 113 | output = bb.siggen.compare_sigfiles(sys.argv[1], sys.argv[2]) | ||
| 114 | except IOError as e: | ||
| 115 | logger.error(str(e)) | ||
| 116 | sys.exit(1) | ||
| 117 | except cPickle.UnpicklingError, EOFError: | ||
| 118 | logger.error('Invalid signature data - ensure you are specifying sigdata/siginfo files') | ||
| 119 | sys.exit(1) | ||
| 100 | 120 | ||
| 101 | if output: | 121 | if output: |
| 102 | print '\n'.join(output) | 122 | print '\n'.join(output) |
