Source: rest2web Version: 0.5.2~alpha+svn-r248-2.2 Severity: wishlist Tags: patch User: reproducible-builds@lists.alioth.debian.org Usertags: timestamps X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org
Hi, Whilst working on the "reproducible builds" effort [0], we noticed that rest2web could not be built reproducibly. Patch attached. [0] https://wiki.debian.org/ReproducibleBuilds Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
--- a/debian/patches/reproducible-build.patch 1970-01-01 01:00:00.000000000 +0100 --- b/debian/patches/reproducible-build.patch 2016-08-04 08:11:52.946015124 +0100 @@ -0,0 +1,49 @@ +Description: Make the build reproducible +Author: Chris Lamb <la...@debian.org> +Last-Update: 2016-08-04 + +--- rest2web-0.5.2~alpha+svn-r248.orig/rest2web/restprocessor.py ++++ rest2web-0.5.2~alpha+svn-r248/rest2web/restprocessor.py +@@ -1060,6 +1060,13 @@ class Processor(object): + namespace['modtime'] = time.ctime(namespace['modified']) + namespace['modtimeiso'] = datetime.datetime.fromtimestamp( + namespace['modified']).isoformat() ++ try: ++ namespace['modified'] = int(os.environ['SOURCE_DATE_EPOCH']) ++ namespace['modtimeiso'] = datetime.datetime.utcfromtimestamp( ++ namespace['modified']).isoformat() ++ namespace['modtime'] = time.asctime(time.gmtime(namespace['modified'])) ++ except KeyError: ++ pass + namespace['plugins'] = restindex['plugins'] + namespace['page_description'] = encode(page_description, + final_encoding) +@@ -1306,6 +1313,13 @@ class Processor(object): + namespace['modtimeiso'] = datetime.datetime.fromtimestamp( + namespace['modified']).isoformat() + namespace['modtime'] = time.ctime(namespace['modified']) ++ try: ++ namespace['modified'] = int(os.environ['SOURCE_DATE_EPOCH']) ++ namespace['modtimeiso'] = datetime.datetime.utcfromtimestamp( ++ namespace['modified']).isoformat() ++ namespace['modtime'] = time.asctime(time.gmtime(namespace['modified'])) ++ except KeyError: ++ pass + namespace['plugins'] = restindex['plugins'] + namespace['page_description'] = encode(page_description, + final_encoding) +--- rest2web-0.5.2~alpha+svn-r248.orig/rest2web/restutils.py ++++ rest2web-0.5.2~alpha+svn-r248/rest2web/restutils.py +@@ -27,6 +27,12 @@ import random + import locale + from docutils import core + ++# Ensure IDs for back-references (etc.) are reproducible. ++try: ++ random.seed(os.environ['SOURCE_DATE_EPOCH']) ++except KeyError: ++ pass ++ + # do a quick test that we have a recent enough version of docutils + # 0.3.9 is the minimum required version of docutils + MINVERSION = '0.3.9' --- a/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 --- b/debian/patches/series 2016-08-04 07:45:10.892838087 +0100 @@ -0,0 +1 @@ +reproducible-build.patch
_______________________________________________ Reproducible-builds mailing list Reproducible-builds@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds