Source: infernal
Version: 1.1.3-2
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
infernal could not be built reproducibly.

This is because it embeds the current build timestamp and the absolute
build directory from which it was built in a generated file that is
shipped with the package.

Sample patch attached.

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


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   2019-12-06 15:38:14.423142750 
+0000
@@ -0,0 +1,34 @@
+Description: Make the build reproducible
+Author: Chris Lamb <la...@debian.org>
+Last-Update: 2019-12-05
+
+--- infernal-1.1.3.orig/hmmer/src/p7_tophits.c
++++ infernal-1.1.3/hmmer/src/p7_tophits.c
+@@ -2001,8 +2001,10 @@ p7_tophits_TabularTail(FILE *ofp, const
+   if (fprintf(ofp, "# Query file:      %s\n",      (qfile    == NULL) ? 
"[none]" : qfile) < 0)    ESL_XEXCEPTION_SYS(eslEWRITE, "tabular output tail, 
write failed");
+   if (fprintf(ofp, "# Target file:     %s\n",      (tfile    == NULL) ? 
"[none]" : tfile) < 0)    ESL_XEXCEPTION_SYS(eslEWRITE, "tabular output tail, 
write failed");
+   if (fprintf(ofp, "# Option settings: %s\n",      spoof_cmd) < 0)            
                    ESL_XEXCEPTION_SYS(eslEWRITE, "tabular output tail, write 
failed");
+-  if (fprintf(ofp, "# Current dir:     %s\n",      (cwd      == NULL) ? 
"[unknown]" : cwd) < 0)   ESL_XEXCEPTION_SYS(eslEWRITE, "tabular output tail, 
write failed");
+-  if (fprintf(ofp, "# Date:            %s",        timestamp) < 0) /* 
timestamp ends in \n */     ESL_XEXCEPTION_SYS(eslEWRITE, "tabular output tail, 
write failed");
++  if (getenv("SOURCE_DATE_EPOCH") != NULL) {
++    if (fprintf(ofp, "# Current dir:     %s\n",    (cwd      == NULL) ? 
"[unknown]" : cwd) < 0)   ESL_XEXCEPTION_SYS(eslEWRITE, "tabular output tail, 
write failed");
++    if (fprintf(ofp, "# Date:            %s",      timestamp) < 0) /* 
timestamp ends in \n */     ESL_XEXCEPTION_SYS(eslEWRITE, "tabular output tail, 
write failed");
++  }
+   if (fprintf(ofp, "# [ok]\n") < 0)                                           
                    ESL_XEXCEPTION_SYS(eslEWRITE, "tabular output tail, write 
failed");
+ 
+   free(spoof_cmd);
+--- infernal-1.1.3.orig/src/cm_tophits.c
++++ infernal-1.1.3/src/cm_tophits.c
+@@ -2780,8 +2780,10 @@ cm_tophits_TabularTail(FILE *ofp, const
+   fprintf(ofp, "# Query file:      %s\n",      (qfile    == NULL) ? "[none]" 
: qfile);
+   fprintf(ofp, "# Target file:     %s\n",      (tfile    == NULL) ? "[none]" 
: tfile);
+   fprintf(ofp, "# Option settings: %s\n",      spoof_cmd);
+-  fprintf(ofp, "# Current dir:     %s\n",      (cwd      == NULL) ? 
"[unknown]" : cwd);
+-  fprintf(ofp, "# Date:            %s",        timestamp); /* timestamp ends 
in \n */
++  if (getenv("SOURCE_DATE_EPOCH") != NULL) {
++    fprintf(ofp, "# Current dir:     %s\n",      (cwd      == NULL) ? 
"[unknown]" : cwd);
++    fprintf(ofp, "# Date:            %s",        timestamp); /* timestamp 
ends in \n */
++  }
+   fprintf(ofp, "# [ok]\n");
+ 
+   free(spoof_cmd);
--- a/debian/patches/series     2019-12-06 15:35:28.229648170 +0000
--- b/debian/patches/series     2019-12-06 15:38:14.423142750 +0000
@@ -2,3 +2,4 @@
 #autoreconf.patch
 spelling.patch
 hardening
+reproducible_build.patch

Reply via email to