summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/siggen.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-08-27 21:44:34 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-07 12:10:44 +0100
commitd5226c96d3c64bcfa8922327594663352703a8a8 (patch)
treecdf675fea864f33cc939be42753ca9e3d71e4c6e /bitbake/lib/bb/siggen.py
parent19d0abe14cd6590dc7a9d81f88c18833e1b35a1b (diff)
downloadpoky-d5226c96d3c64bcfa8922327594663352703a8a8.tar.gz
bitbake: lib/bb/siggen.py: make signature dump/compare functions return a list
These functions become a little bit more reusable if they return a list containing the output rather than just printing it. (Bitbake rev: a0ad2a947b71abcc0a1244cf139b9e9dfd8ee049) 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.py68
1 files changed, 38 insertions, 30 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index d0a4d18e0e..8d1501b8ae 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -302,6 +302,8 @@ def clean_basepaths(a):
302 return b 302 return b
303 303
304def compare_sigfiles(a, b): 304def compare_sigfiles(a, b):
305 output = []
306
305 p1 = pickle.Unpickler(open(a, "rb")) 307 p1 = pickle.Unpickler(open(a, "rb"))
306 a_data = p1.load() 308 a_data = p1.load()
307 p2 = pickle.Unpickler(open(b, "rb")) 309 p2 = pickle.Unpickler(open(b, "rb"))
@@ -320,50 +322,50 @@ def compare_sigfiles(a, b):
320 return changed, added, removed 322 return changed, added, removed
321 323
322 if 'basewhitelist' in a_data and a_data['basewhitelist'] != b_data['basewhitelist']: 324 if 'basewhitelist' in a_data and a_data['basewhitelist'] != b_data['basewhitelist']:
323 print "basewhitelist changed from %s to %s" % (a_data['basewhitelist'], b_data['basewhitelist']) 325 output.append("basewhitelist changed from %s to %s" % (a_data['basewhitelist'], b_data['basewhitelist']))
324 if a_data['basewhitelist'] and b_data['basewhitelist']: 326 if a_data['basewhitelist'] and b_data['basewhitelist']:
325 print "changed items: %s" % a_data['basewhitelist'].symmetric_difference(b_data['basewhitelist']) 327 output.append("changed items: %s" % a_data['basewhitelist'].symmetric_difference(b_data['basewhitelist']))
326 328
327 if 'taskwhitelist' in a_data and a_data['taskwhitelist'] != b_data['taskwhitelist']: 329 if 'taskwhitelist' in a_data and a_data['taskwhitelist'] != b_data['taskwhitelist']:
328 print "taskwhitelist changed from %s to %s" % (a_data['taskwhitelist'], b_data['taskwhitelist']) 330 output.append("taskwhitelist changed from %s to %s" % (a_data['taskwhitelist'], b_data['taskwhitelist']))
329 if a_data['taskwhitelist'] and b_data['taskwhitelist']: 331 if a_data['taskwhitelist'] and b_data['taskwhitelist']:
330 print "changed items: %s" % a_data['taskwhitelist'].symmetric_difference(b_data['taskwhitelist']) 332 output.append("changed items: %s" % a_data['taskwhitelist'].symmetric_difference(b_data['taskwhitelist']))
331 333
332 if a_data['taskdeps'] != b_data['taskdeps']: 334 if a_data['taskdeps'] != b_data['taskdeps']:
333 print "Task dependencies changed from:\n%s\nto:\n%s" % (sorted(a_data['taskdeps']), sorted(b_data['taskdeps'])) 335 output.append("Task dependencies changed from:\n%s\nto:\n%s" % (sorted(a_data['taskdeps']), sorted(b_data['taskdeps'])))
334 336
335 if a_data['basehash'] != b_data['basehash']: 337 if a_data['basehash'] != b_data['basehash']:
336 print "basehash changed from %s to %s" % (a_data['basehash'], b_data['basehash']) 338 output.append("basehash changed from %s to %s" % (a_data['basehash'], b_data['basehash']))
337 339
338 changed, added, removed = dict_diff(a_data['gendeps'], b_data['gendeps'], a_data['basewhitelist'] & b_data['basewhitelist']) 340 changed, added, removed = dict_diff(a_data['gendeps'], b_data['gendeps'], a_data['basewhitelist'] & b_data['basewhitelist'])
339 if changed: 341 if changed:
340 for dep in changed: 342 for dep in changed:
341 print "List of dependencies for variable %s changed from %s to %s" % (dep, a_data['gendeps'][dep], b_data['gendeps'][dep]) 343 output.append("List of dependencies for variable %s changed from %s to %s" % (dep, a_data['gendeps'][dep], b_data['gendeps'][dep]))
342 if a_data['gendeps'][dep] and b_data['gendeps'][dep]: 344 if a_data['gendeps'][dep] and b_data['gendeps'][dep]:
343 print "changed items: %s" % a_data['gendeps'][dep].symmetric_difference(b_data['gendeps'][dep]) 345 output.append("changed items: %s" % a_data['gendeps'][dep].symmetric_difference(b_data['gendeps'][dep]))
344 if added: 346 if added:
345 for dep in added: 347 for dep in added:
346 print "Dependency on variable %s was added" % (dep) 348 output.append("Dependency on variable %s was added" % (dep))
347 if removed: 349 if removed:
348 for dep in removed: 350 for dep in removed:
349 print "Dependency on Variable %s was removed" % (dep) 351 output.append("Dependency on Variable %s was removed" % (dep))
350 352
351 353
352 changed, added, removed = dict_diff(a_data['varvals'], b_data['varvals']) 354 changed, added, removed = dict_diff(a_data['varvals'], b_data['varvals'])
353 if changed: 355 if changed:
354 for dep in changed: 356 for dep in changed:
355 print "Variable %s value changed from %s to %s" % (dep, a_data['varvals'][dep], b_data['varvals'][dep]) 357 output.append("Variable %s value changed from %s to %s" % (dep, a_data['varvals'][dep], b_data['varvals'][dep]))
356 358
357 changed, added, removed = dict_diff(a_data['file_checksum_values'], b_data['file_checksum_values']) 359 changed, added, removed = dict_diff(a_data['file_checksum_values'], b_data['file_checksum_values'])
358 if changed: 360 if changed:
359 for f in changed: 361 for f in changed:
360 print "Checksum for file %s changed from %s to %s" % (f, a_data['file_checksum_values'][f], b_data['file_checksum_values'][f]) 362 output.append("Checksum for file %s changed from %s to %s" % (f, a_data['file_checksum_values'][f], b_data['file_checksum_values'][f]))
361 if added: 363 if added:
362 for f in added: 364 for f in added:
363 print "Dependency on checksum of file %s was added" % (f) 365 output.append("Dependency on checksum of file %s was added" % (f))
364 if removed: 366 if removed:
365 for f in removed: 367 for f in removed:
366 print "Dependency on checksum of file %s was removed" % (f) 368 output.append("Dependency on checksum of file %s was removed" % (f))
367 369
368 370
369 if 'runtaskhashes' in a_data and 'runtaskhashes' in b_data: 371 if 'runtaskhashes' in a_data and 'runtaskhashes' in b_data:
@@ -376,58 +378,64 @@ def compare_sigfiles(a, b):
376 if removed: 378 if removed:
377 for bdep in removed: 379 for bdep in removed:
378 if a[dep] == b[bdep]: 380 if a[dep] == b[bdep]:
379 #print "Dependency on task %s was replaced by %s with same hash" % (dep, bdep) 381 #output.append("Dependency on task %s was replaced by %s with same hash" % (dep, bdep))
380 bdep_found = True 382 bdep_found = True
381 if not bdep_found: 383 if not bdep_found:
382 print "Dependency on task %s was added with hash %s" % (dep, a[dep]) 384 output.append("Dependency on task %s was added with hash %s" % (dep, a[dep]))
383 if removed: 385 if removed:
384 for dep in removed: 386 for dep in removed:
385 adep_found = False 387 adep_found = False
386 if added: 388 if added:
387 for adep in added: 389 for adep in added:
388 if a[adep] == b[dep]: 390 if a[adep] == b[dep]:
389 #print "Dependency on task %s was replaced by %s with same hash" % (adep, dep) 391 #output.append("Dependency on task %s was replaced by %s with same hash" % (adep, dep))
390 adep_found = True 392 adep_found = True
391 if not adep_found: 393 if not adep_found:
392 print "Dependency on task %s was removed with hash %s" % (dep, b[dep]) 394 output.append("Dependency on task %s was removed with hash %s" % (dep, b[dep]))
393 if changed: 395 if changed:
394 for dep in changed: 396 for dep in changed:
395 print "Hash for dependent task %s changed from %s to %s" % (dep, a[dep], b[dep]) 397 output.append("Hash for dependent task %s changed from %s to %s" % (dep, a[dep], b[dep]))
396 398
397 399
398 a_taint = a_data.get('taint', None) 400 a_taint = a_data.get('taint', None)
399 b_taint = b_data.get('taint', None) 401 b_taint = b_data.get('taint', None)
400 if a_taint != b_taint: 402 if a_taint != b_taint:
401 print "Taint (by forced/invalidated task) changed from %s to %s" % (a_taint, b_taint) 403 output.append("Taint (by forced/invalidated task) changed from %s to %s" % (a_taint, b_taint))
404
405 return output
402 406
403 407
404def dump_sigfile(a): 408def dump_sigfile(a):
409 output = []
410
405 p1 = pickle.Unpickler(open(a, "rb")) 411 p1 = pickle.Unpickler(open(a, "rb"))
406 a_data = p1.load() 412 a_data = p1.load()
407 413
408 print "basewhitelist: %s" % (a_data['basewhitelist']) 414 output.append("basewhitelist: %s" % (a_data['basewhitelist']))
409 415
410 print "taskwhitelist: %s" % (a_data['taskwhitelist']) 416 output.append("taskwhitelist: %s" % (a_data['taskwhitelist']))
411 417
412 print "Task dependencies: %s" % (sorted(a_data['taskdeps'])) 418 output.append("Task dependencies: %s" % (sorted(a_data['taskdeps'])))
413 419
414 print "basehash: %s" % (a_data['basehash']) 420 output.append("basehash: %s" % (a_data['basehash']))
415 421
416 for dep in a_data['gendeps']: 422 for dep in a_data['gendeps']:
417 print "List of dependencies for variable %s is %s" % (dep, a_data['gendeps'][dep]) 423 output.append("List of dependencies for variable %s is %s" % (dep, a_data['gendeps'][dep]))
418 424
419 for dep in a_data['varvals']: 425 for dep in a_data['varvals']:
420 print "Variable %s value is %s" % (dep, a_data['varvals'][dep]) 426 output.append("Variable %s value is %s" % (dep, a_data['varvals'][dep]))
421 427
422 if 'runtaskdeps' in a_data: 428 if 'runtaskdeps' in a_data:
423 print "Tasks this task depends on: %s" % (a_data['runtaskdeps']) 429 output.append("Tasks this task depends on: %s" % (a_data['runtaskdeps']))
424 430
425 if 'file_checksum_values' in a_data: 431 if 'file_checksum_values' in a_data:
426 print "This task depends on the checksums of files: %s" % (a_data['file_checksum_values']) 432 output.append("This task depends on the checksums of files: %s" % (a_data['file_checksum_values']))
427 433
428 if 'runtaskhashes' in a_data: 434 if 'runtaskhashes' in a_data:
429 for dep in a_data['runtaskhashes']: 435 for dep in a_data['runtaskhashes']:
430 print "Hash for dependent task %s is %s" % (dep, a_data['runtaskhashes'][dep]) 436 output.append("Hash for dependent task %s is %s" % (dep, a_data['runtaskhashes'][dep]))
431 437
432 if 'taint' in a_data: 438 if 'taint' in a_data:
433 print "Tainted (by forced/invalidated task): %s" % a_data['taint'] 439 output.append("Tainted (by forced/invalidated task): %s" % a_data['taint'])
440
441 return output