summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-02 15:07:33 +0000
committerSona Sarmadi <sona.sarmadi@enea.com>2017-02-10 12:21:35 +0100
commit6c398cb3aad33f5ec56234c137dc268a327b5291 (patch)
treee61e6f979ecdf387b3e916725266360bdcddf8db
parent79a3cf30ee62bee1a96f2310b7c75a811f252ec1 (diff)
downloadpoky-6c398cb3aad33f5ec56234c137dc268a327b5291.tar.gz
bitbake: siggen: Ensure taskhash mismatches don't override existing data
We recalculate the taskhash to ensure the version we have matches what we think it should be. When we write out a sigdata file, use the calculated value so that we don't overwrite any existing file. This leaves any original taskhash sigdata file intact to allow a debugging comparison. (Bitbake rev: dac68af6f4add9c99cb7adcf23b2ae89b96ca075) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Minor fixup Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
-rw-r--r--bitbake/lib/bb/siggen.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index 7d72f0c3ba..6a903b2fa5 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -287,6 +287,15 @@ class SignatureGeneratorBasic(SignatureGenerator):
287 if 'nostamp:' in self.taints[k]: 287 if 'nostamp:' in self.taints[k]:
288 data['taint'] = self.taints[k] 288 data['taint'] = self.taints[k]
289 289
290 computed_basehash = calc_basehash(data)
291 if computed_basehash != self.basehash[k]:
292 bb.error("Basehash mismatch %s versus %s for %s" % (computed_basehash, self.basehash[k], k))
293 if runtime and k in self.taskhash:
294 computed_taskhash = calc_taskhash(data)
295 if computed_taskhash != self.taskhash[k]:
296 bb.error("Taskhash mismatch %s versus %s for %s" % (computed_taskhash, self.taskhash[k], k))
297 sigfile = sigfile.replace(self.taskhash[k], computed_taskhash)
298
290 fd, tmpfile = tempfile.mkstemp(dir=os.path.dirname(sigfile), prefix="sigtask.") 299 fd, tmpfile = tempfile.mkstemp(dir=os.path.dirname(sigfile), prefix="sigtask.")
291 try: 300 try:
292 with os.fdopen(fd, "wb") as stream: 301 with os.fdopen(fd, "wb") as stream:
@@ -301,15 +310,6 @@ class SignatureGeneratorBasic(SignatureGenerator):
301 pass 310 pass
302 raise err 311 raise err
303 312
304 computed_basehash = calc_basehash(data)
305 if computed_basehash != self.basehash[k]:
306 bb.error("Basehash mismatch %s verses %s for %s" % (computed_basehash, self.basehash[k], k))
307 if k in self.taskhash:
308 computed_taskhash = calc_taskhash(data)
309 if computed_taskhash != self.taskhash[k]:
310 bb.error("Taskhash mismatch %s verses %s for %s" % (computed_taskhash, self.taskhash[k], k))
311
312
313 def dump_sigs(self, dataCache, options): 313 def dump_sigs(self, dataCache, options):
314 for fn in self.taskdeps: 314 for fn in self.taskdeps:
315 for task in self.taskdeps[fn]: 315 for task in self.taskdeps[fn]: