Source: libmongoc
Version: 1.3.5-1
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 libmongoc 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      1970-01-01 
02:00:00.000000000 +0200
--- b/debian/patches/0002_reproducible_build.patch      2016-07-18 
11:22:52.537953342 +0200
@@ -0,0 +1,35 @@
+Description: Make the build reproducible
+Author: Chris Lamb <la...@debian.org>
+Last-Update: 2016-07-18
+
+--- libmongoc-1.3.5.orig/doc/mallard2man.py
++++ libmongoc-1.3.5/doc/mallard2man.py
+@@ -31,6 +31,7 @@ page to a groff styled man page.
+ import os
+ import re
+ import sys
++import time
+ 
+ import codecs
+ from datetime import datetime
+@@ -163,7 +164,7 @@ class Convert(object):
+         self._write('\n')
+ 
+     def _generateHeader(self):
+-        year = datetime.utcnow().year
++        year = 
datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', 
time.time()))).year
+         self._writeComment('This manpage is Copyright (C) %s %s' % (year, 
COPYRIGHT_HOLDER))
+         self._writeComment('')
+         self._writeComment(
+@@ -175,7 +176,10 @@ class Convert(object):
+     "Free Documentation License\".")
+         self._writeComment('')
+ 
+-        date = 
datetime.fromtimestamp(int(os.stat(self.inFile).st_mtime)).strftime('%Y-%m-%d')
++        try:
++            date = 
datetime.utcfromtimestamp(int(os.environ['SOURCE_DATE_EPOCH'])).strftime('%Y-%m-%d')
++        except KeyError:
++            date = 
datetime.fromtimestamp(int(os.stat(self.inFile).st_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-07-18 11:14:33.325950938 +0200
--- b/debian/patches/series     2016-07-18 11:22:48.729892283 +0200
@@ -1 +1,2 @@
 0001_fix_version_page_title.patch
+0002_reproducible_build.patch
_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to