Source: elinks
Version: 0.13.1-3
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

Hi,

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

This is due the embedded asciidoc code generating build-time specific
content that, additionally, differed on the timezone.

Patch attached.


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


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
--- a/debian/patches/11-reproducible-build.diff 1970-01-01 01:00:00.000000000 
+0100
--- b/debian/patches/11-reproducible-build.diff 2020-05-11 15:50:08.155828933 
+0100
@@ -0,0 +1,22 @@
+Description: Make the build reproducible
+Author: Chris Lamb <la...@debian.org>
+Last-Update: 2020-05-11
+
+--- elinks-0.13.1.orig/doc/tools/asciidoc/asciidoc.py
++++ elinks-0.13.1/doc/tools/asciidoc/asciidoc.py
+@@ -1061,13 +1061,9 @@ class Document:
+         self.safe = True        # Default safe mode.
+     def init_attrs(self):
+         # Set implicit attributes.
+-        d = time.localtime(time.time())
++        d = time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
+         self.attributes['localdate'] = time.strftime('%d-%b-%Y',d)
+-        s = time.strftime('%H:%M:%S',d)
+-        if time.daylight:
+-            self.attributes['localtime'] = s + ' ' + time.tzname[1]
+-        else:
+-            self.attributes['localtime'] = s + ' ' + time.tzname[0]
++        s = time.strftime('%H:%M:%S %z',d)
+         self.attributes['asciidoc-version'] = VERSION
+         self.attributes['backend'] = document.backend
+         self.attributes['doctype'] = document.doctype
--- a/debian/patches/series     2020-05-11 15:22:33.089618683 +0100
--- b/debian/patches/series     2020-05-11 15:30:22.717119988 +0100
@@ -6,3 +6,4 @@
 16_POST_BUFFER_SIZE.diff
 cookie-path-fix.patch
 #ascii-replacement-utf8-console.diff
+11-reproducible-build.diff
--- a/doc/tools/asciidoc/asciidoc.py    2020-05-11 15:22:33.093618744 +0100
--- b/doc/tools/asciidoc/asciidoc.py    2020-05-11 15:50:07.339824713 +0100
@@ -1061,13 +1061,9 @@
         self.safe = True        # Default safe mode.
     def init_attrs(self):
         # Set implicit attributes.
-        d = time.localtime(time.time())
+        d = time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
         self.attributes['localdate'] = time.strftime('%d-%b-%Y',d)
-        s = time.strftime('%H:%M:%S',d)
-        if time.daylight:
-            self.attributes['localtime'] = s + ' ' + time.tzname[1]
-        else:
-            self.attributes['localtime'] = s + ' ' + time.tzname[0]
+        s = time.strftime('%H:%M:%S %z',d)
         self.attributes['asciidoc-version'] = VERSION
         self.attributes['backend'] = document.backend
         self.attributes['doctype'] = document.doctype

Reply via email to