Skip to contentSkip to conversation

sstatesig: Log timestamps for hashequiv in reprodubile builds for do_package

PATCH New Richard Purdie 1 participant 1 message Oct 27, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sstatesig: Log timestamps for hashequiv in reprodubile builds for do_package

Currently if a task generates the same output with different timestamps, hasequiv won't detect it but reproducibile builds will fail tests due to the different timestamps.

Add do_package timestamps to the hash when reproducibile builds are enabled to avoid this.

---
 meta/lib/oe/sstatesig.py | 4 ++++
 1 file changed, 4 insertions(+)
meta/lib/oe/sstatesig.py +4 -0
index 4b8f264012c..84ec7f46f22 100644
@@ -485,6 +485,7 @@ def OEOuthashBasic(path, sigfile, task, d):
     if "package_write_" in task or task == "package_qa":
         include_owners = False
     extra_content = d.getVar('HASHEQUIV_HASH_VERSION')
+    include_timestamps = d.getVar('BUILD_REPRODUCIBLE_BINARIES') == '1'
 
     try:
         os.chdir(path)
@@ -558,6 +559,9 @@ def OEOuthashBasic(path, sigfile, task, d):
                         bb.warn("KeyError in %s" % path)
                         raise
 
+                if include_timestamps:
+                    update_hash(" %10d" % s.st_mtime)
+
                 update_hash(" ")
                 if stat.S_ISBLK(s.st_mode) or stat.S_ISCHR(s.st_mode):
                     update_hash("%9s" % ("%d.%d" % (os.major(s.st_rdev), os.minor(s.st_rdev))))
Signature · 1 line
2.25.1