diff options
Diffstat (limited to 'bitbake/bin/bitbake-diffsigs')
| -rwxr-xr-x | bitbake/bin/bitbake-diffsigs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs index e9fdb48993..884be1e3c7 100755 --- a/bitbake/bin/bitbake-diffsigs +++ b/bitbake/bin/bitbake-diffsigs | |||
| @@ -34,7 +34,7 @@ import bb.msg | |||
| 34 | 34 | ||
| 35 | logger = bb.msg.logger_create('bitbake-diffsigs') | 35 | logger = bb.msg.logger_create('bitbake-diffsigs') |
| 36 | 36 | ||
| 37 | def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None): | 37 | def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None, color=False): |
| 38 | """ Find the most recent signature files for the specified PN/task and compare them """ | 38 | """ Find the most recent signature files for the specified PN/task and compare them """ |
| 39 | 39 | ||
| 40 | if not hasattr(bb.siggen, 'find_siginfo'): | 40 | if not hasattr(bb.siggen, 'find_siginfo'): |
| @@ -79,7 +79,7 @@ def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None): | |||
| 79 | elif not hash2 in hashfiles: | 79 | elif not hash2 in hashfiles: |
| 80 | recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash2)) | 80 | recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash2)) |
| 81 | else: | 81 | else: |
| 82 | out2 = bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb) | 82 | out2 = bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb, color=color) |
| 83 | for change in out2: | 83 | for change in out2: |
| 84 | for line in change.splitlines(): | 84 | for line in change.splitlines(): |
| 85 | recout.append(' ' + line) | 85 | recout.append(' ' + line) |
| @@ -89,7 +89,7 @@ def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None): | |||
| 89 | # Recurse into signature comparison | 89 | # Recurse into signature comparison |
| 90 | logger.debug("Signature file (previous): %s" % latestfiles[-2]) | 90 | logger.debug("Signature file (previous): %s" % latestfiles[-2]) |
| 91 | logger.debug("Signature file (latest): %s" % latestfiles[-1]) | 91 | logger.debug("Signature file (latest): %s" % latestfiles[-1]) |
| 92 | output = bb.siggen.compare_sigfiles(latestfiles[-2], latestfiles[-1], recursecb) | 92 | output = bb.siggen.compare_sigfiles(latestfiles[-2], latestfiles[-1], recursecb, color=color) |
| 93 | if output: | 93 | if output: |
| 94 | print('\n'.join(output)) | 94 | print('\n'.join(output)) |
| 95 | sys.exit(0) | 95 | sys.exit(0) |
| @@ -103,6 +103,10 @@ parser.add_argument('-d', '--debug', | |||
| 103 | help='Enable debug output', | 103 | help='Enable debug output', |
| 104 | action='store_true') | 104 | action='store_true') |
| 105 | 105 | ||
| 106 | parser.add_argument('--color', | ||
| 107 | help='Colorize output (where %(metavar)s is %(choices)s)', | ||
| 108 | choices=['auto', 'always', 'never'], default='auto', metavar='color') | ||
| 109 | |||
| 106 | parser.add_argument("-t", "--task", | 110 | parser.add_argument("-t", "--task", |
| 107 | help="find the signature data files for last two runs of the specified task and compare them", | 111 | help="find the signature data files for last two runs of the specified task and compare them", |
| 108 | action="store", dest="taskargs", nargs=2, metavar=('recipename', 'taskname')) | 112 | action="store", dest="taskargs", nargs=2, metavar=('recipename', 'taskname')) |
| @@ -125,20 +129,22 @@ options = parser.parse_args() | |||
| 125 | if options.debug: | 129 | if options.debug: |
| 126 | logger.setLevel(logging.DEBUG) | 130 | logger.setLevel(logging.DEBUG) |
| 127 | 131 | ||
| 132 | color = (options.color == 'always' or (options.color == 'auto' and sys.stdout.isatty())) | ||
| 133 | |||
| 128 | if options.taskargs: | 134 | if options.taskargs: |
| 129 | with bb.tinfoil.Tinfoil() as tinfoil: | 135 | with bb.tinfoil.Tinfoil() as tinfoil: |
| 130 | tinfoil.prepare(config_only=True) | 136 | tinfoil.prepare(config_only=True) |
| 131 | if options.sigargs: | 137 | if options.sigargs: |
| 132 | find_compare_task(tinfoil, options.taskargs[0], options.taskargs[1], options.sigargs[0], options.sigargs[1]) | 138 | find_compare_task(tinfoil, options.taskargs[0], options.taskargs[1], options.sigargs[0], options.sigargs[1], color=color) |
| 133 | else: | 139 | else: |
| 134 | find_compare_task(tinfoil, options.taskargs[0], options.taskargs[1]) | 140 | find_compare_task(tinfoil, options.taskargs[0], options.taskargs[1], color=color) |
| 135 | else: | 141 | else: |
| 136 | if options.sigargs: | 142 | if options.sigargs: |
| 137 | logger.error('-s/--signature can only be used together with -t/--task') | 143 | logger.error('-s/--signature can only be used together with -t/--task') |
| 138 | sys.exit(1) | 144 | sys.exit(1) |
| 139 | try: | 145 | try: |
| 140 | if options.sigdatafile1 and options.sigdatafile2: | 146 | if options.sigdatafile1 and options.sigdatafile2: |
| 141 | output = bb.siggen.compare_sigfiles(options.sigdatafile1, options.sigdatafile2) | 147 | output = bb.siggen.compare_sigfiles(options.sigdatafile1, options.sigdatafile2, color=color) |
| 142 | elif options.sigdatafile1: | 148 | elif options.sigdatafile1: |
| 143 | output = bb.siggen.dump_sigfile(options.sigdatafile1) | 149 | output = bb.siggen.dump_sigfile(options.sigdatafile1) |
| 144 | except IOError as e: | 150 | except IOError as e: |
