summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-02 15:06:50 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-16 10:37:58 +0000
commitf17446b645f3f12f804c3920fcb8458698463ab4 (patch)
tree66b916c74ceacb0e56e02d500a243a7432bb52e6 /bitbake
parentaea27a0554961f7be352473a264659458f48c699 (diff)
downloadpoky-f17446b645f3f12f804c3920fcb8458698463ab4.tar.gz
bitbake: siggen: Pass basehash to worker processes and sanity check reparsing result
Bitbake can parse metadata in the cooker and in the worker during builds. If the metadata isn't deterministic, it can change between these two parses and this confuses things a lot. It turns out to be hard to debug these issues currently. This patch ensures the basehashes from the original parsing are passed into the workers and that these are checked when reparsing for consistency. The user is shown an error message if inconsistencies are found. There is debug code in siggen.py (see the "Slow but can be useful for debugging mismatched basehashes" commented code), we don't enable this by default due to performance issues. If you run into this message, enable this code and you will find "sigbasedata" files in tmp/stamps which should correspond to the hashes shown in this error message. bitbake-diffsigs on the files should show which variables are changing. (Bitbake rev: 46207262ee6cdd2e49c4765481a6a24702ca4843) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/siggen.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index 3a7dac4cb7..9485bf5d8a 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -30,6 +30,7 @@ class SignatureGenerator(object):
30 name = "noop" 30 name = "noop"
31 31
32 def __init__(self, data): 32 def __init__(self, data):
33 self.basehash = {}
33 self.taskhash = {} 34 self.taskhash = {}
34 self.runtaskdeps = {} 35 self.runtaskdeps = {}
35 self.file_checksum_values = {} 36 self.file_checksum_values = {}
@@ -61,11 +62,10 @@ class SignatureGenerator(object):
61 return 62 return
62 63
63 def get_taskdata(self): 64 def get_taskdata(self):
64 return (self.runtaskdeps, self.taskhash, self.file_checksum_values, self.taints) 65 return (self.runtaskdeps, self.taskhash, self.file_checksum_values, self.taints, self.basehash)
65 66
66 def set_taskdata(self, data): 67 def set_taskdata(self, data):
67 self.runtaskdeps, self.taskhash, self.file_checksum_values, self.taints = data 68 self.runtaskdeps, self.taskhash, self.file_checksum_values, self.taints, self.basehash = data
68
69 69
70class SignatureGeneratorBasic(SignatureGenerator): 70class SignatureGeneratorBasic(SignatureGenerator):
71 """ 71 """
@@ -133,7 +133,11 @@ class SignatureGeneratorBasic(SignatureGenerator):
133 var = lookupcache[dep] 133 var = lookupcache[dep]
134 if var is not None: 134 if var is not None:
135 data = data + str(var) 135 data = data + str(var)
136 self.basehash[fn + "." + task] = hashlib.md5(data.encode("utf-8")).hexdigest() 136 datahash = hashlib.md5(data.encode("utf-8")).hexdigest()
137 k = fn + "." + task
138 if k in self.basehash and self.basehash[k] != datahash:
139 bb.error("When reparsing %s, the basehash value changed from %s to %s. The metadata is not deterministic and this needs to be fixed." % (k, self.basehash[k], datahash))
140 self.basehash[k] = datahash
137 taskdeps[task] = alldeps 141 taskdeps[task] = alldeps
138 142
139 self.taskdeps[fn] = taskdeps 143 self.taskdeps[fn] = taskdeps
@@ -182,6 +186,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
182 def get_taskhash(self, fn, task, deps, dataCache): 186 def get_taskhash(self, fn, task, deps, dataCache):
183 k = fn + "." + task 187 k = fn + "." + task
184 data = dataCache.basetaskhash[k] 188 data = dataCache.basetaskhash[k]
189 self.basehash[k] = data
185 self.runtaskdeps[k] = [] 190 self.runtaskdeps[k] = []
186 self.file_checksum_values[k] = [] 191 self.file_checksum_values[k] = []
187 recipename = dataCache.pkg_fn[fn] 192 recipename = dataCache.pkg_fn[fn]