summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-04-07 09:52:09 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-10 23:00:32 +0100
commit5d8b89fc0b9a703243dcd4cce483c335effee78d (patch)
tree09d1a4446d2808cbfc8fb09a1197e3d0e0ec138c /bitbake
parentf79a969c3ae6449bf3a19ff3a55f4b3dbd81c6c2 (diff)
downloadpoky-5d8b89fc0b9a703243dcd4cce483c335effee78d.tar.gz
bitbake: lib/bb/siggen: add collapsed mode to compare_sigfiles()
If we just want to drill down to the actual differences then we don't need to see certain things in the output, e.g. basehash changing or the signature of dependent tasks. This will be used for comparing signatures within buildhistory-diff in OE-Core; the default mode as used by bitbake-diffsigs and bitbake -S printdiff remains unchanged for the moment. (Bitbake rev: 6543a59b1ebd3194a7c6421cffc66ebe31a67c62) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/siggen.py51
1 files changed, 28 insertions, 23 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index c6b14c2942..3c5d86247c 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -375,7 +375,7 @@ def clean_basepaths_list(a):
375 b.append(clean_basepath(x)) 375 b.append(clean_basepath(x))
376 return b 376 return b
377 377
378def compare_sigfiles(a, b, recursecb = None): 378def compare_sigfiles(a, b, recursecb=None, collapsed=False):
379 output = [] 379 output = []
380 380
381 with open(a, 'rb') as f: 381 with open(a, 'rb') as f:
@@ -443,7 +443,7 @@ def compare_sigfiles(a, b, recursecb = None):
443 if a_data['taskdeps'] != b_data['taskdeps']: 443 if a_data['taskdeps'] != b_data['taskdeps']:
444 output.append("Task dependencies changed from:\n%s\nto:\n%s" % (sorted(a_data['taskdeps']), sorted(b_data['taskdeps']))) 444 output.append("Task dependencies changed from:\n%s\nto:\n%s" % (sorted(a_data['taskdeps']), sorted(b_data['taskdeps'])))
445 445
446 if a_data['basehash'] != b_data['basehash']: 446 if a_data['basehash'] != b_data['basehash'] and not collapsed:
447 output.append("basehash changed from %s to %s" % (a_data['basehash'], b_data['basehash'])) 447 output.append("basehash changed from %s to %s" % (a_data['basehash'], b_data['basehash']))
448 448
449 changed, added, removed = dict_diff(a_data['gendeps'], b_data['gendeps'], a_data['basewhitelist'] & b_data['basewhitelist']) 449 changed, added, removed = dict_diff(a_data['gendeps'], b_data['gendeps'], a_data['basewhitelist'] & b_data['basewhitelist'])
@@ -495,24 +495,25 @@ def compare_sigfiles(a, b, recursecb = None):
495 if not 'runtaskdeps' in b_data: 495 if not 'runtaskdeps' in b_data:
496 b_data['runtaskdeps'] = {} 496 b_data['runtaskdeps'] = {}
497 497
498 if len(a_data['runtaskdeps']) != len(b_data['runtaskdeps']): 498 if not collapsed:
499 changed = ["Number of task dependencies changed"] 499 if len(a_data['runtaskdeps']) != len(b_data['runtaskdeps']):
500 else: 500 changed = ["Number of task dependencies changed"]
501 changed = []
502 for idx, task in enumerate(a_data['runtaskdeps']):
503 a = a_data['runtaskdeps'][idx]
504 b = b_data['runtaskdeps'][idx]
505 if a_data['runtaskhashes'][a] != b_data['runtaskhashes'][b]:
506 changed.append("%s with hash %s\n changed to\n%s with hash %s" % (a, a_data['runtaskhashes'][a], b, b_data['runtaskhashes'][b]))
507
508 if changed:
509 clean_a = clean_basepaths_list(a_data['runtaskdeps'])
510 clean_b = clean_basepaths_list(b_data['runtaskdeps'])
511 if clean_a != clean_b:
512 output.append("runtaskdeps changed from %s to %s" % (clean_a, clean_b))
513 else: 501 else:
514 output.append("runtaskdeps changed:") 502 changed = []
515 output.append("\n".join(changed)) 503 for idx, task in enumerate(a_data['runtaskdeps']):
504 a = a_data['runtaskdeps'][idx]
505 b = b_data['runtaskdeps'][idx]
506 if a_data['runtaskhashes'][a] != b_data['runtaskhashes'][b]:
507 changed.append("%s with hash %s\n changed to\n%s with hash %s" % (a, a_data['runtaskhashes'][a], b, b_data['runtaskhashes'][b]))
508
509 if changed:
510 clean_a = clean_basepaths_list(a_data['runtaskdeps'])
511 clean_b = clean_basepaths_list(b_data['runtaskdeps'])
512 if clean_a != clean_b:
513 output.append("runtaskdeps changed from %s to %s" % (clean_a, clean_b))
514 else:
515 output.append("runtaskdeps changed:")
516 output.append("\n".join(changed))
516 517
517 if 'runtaskhashes' in a_data and 'runtaskhashes' in b_data: 518 if 'runtaskhashes' in a_data and 'runtaskhashes' in b_data:
518 a = a_data['runtaskhashes'] 519 a = a_data['runtaskhashes']
@@ -540,13 +541,17 @@ def compare_sigfiles(a, b, recursecb = None):
540 output.append("Dependency on task %s was removed with hash %s" % (clean_basepath(dep), a[dep])) 541 output.append("Dependency on task %s was removed with hash %s" % (clean_basepath(dep), a[dep]))
541 if changed: 542 if changed:
542 for dep in changed: 543 for dep in changed:
543 output.append("Hash for dependent task %s changed from %s to %s" % (clean_basepath(dep), a[dep], b[dep])) 544 if not collapsed:
545 output.append("Hash for dependent task %s changed from %s to %s" % (clean_basepath(dep), a[dep], b[dep]))
544 if callable(recursecb): 546 if callable(recursecb):
545 # If a dependent hash changed, might as well print the line above and then defer to the changes in
546 # that hash since in all likelyhood, they're the same changes this task also saw.
547 recout = recursecb(dep, a[dep], b[dep]) 547 recout = recursecb(dep, a[dep], b[dep])
548 if recout: 548 if recout:
549 output = [output[-1]] + recout 549 if collapsed:
550 output.extend(recout)
551 else:
552 # If a dependent hash changed, might as well print the line above and then defer to the changes in
553 # that hash since in all likelyhood, they're the same changes this task also saw.
554 output = [output[-1]] + recout
550 555
551 a_taint = a_data.get('taint', None) 556 a_taint = a_data.get('taint', None)
552 b_taint = b_data.get('taint', None) 557 b_taint = b_data.get('taint', None)