Bug#858333: doomsday: please make the build reproducible

Chris Lamb lamby at debian.org
Tue Mar 21 12:15:46 UTC 2017


Source: doomsday
Version: 1.15.8-3
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps permissions
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed
that doomsday could not be built reproducibly.

Patch attached. This also makes the debian/patches/perms.patch
not required as we set the file mode manually.

 [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
diff --git a/doomsday/build/scripts/buildpackage.py b/doomsday/build/scripts/buildpackage.py
index 1f51441..133384d 100755
--- a/doomsday/build/scripts/buildpackage.py
+++ b/doomsday/build/scripts/buildpackage.py
@@ -7,7 +7,7 @@
 #   buildpackage (pack-dir) (output-dir)
 #
 
-import sys, os, os.path, zipfile
+import sys, os, os.path, zipfile, time
 
 if len(sys.argv) < 2:
     print "Usage: %s (pack-dir) (output-dir)" % sys.argv[0]
@@ -58,8 +58,12 @@ class Package:
             sys.exit(1)
         
         # Write entries in alphabetical order.
+        date_time = time.localtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
         for full, internal in sorted(contents):
-            pack.write(full, internal)
+            info = zipfile.ZipInfo(internal, date_time)
+            info.external_attr = 0644 << 16L
+            with open(full, 'rb') as f:
+                pack.writestr(info, f.read())
             
         # Write it out.
         print "Wrote %s (contains %i files)." % (outputName, len(pack.namelist()))


More information about the Pkg-games-devel mailing list