summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/siggen.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-10-08 15:34:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-14 16:59:12 +0100
commite9662e892653dcb8176a5308da1a5a829fc3f339 (patch)
treef4ffe7a742b96d3837a5544d6e0df2792e71483c /bitbake/lib/bb/siggen.py
parentce0a6f81aeff83189eef64e7521ca12ccd20f00b (diff)
downloadpoky-e9662e892653dcb8176a5308da1a5a829fc3f339.tar.gz
bitbake: siggen: handle recipe path changes in siginfo files
Avoid storing paths to files in SRC_URI when writing out the the file checksums to siginfo files. This prevents a move of the source directory being reported by bitbake-diffsigs as files being removed and then added (the signature itself is not affected since the file paths have never been included in the signature). This has required the format of the file checksums in the siginfo file to be changed from a dict to a list of tuples (in order to handle multiple files with the same name under different paths, which is uncommon but possible); the code remains backwards-compatible with older siginfo files that use a dict however. Fixes [YOCTO #5245]. (Bitbake rev: e4d3077c5b0cc57964640512f3646c2d73c1d855) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/siggen.py')
-rw-r--r--bitbake/lib/bb/siggen.py41
1 files changed, 37 insertions, 4 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index c15ba28ead..52e698c469 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -224,7 +224,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
224 224
225 if runtime and k in self.taskhash: 225 if runtime and k in self.taskhash:
226 data['runtaskdeps'] = self.runtaskdeps[k] 226 data['runtaskdeps'] = self.runtaskdeps[k]
227 data['file_checksum_values'] = self.file_checksum_values[k] 227 data['file_checksum_values'] = [(os.path.basename(f), cs) for f,cs in self.file_checksum_values[k].items()]
228 data['runtaskhashes'] = {} 228 data['runtaskhashes'] = {}
229 for dep in data['runtaskdeps']: 229 for dep in data['runtaskdeps']:
230 data['runtaskhashes'][dep] = self.taskhash[dep] 230 data['runtaskhashes'][dep] = self.taskhash[dep]
@@ -322,6 +322,39 @@ def compare_sigfiles(a, b, recursecb = None):
322 removed = sb - sa 322 removed = sb - sa
323 return changed, added, removed 323 return changed, added, removed
324 324
325 def file_checksums_diff(a, b):
326 from collections import Counter
327 # Handle old siginfo format
328 if isinstance(a, dict):
329 a = [(os.path.basename(f), cs) for f, cs in a.items()]
330 if isinstance(b, dict):
331 b = [(os.path.basename(f), cs) for f, cs in b.items()]
332 # Compare lists, ensuring we can handle duplicate filenames if they exist
333 removedcount = Counter(a)
334 removedcount.subtract(b)
335 addedcount = Counter(b)
336 addedcount.subtract(a)
337 added = []
338 for x in b:
339 if addedcount[x] > 0:
340 addedcount[x] -= 1
341 added.append(x)
342 removed = []
343 changed = []
344 for x in a:
345 if removedcount[x] > 0:
346 removedcount[x] -= 1
347 for y in added:
348 if y[0] == x[0]:
349 changed.append((x[0], x[1], y[1]))
350 added.remove(y)
351 break
352 else:
353 removed.append(x)
354 added = [x[0] for x in added]
355 removed = [x[0] for x in removed]
356 return changed, added, removed
357
325 if 'basewhitelist' in a_data and a_data['basewhitelist'] != b_data['basewhitelist']: 358 if 'basewhitelist' in a_data and a_data['basewhitelist'] != b_data['basewhitelist']:
326 output.append("basewhitelist changed from '%s' to '%s'" % (a_data['basewhitelist'], b_data['basewhitelist'])) 359 output.append("basewhitelist changed from '%s' to '%s'" % (a_data['basewhitelist'], b_data['basewhitelist']))
327 if a_data['basewhitelist'] and b_data['basewhitelist']: 360 if a_data['basewhitelist'] and b_data['basewhitelist']:
@@ -357,10 +390,10 @@ def compare_sigfiles(a, b, recursecb = None):
357 for dep in changed: 390 for dep in changed:
358 output.append("Variable %s value changed from '%s' to '%s'" % (dep, a_data['varvals'][dep], b_data['varvals'][dep])) 391 output.append("Variable %s value changed from '%s' to '%s'" % (dep, a_data['varvals'][dep], b_data['varvals'][dep]))
359 392
360 changed, added, removed = dict_diff(a_data['file_checksum_values'], b_data['file_checksum_values']) 393 changed, added, removed = file_checksums_diff(a_data['file_checksum_values'], b_data['file_checksum_values'])
361 if changed: 394 if changed:
362 for f in changed: 395 for f, old, new in changed:
363 output.append("Checksum for file %s changed from %s to %s" % (f, a_data['file_checksum_values'][f], b_data['file_checksum_values'][f])) 396 output.append("Checksum for file %s changed from %s to %s" % (f, old, new))
364 if added: 397 if added:
365 for f in added: 398 for f in added:
366 output.append("Dependency on checksum of file %s was added" % (f)) 399 output.append("Dependency on checksum of file %s was added" % (f))