summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-04-07 16:57:20 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-11 18:10:17 +0100
commit9049c09793eddd7e314d4ae9cca73e1274dcf6f8 (patch)
tree5bbf83e244619220639838f87caae98c58898397 /meta/lib
parent6774995322cd6b092ca7f0e476077ca7aee0408e (diff)
downloadpoky-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>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/buildhistory_analysis.py49
-rw-r--r--meta/lib/oe/sstatesig.py6
2 files changed, 50 insertions, 5 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
413def process_changes(repopath, revision1, revision2='HEAD', report_all=False, report_ver=False): 413def 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
451def 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 = []