diff options
Diffstat (limited to 'bitbake/lib/bb/siggen.py')
-rw-r--r-- | bitbake/lib/bb/siggen.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py index 3c5d86247c..d40c721fbf 100644 --- a/bitbake/lib/bb/siggen.py +++ b/bitbake/lib/bb/siggen.py | |||
@@ -6,6 +6,7 @@ import tempfile | |||
6 | import pickle | 6 | import pickle |
7 | import bb.data | 7 | import bb.data |
8 | import difflib | 8 | import difflib |
9 | import simplediff | ||
9 | from bb.checksum import FileChecksumCache | 10 | from bb.checksum import FileChecksumCache |
10 | 11 | ||
11 | logger = logging.getLogger('BitBake.SigGen') | 12 | logger = logging.getLogger('BitBake.SigGen') |
@@ -352,6 +353,39 @@ def dump_this_task(outfile, d): | |||
352 | referencestamp = bb.build.stamp_internal(task, d, None, True) | 353 | referencestamp = bb.build.stamp_internal(task, d, None, True) |
353 | bb.parse.siggen.dump_sigtask(fn, task, outfile, "customfile:" + referencestamp) | 354 | bb.parse.siggen.dump_sigtask(fn, task, outfile, "customfile:" + referencestamp) |
354 | 355 | ||
356 | def worddiff_str(oldstr, newstr): | ||
357 | diff = simplediff.diff(oldstr.split(' '), newstr.split(' ')) | ||
358 | ret = [] | ||
359 | for change, value in diff: | ||
360 | value = ' '.join(value) | ||
361 | if change == '=': | ||
362 | ret.append(value) | ||
363 | elif change == '+': | ||
364 | item = '{+%s+}' % value | ||
365 | ret.append(item) | ||
366 | elif change == '-': | ||
367 | item = '[-%s-]' % value | ||
368 | ret.append(item) | ||
369 | whitespace_note = '' | ||
370 | if oldstr != newstr and ' '.join(oldstr.split()) == ' '.join(newstr.split()): | ||
371 | whitespace_note = ' (whitespace changed)' | ||
372 | return '"%s"%s' % (' '.join(ret), whitespace_note) | ||
373 | |||
374 | def list_inline_diff(oldlist, newlist): | ||
375 | diff = simplediff.diff(oldlist, newlist) | ||
376 | ret = [] | ||
377 | for change, value in diff: | ||
378 | value = ' '.join(value) | ||
379 | if change == '=': | ||
380 | ret.append("'%s'" % value) | ||
381 | elif change == '+': | ||
382 | item = "+'%s'" % value | ||
383 | ret.append(item) | ||
384 | elif change == '-': | ||
385 | item = "-'%s'" % value | ||
386 | ret.append(item) | ||
387 | return '[%s]' % (', '.join(ret)) | ||
388 | |||
355 | def clean_basepath(a): | 389 | def clean_basepath(a): |
356 | mc = None | 390 | mc = None |
357 | if a.startswith("multiconfig:"): | 391 | if a.startswith("multiconfig:"): |
@@ -471,6 +505,8 @@ def compare_sigfiles(a, b, recursecb=None, collapsed=False): | |||
471 | # the old/new filename (they are blank anyway in this case) | 505 | # the old/new filename (they are blank anyway in this case) |
472 | difflines = list(diff)[2:] | 506 | difflines = list(diff)[2:] |
473 | output.append("Variable %s value changed:\n%s" % (dep, '\n'.join(difflines))) | 507 | output.append("Variable %s value changed:\n%s" % (dep, '\n'.join(difflines))) |
508 | elif newval and oldval and (' ' in oldval or ' ' in newval): | ||
509 | output.append("Variable %s value changed:\n%s" % (dep, worddiff_str(oldval, newval))) | ||
474 | else: | 510 | else: |
475 | output.append("Variable %s value changed from '%s' to '%s'" % (dep, oldval, newval)) | 511 | output.append("Variable %s value changed from '%s' to '%s'" % (dep, oldval, newval)) |
476 | 512 | ||
@@ -510,7 +546,7 @@ def compare_sigfiles(a, b, recursecb=None, collapsed=False): | |||
510 | clean_a = clean_basepaths_list(a_data['runtaskdeps']) | 546 | clean_a = clean_basepaths_list(a_data['runtaskdeps']) |
511 | clean_b = clean_basepaths_list(b_data['runtaskdeps']) | 547 | clean_b = clean_basepaths_list(b_data['runtaskdeps']) |
512 | if clean_a != clean_b: | 548 | if clean_a != clean_b: |
513 | output.append("runtaskdeps changed from %s to %s" % (clean_a, clean_b)) | 549 | output.append("runtaskdeps changed:\n%s" % list_inline_diff(clean_a, clean_b)) |
514 | else: | 550 | else: |
515 | output.append("runtaskdeps changed:") | 551 | output.append("runtaskdeps changed:") |
516 | output.append("\n".join(changed)) | 552 | output.append("\n".join(changed)) |