diff options
| -rwxr-xr-x | bitbake/bin/bitbake-diffsigs | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs index cf4cc706a2..fe0f33eea1 100755 --- a/bitbake/bin/bitbake-diffsigs +++ b/bitbake/bin/bitbake-diffsigs | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | import os | 11 | import os |
| 12 | import sys | 12 | import sys |
| 13 | import warnings | 13 | import warnings |
| 14 | |||
| 14 | warnings.simplefilter("default") | 15 | warnings.simplefilter("default") |
| 15 | import argparse | 16 | import argparse |
| 16 | import logging | 17 | import logging |
| @@ -27,6 +28,7 @@ logger = bb.msg.logger_create(myname) | |||
| 27 | 28 | ||
| 28 | is_dump = myname == 'bitbake-dumpsig' | 29 | is_dump = myname == 'bitbake-dumpsig' |
| 29 | 30 | ||
| 31 | |||
| 30 | def find_siginfo(tinfoil, pn, taskname, sigs=None): | 32 | def find_siginfo(tinfoil, pn, taskname, sigs=None): |
| 31 | result = None | 33 | result = None |
| 32 | tinfoil.set_event_mask(['bb.event.FindSigInfoResult', | 34 | tinfoil.set_event_mask(['bb.event.FindSigInfoResult', |
| @@ -52,6 +54,7 @@ def find_siginfo(tinfoil, pn, taskname, sigs=None): | |||
| 52 | sys.exit(2) | 54 | sys.exit(2) |
| 53 | return result | 55 | return result |
| 54 | 56 | ||
| 57 | |||
| 55 | def find_siginfo_task(bbhandler, pn, taskname, sig1=None, sig2=None): | 58 | def find_siginfo_task(bbhandler, pn, taskname, sig1=None, sig2=None): |
| 56 | """ Find the most recent signature files for the specified PN/task """ | 59 | """ Find the most recent signature files for the specified PN/task """ |
| 57 | 60 | ||
| @@ -63,10 +66,10 @@ def find_siginfo_task(bbhandler, pn, taskname, sig1=None, sig2=None): | |||
| 63 | if not sigfiles: | 66 | if not sigfiles: |
| 64 | logger.error('No sigdata files found matching %s %s matching either %s or %s' % (pn, taskname, sig1, sig2)) | 67 | logger.error('No sigdata files found matching %s %s matching either %s or %s' % (pn, taskname, sig1, sig2)) |
| 65 | sys.exit(1) | 68 | sys.exit(1) |
| 66 | elif not sig1 in sigfiles: | 69 | elif sig1 not in sigfiles: |
| 67 | logger.error('No sigdata files found matching %s %s with signature %s' % (pn, taskname, sig1)) | 70 | logger.error('No sigdata files found matching %s %s with signature %s' % (pn, taskname, sig1)) |
| 68 | sys.exit(1) | 71 | sys.exit(1) |
| 69 | elif not sig2 in sigfiles: | 72 | elif sig2 not in sigfiles: |
| 70 | logger.error('No sigdata files found matching %s %s with signature %s' % (pn, taskname, sig2)) | 73 | logger.error('No sigdata files found matching %s %s with signature %s' % (pn, taskname, sig2)) |
| 71 | sys.exit(1) | 74 | sys.exit(1) |
| 72 | latestfiles = [sigfiles[sig1], sigfiles[sig2]] | 75 | latestfiles = [sigfiles[sig1], sigfiles[sig2]] |
| @@ -88,9 +91,9 @@ def recursecb(key, hash1, hash2): | |||
| 88 | recout = [] | 91 | recout = [] |
| 89 | if not hashfiles: | 92 | if not hashfiles: |
| 90 | recout.append("Unable to find matching sigdata for %s with hashes %s or %s" % (key, hash1, hash2)) | 93 | recout.append("Unable to find matching sigdata for %s with hashes %s or %s" % (key, hash1, hash2)) |
| 91 | elif not hash1 in hashfiles: | 94 | elif hash1 not in hashfiles: |
| 92 | recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash1)) | 95 | recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash1)) |
| 93 | elif not hash2 in hashfiles: | 96 | elif hash2 not in hashfiles: |
| 94 | recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash2)) | 97 | recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash2)) |
| 95 | else: | 98 | else: |
| 96 | out2 = bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb, color=color) | 99 | out2 = bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb, color=color) |
| @@ -110,36 +113,36 @@ parser.add_argument('-D', '--debug', | |||
| 110 | 113 | ||
| 111 | if is_dump: | 114 | if is_dump: |
| 112 | parser.add_argument("-t", "--task", | 115 | parser.add_argument("-t", "--task", |
| 113 | help="find the signature data file for the last run of the specified task", | 116 | help="find the signature data file for the last run of the specified task", |
| 114 | action="store", dest="taskargs", nargs=2, metavar=('recipename', 'taskname')) | 117 | action="store", dest="taskargs", nargs=2, metavar=('recipename', 'taskname')) |
| 115 | 118 | ||
| 116 | parser.add_argument("sigdatafile1", | 119 | parser.add_argument("sigdatafile1", |
| 117 | help="Signature file to dump. Not used when using -t/--task.", | 120 | help="Signature file to dump. Not used when using -t/--task.", |
| 118 | action="store", nargs='?', metavar="sigdatafile") | 121 | action="store", nargs='?', metavar="sigdatafile") |
| 119 | else: | 122 | else: |
| 120 | parser.add_argument('-c', '--color', | 123 | parser.add_argument('-c', '--color', |
| 121 | help='Colorize the output (where %(metavar)s is %(choices)s)', | 124 | help='Colorize the output (where %(metavar)s is %(choices)s)', |
| 122 | choices=['auto', 'always', 'never'], default='auto', metavar='color') | 125 | choices=['auto', 'always', 'never'], default='auto', metavar='color') |
| 123 | 126 | ||
| 124 | parser.add_argument('-d', '--dump', | 127 | parser.add_argument('-d', '--dump', |
| 125 | help='Dump the last signature data instead of comparing (equivalent to using bitbake-dumpsig)', | 128 | help='Dump the last signature data instead of comparing (equivalent to using bitbake-dumpsig)', |
| 126 | action='store_true') | 129 | action='store_true') |
| 127 | 130 | ||
| 128 | parser.add_argument("-t", "--task", | 131 | parser.add_argument("-t", "--task", |
| 129 | help="find the signature data files for the last two runs of the specified task and compare them", | 132 | help="find the signature data files for the last two runs of the specified task and compare them", |
| 130 | action="store", dest="taskargs", nargs=2, metavar=('recipename', 'taskname')) | 133 | action="store", dest="taskargs", nargs=2, metavar=('recipename', 'taskname')) |
| 131 | 134 | ||
| 132 | parser.add_argument("-s", "--signature", | 135 | parser.add_argument("-s", "--signature", |
| 133 | help="With -t/--task, specify the signatures to look for instead of taking the last two", | 136 | help="With -t/--task, specify the signatures to look for instead of taking the last two", |
| 134 | action="store", dest="sigargs", nargs=2, metavar=('fromsig', 'tosig')) | 137 | action="store", dest="sigargs", nargs=2, metavar=('fromsig', 'tosig')) |
| 135 | 138 | ||
| 136 | parser.add_argument("sigdatafile1", | 139 | parser.add_argument("sigdatafile1", |
| 137 | help="First signature file to compare (or signature file to dump, if second not specified). Not used when using -t/--task.", | 140 | help="First signature file to compare (or signature file to dump, if second not specified). Not used when using -t/--task.", |
| 138 | action="store", nargs='?') | 141 | action="store", nargs='?') |
| 139 | 142 | ||
| 140 | parser.add_argument("sigdatafile2", | 143 | parser.add_argument("sigdatafile2", |
| 141 | help="Second signature file to compare", | 144 | help="Second signature file to compare", |
| 142 | action="store", nargs='?') | 145 | action="store", nargs='?') |
| 143 | 146 | ||
| 144 | options = parser.parse_args() | 147 | options = parser.parse_args() |
| 145 | if is_dump: | 148 | if is_dump: |
| @@ -157,7 +160,8 @@ if options.taskargs: | |||
| 157 | with bb.tinfoil.Tinfoil() as tinfoil: | 160 | with bb.tinfoil.Tinfoil() as tinfoil: |
| 158 | tinfoil.prepare(config_only=True) | 161 | tinfoil.prepare(config_only=True) |
| 159 | if not options.dump and options.sigargs: | 162 | if not options.dump and options.sigargs: |
| 160 | files = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1], options.sigargs[0], options.sigargs[1]) | 163 | files = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1], options.sigargs[0], |
| 164 | options.sigargs[1]) | ||
| 161 | else: | 165 | else: |
| 162 | files = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1]) | 166 | files = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1]) |
| 163 | 167 | ||
| @@ -166,7 +170,8 @@ if options.taskargs: | |||
| 166 | output = bb.siggen.dump_sigfile(files[-1]) | 170 | output = bb.siggen.dump_sigfile(files[-1]) |
| 167 | else: | 171 | else: |
| 168 | if len(files) < 2: | 172 | if len(files) < 2: |
| 169 | logger.error('Only one matching sigdata file found for the specified task (%s %s)' % (options.taskargs[0], options.taskargs[1])) | 173 | logger.error('Only one matching sigdata file found for the specified task (%s %s)' % ( |
| 174 | options.taskargs[0], options.taskargs[1])) | ||
| 170 | sys.exit(1) | 175 | sys.exit(1) |
| 171 | 176 | ||
| 172 | # Recurse into signature comparison | 177 | # Recurse into signature comparison |
