aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Neves <paulo@myneves.com>2023-08-22 20:33:58 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-08-24 16:46:37 +0100
commit5293a1b36eeb89f57577cb709ec7f293909039a1 (patch)
treec0d2757b7b4fb337e14c78f7d30d75b6cf2a81e7
parenta06619951a43acb80b80d92e0caac560657ca249 (diff)
downloadbitbake-contrib-5293a1b36eeb89f57577cb709ec7f293909039a1.tar.gz
siggen.py: Improve taskhash reproducibility
file checksums are part of the data checksummed to generate the task hash. The list of file checksums was not ordered. In this commit we make sure the task hash checksum takes a list of checksum data that is ordered by unique file name thus guaranteeing reproducibility. Signed-off-by: Paulo Neves <paulo@myneves.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/siggen.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py
index 879c136e1..b023b79ec 100644
--- a/lib/bb/siggen.py
+++ b/lib/bb/siggen.py
@@ -361,7 +361,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
for dep in sorted(self.runtaskdeps[tid]):
data += self.get_unihash(dep[1])
- for (f, cs) in self.file_checksum_values[tid]:
+ for (f, cs) in sorted(self.file_checksum_values[tid], key=clean_checksum_file_path):
if cs:
if "/./" in f:
data += "./" + f.split("/./")[1]
@@ -426,7 +426,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
if runtime and tid in self.taskhash:
data['runtaskdeps'] = [dep[0] for dep in sorted(self.runtaskdeps[tid])]
data['file_checksum_values'] = []
- for f,cs in self.file_checksum_values[tid]:
+ for f,cs in sorted(self.file_checksum_values[tid], key=clean_checksum_file_path):
if "/./" in f:
data['file_checksum_values'].append(("./" + f.split("/./")[1], cs))
else:
@@ -745,6 +745,12 @@ class SignatureGeneratorTestEquivHash(SignatureGeneratorUniHashMixIn, SignatureG
self.server = data.getVar('BB_HASHSERVE')
self.method = "sstate_output_hash"
+def clean_checksum_file_path(file_checksum_tuple):
+ f, cs = file_checksum_tuple
+ if "/./" in f:
+ return "./" + f.split("/./")[1]
+ return f
+
def dump_this_task(outfile, d):
import bb.parse
mcfn = d.getVar("BB_FILENAME")