summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/data.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-17 14:40:38 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-18 10:59:27 +0100
commit7e9212712817a7c10b9aae7a26de3de3a4f18611 (patch)
tree3751a50e1dde2576bd4b9ec3c6fb1f2da50d548e /bitbake/lib/bb/data.py
parentf7f5e30667e1ad8e1ca76ee331be2843f2976bfa (diff)
downloadpoky-7e9212712817a7c10b9aae7a26de3de3a4f18611.tar.gz
bitbake: data/siggen: Extract task hash generation code into a function
By creating a standalone function, we can add better functional testing of this code. (Bitbake rev: 796a20d24dc18479de1975a37b9e52a5ac75c73f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/data.py')
-rw-r--r--bitbake/lib/bb/data.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index fde4cba6bb..d66d98cc8b 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -38,6 +38,7 @@ the speed is more critical here.
38# Based on functions from the base bb module, Copyright 2003 Holger Schurig 38# Based on functions from the base bb module, Copyright 2003 Holger Schurig
39 39
40import sys, os, re 40import sys, os, re
41import hashlib
41if sys.argv[0][-5:] == "pydoc": 42if sys.argv[0][-5:] == "pydoc":
42 path = os.path.dirname(os.path.dirname(sys.argv[1])) 43 path = os.path.dirname(os.path.dirname(sys.argv[1]))
43else: 44else:
@@ -405,6 +406,43 @@ def generate_dependencies(d):
405 #print "For %s: %s" % (task, str(deps[task])) 406 #print "For %s: %s" % (task, str(deps[task]))
406 return tasklist, deps, values 407 return tasklist, deps, values
407 408
409def generate_dependency_hash(tasklist, gendeps, lookupcache, whitelist, fn):
410 taskdeps = {}
411 basehash = {}
412
413 for task in tasklist:
414 data = lookupcache[task]
415
416 if data is None:
417 bb.error("Task %s from %s seems to be empty?!" % (task, fn))
418 data = ''
419
420 gendeps[task] -= whitelist
421 newdeps = gendeps[task]
422 seen = set()
423 while newdeps:
424 nextdeps = newdeps
425 seen |= nextdeps
426 newdeps = set()
427 for dep in nextdeps:
428 if dep in whitelist:
429 continue
430 gendeps[dep] -= whitelist
431 newdeps |= gendeps[dep]
432 newdeps -= seen
433
434 alldeps = sorted(seen)
435 for dep in alldeps:
436 data = data + dep
437 var = lookupcache[dep]
438 if var is not None:
439 data = data + str(var)
440 k = fn + "." + task
441 basehash[k] = hashlib.md5(data.encode("utf-8")).hexdigest()
442 taskdeps[task] = alldeps
443
444 return taskdeps, basehash
445
408def inherits_class(klass, d): 446def inherits_class(klass, d):
409 val = d.getVar('__inherit_cache', False) or [] 447 val = d.getVar('__inherit_cache', False) or []
410 needle = os.path.join('classes', '%s.bbclass' % klass) 448 needle = os.path.join('classes', '%s.bbclass' % klass)