diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-11-02 15:06:50 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-11-04 12:50:55 +0000 |
commit | 0a4a6d6956a10aa0a6589de12b0b2380a9f0a7d9 (patch) | |
tree | 7d107fd24708c6004d4ebb04d39d362a7478690b /bitbake/lib/bb | |
parent | 157947efc7e505e01baafb33ec93fe2f485308fe (diff) | |
download | poky-0a4a6d6956a10aa0a6589de12b0b2380a9f0a7d9.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: 857829048c14338132784326ba98a71f12192db8)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/siggen.py | 13 |
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 | ||
70 | class SignatureGeneratorBasic(SignatureGenerator): | 70 | class 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] |