diff options
Diffstat (limited to 'meta/lib/oe/buildhistory_analysis.py')
-rw-r--r-- | meta/lib/oe/buildhistory_analysis.py | 49 |
1 files changed, 47 insertions, 2 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/'): |