diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-04-07 16:57:20 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-04-11 18:10:17 +0100 |
commit | 9049c09793eddd7e314d4ae9cca73e1274dcf6f8 (patch) | |
tree | 5bbf83e244619220639838f87caae98c58898397 | |
parent | 6774995322cd6b092ca7f0e476077ca7aee0408e (diff) | |
download | poky-9049c09793eddd7e314d4ae9cca73e1274dcf6f8.tar.gz |
buildhistory-diff: add option to compare task signature list
Having added writing out of the task signature list to buildhistory
(when BUILDHISTORY_FEATURES includes "task"), we now need a way to
compare the list. This just shows which tasks have been added / changed
signature / removed.
(From OE-Core rev: 63bd7e9f780a98dda458d612877495756bcc5463)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oe/buildhistory_analysis.py | 49 | ||||
-rw-r--r-- | meta/lib/oe/sstatesig.py | 6 | ||||
-rwxr-xr-x | scripts/buildhistory-diff | 5 |
3 files changed, 54 insertions, 6 deletions
diff --git a/meta/lib/oe/buildhistory_analysis.py b/meta/lib/oe/buildhistory_analysis.py index 19b3bc437c..449446f33b 100644 --- a/meta/lib/oe/buildhistory_analysis.py +++ b/meta/lib/oe/buildhistory_analysis.py | |||
@@ -1,6 +1,6 @@ | |||
1 | # Report significant differences in the buildhistory repository since a specific revision | 1 | # Report significant differences in the buildhistory repository since a specific revision |
2 | # | 2 | # |
3 | # Copyright (C) 2012 Intel Corporation | 3 | # Copyright (C) 2012-2013, 2016-2017 Intel Corporation |
4 | # Author: Paul Eggleton <paul.eggleton@linux.intel.com> | 4 | # Author: Paul Eggleton <paul.eggleton@linux.intel.com> |
5 | # | 5 | # |
6 | # Note: requires GitPython 0.3.1+ | 6 | # Note: requires GitPython 0.3.1+ |
@@ -410,13 +410,58 @@ def compare_dict_blobs(path, ablob, bblob, report_all, report_ver): | |||
410 | return changes | 410 | return changes |
411 | 411 | ||
412 | 412 | ||
413 | def process_changes(repopath, revision1, revision2='HEAD', report_all=False, report_ver=False): | 413 | def compare_siglists(a_blob, b_blob): |
414 | # FIXME collapse down a recipe's tasks? | ||
415 | alines = a_blob.data_stream.read().decode('utf-8').splitlines() | ||
416 | blines = b_blob.data_stream.read().decode('utf-8').splitlines() | ||
417 | keys = [] | ||
418 | pnmap = {} | ||
419 | def readsigs(lines): | ||
420 | sigs = {} | ||
421 | for line in lines: | ||
422 | linesplit = line.split() | ||
423 | if len(linesplit) > 2: | ||
424 | sigs[linesplit[0]] = linesplit[2] | ||
425 | if not linesplit[0] in keys: | ||
426 | keys.append(linesplit[0]) | ||
427 | pnmap[linesplit[1]] = linesplit[0].rsplit('.', 1)[0] | ||
428 | return sigs | ||
429 | adict = readsigs(alines) | ||
430 | bdict = readsigs(blines) | ||
431 | out = [] | ||
432 | changecount = 0 | ||
433 | addcount = 0 | ||
434 | removecount = 0 | ||
435 | for key in keys: | ||
436 | siga = adict.get(key, None) | ||
437 | sigb = bdict.get(key, None) | ||
438 | if siga is not None and sigb is not None and siga != sigb: | ||
439 | out.append('%s changed from %s to %s' % (key, siga, sigb)) | ||
440 | changecount += 1 | ||
441 | elif siga is None: | ||
442 | out.append('%s was added' % key) | ||
443 | addcount += 1 | ||
444 | elif sigb is None: | ||
445 | removecount += 1 | ||
446 | out.append('%s was removed' % key) | ||
447 | out.append('Summary: %d tasks added, %d tasks removed, %d tasks modified (%.1f%%)' % (addcount, removecount, changecount, (changecount / float(len(bdict)) * 100))) | ||
448 | return '\n'.join(out) | ||
449 | |||
450 | |||
451 | def process_changes(repopath, revision1, revision2='HEAD', report_all=False, report_ver=False, sigs=False): | ||
414 | repo = git.Repo(repopath) | 452 | repo = git.Repo(repopath) |
415 | assert repo.bare == False | 453 | assert repo.bare == False |
416 | commit = repo.commit(revision1) | 454 | commit = repo.commit(revision1) |
417 | diff = commit.diff(revision2) | 455 | diff = commit.diff(revision2) |
418 | 456 | ||
419 | changes = [] | 457 | changes = [] |
458 | |||
459 | if sigs: | ||
460 | for d in diff.iter_change_type('M'): | ||
461 | if d.a_blob.path == 'siglist.txt': | ||
462 | changes.append(compare_siglists(d.a_blob, d.b_blob)) | ||
463 | return changes | ||
464 | |||
420 | for d in diff.iter_change_type('M'): | 465 | for d in diff.iter_change_type('M'): |
421 | path = os.path.dirname(d.a_blob.path) | 466 | path = os.path.dirname(d.a_blob.path) |
422 | if path.startswith('packages/'): | 467 | if path.startswith('packages/'): |
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py index 3239bc63ae..f087a019e1 100644 --- a/meta/lib/oe/sstatesig.py +++ b/meta/lib/oe/sstatesig.py | |||
@@ -217,9 +217,9 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash): | |||
217 | for taskitem in self.taskhash: | 217 | for taskitem in self.taskhash: |
218 | (fn, task) = taskitem.rsplit(".", 1) | 218 | (fn, task) = taskitem.rsplit(".", 1) |
219 | pn = self.lockedpnmap[fn] | 219 | pn = self.lockedpnmap[fn] |
220 | tasks.append((pn, task, self.taskhash[taskitem])) | 220 | tasks.append((pn, task, fn, self.taskhash[taskitem])) |
221 | for (pn, task, taskhash) in sorted(tasks): | 221 | for (pn, task, fn, taskhash) in sorted(tasks): |
222 | f.write('%s.%s %s\n' % (pn, task, taskhash)) | 222 | f.write('%s.%s %s %s\n' % (pn, task, fn, taskhash)) |
223 | 223 | ||
224 | def checkhashes(self, missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d): | 224 | def checkhashes(self, missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d): |
225 | warn_msgs = [] | 225 | warn_msgs = [] |
diff --git a/scripts/buildhistory-diff b/scripts/buildhistory-diff index e03ccc5ed8..e8e3e11649 100755 --- a/scripts/buildhistory-diff +++ b/scripts/buildhistory-diff | |||
@@ -33,6 +33,9 @@ def main(): | |||
33 | parser.add_option("-a", "--report-all", | 33 | parser.add_option("-a", "--report-all", |
34 | help = "Report all changes, not just the default significant ones", | 34 | help = "Report all changes, not just the default significant ones", |
35 | action="store_true", dest="report_all", default=False) | 35 | action="store_true", dest="report_all", default=False) |
36 | parser.add_option("-s", "--signatures", | ||
37 | help = "Report on signature differences instead of output", | ||
38 | action="store_true", dest="sigs", default=False) | ||
36 | 39 | ||
37 | options, args = parser.parse_args(sys.argv) | 40 | options, args = parser.parse_args(sys.argv) |
38 | 41 | ||
@@ -86,7 +89,7 @@ def main(): | |||
86 | 89 | ||
87 | import gitdb | 90 | import gitdb |
88 | try: | 91 | try: |
89 | changes = oe.buildhistory_analysis.process_changes(options.buildhistory_dir, fromrev, torev, options.report_all, options.report_ver) | 92 | changes = oe.buildhistory_analysis.process_changes(options.buildhistory_dir, fromrev, torev, options.report_all, options.report_ver, options.sigs) |
90 | except gitdb.exc.BadObject as e: | 93 | except gitdb.exc.BadObject as e: |
91 | if len(args) == 1: | 94 | if len(args) == 1: |
92 | sys.stderr.write("Unable to find previous build revision in buildhistory repository\n\n") | 95 | sys.stderr.write("Unable to find previous build revision in buildhistory repository\n\n") |