Source: libbson Version: 1.3.5-1 Severity: wishlist Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: timestamps X-Debbugs-Cc: reproducible-bui...@lists.alioth.debian.org
Hi, Whilst working on the "reproducible builds" effort [0], we noticed that libbson 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/0002_reproducible_build.patch 1969-12-31 19:00:00.000000000 -0500 --- b/debian/patches/0002_reproducible_build.patch 2016-08-03 19:59:31.672795427 -0400 @@ -0,0 +1,29 @@ +Description: Make the build reproducible +Author: Chris Lamb <la...@debian.org> +Last-Update: 2016-08-03 + +--- libbson-1.3.5.orig/doc/mallard2man.py ++++ libbson-1.3.5/doc/mallard2man.py +@@ -163,7 +163,12 @@ class Convert(object): + self._write('\n') + + def _generateHeader(self): +- year = datetime.utcnow().year ++ try: ++ mtime = datetime.utcfromtimestamp(int(os.environ['SOURCE_DATE_EPOCH'])) ++ year = mtime.year ++ except KeyError: ++ mtime = datetime.fromtimestamp(int(os.stat(self.inFile).st_mtime)) ++ year = datetime.utcnow().year + self._writeComment('This manpage is Copyright (C) %s %s' % (year, COPYRIGHT_HOLDER)) + self._writeComment('') + self._writeComment( +@@ -175,7 +180,7 @@ class Convert(object): + "Free Documentation License\".") + self._writeComment('') + +- date = datetime.fromtimestamp(int(os.stat(self.inFile).st_mtime)).strftime('%Y-%m-%d') ++ date = mtime.strftime('%Y-%m-%d') + title = self.title.replace('()','').upper() + self._write('.TH "%s" "%s" "%s" "%s"\n' % (title, self.section, date, GROUP)) + self._write('.SH NAME\n') --- a/debian/patches/series 2016-08-03 18:45:56.764275847 -0400 --- b/debian/patches/series 2016-08-03 19:59:45.473071418 -0400 @@ -1 +1,2 @@ 0001_use_system_yajl.patch +0002_reproducible_build.patch