Source: gap 
Version: 4r7p9-1 
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi,

While working on the "reproducible builds" effort [1], we have noticed that
gap embeds timestamps of the current time in htm files generated by
etc/convert.pl.

This makes packages that use etc/convert.pl generate unreproducible
documentation files.

The attached patch fixes this by making convert.pl embed the date taken
from the SOURCE_DATE_EPOCH env var if this env var is set, or the
localtime otherwise. Once applied, convert.pl can generate reproducible
htm files in our current experimental framework.

 [1]: https://wiki.debian.org/ReproducibleBuilds

Regards,
-- 
Dhole
diff -Nru gap-4r7p9/debian/changelog gap-4r7p9/debian/changelog
--- gap-4r7p9/debian/changelog  2015-12-07 20:06:14.000000000 +0100
+++ gap-4r7p9/debian/changelog  2016-04-10 18:36:58.000000000 +0200
@@ -1,3 +1,10 @@
+gap (4r7p9-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Honour SOURCE_DATE_EPOCH when embedding timestamps in convert.pl 
+
+ -- Eduard Sanou <dh...@openmailbox.org>  Sun, 10 Apr 2016 18:36:37 +0200
+
 gap (4r7p9-1) unstable; urgency=low
 
   * New upstream release
diff -Nru gap-4r7p9/debian/patches/honour-SOURCE_DATE_EPOCH-in-convert.pl.patch 
gap-4r7p9/debian/patches/honour-SOURCE_DATE_EPOCH-in-convert.pl.patch
--- gap-4r7p9/debian/patches/honour-SOURCE_DATE_EPOCH-in-convert.pl.patch       
1970-01-01 01:00:00.000000000 +0100
+++ gap-4r7p9/debian/patches/honour-SOURCE_DATE_EPOCH-in-convert.pl.patch       
2016-04-11 23:19:31.000000000 +0200
@@ -0,0 +1,57 @@
+Description: Honour SOURCE_DATE_EPOCH in convert.pl
+ Honour SOURCE_DATE_EPOCH in convert.pl when embedding timestamps in the 
+ html files.
+Author: Eduard Sanou <dh...@openmailbox.org>
+
+Index: gap-4r7p9/etc/convert.pl
+===================================================================
+--- gap-4r7p9.orig/etc/convert.pl
++++ gap-4r7p9/etc/convert.pl
+@@ -140,6 +140,7 @@
+ $] > 5 or die "Needs perl 5";
+ 
+ use Getopt::Std;
++use POSIX qw(strftime setlocale LC_TIME);
+ 
+ $gaproot="/usr/share/gap/";
+ #Added by Bill Allombert to absorb ../../.. from caller. Any pkg/*/* would do.
+@@ -410,8 +411,26 @@ sub printchaps {
+   }
+ }
+ 
+-# Printed at the bottom of every page.
+-$footer = "<P>\n" . sansserif( "GAP 4 manual<br>" . `date +"%B %Y"` ) .
++#
++# Get the local date or a reproducible date from the environment variable
++# SOURCE_DATE_EPOCH if set.
++#
++sub get_date {
++   my $date = "";
++
++   if (defined $ENV{SOURCE_DATE_EPOCH}) {
++      my $locale = setlocale(LC_TIME);
++      setlocale(LC_TIME, "C");
++      $date = strftime("%B %Y", gmtime($ENV{SOURCE_DATE_EPOCH}));
++      setlocale(LC_TIME, $locale);
++   } else {
++      $date = strftime("%B %Y", gmtime(time));
++   }
++
++   return $date;
++}
++
++$footer = "<P>\n" . sansserif( "GAP 4 manual<br>" . get_date ) .
+           "</body></html>";
+ 
+ # Section label ... this is the bit that goes after a # in an HREF link
+@@ -2091,8 +2110,8 @@ if ($opt_n) {
+   $booktitle = "$opt_n : a GAP 4 package";
+   $booktitle_body = booktitle_body($booktitle, ("GAP", $opt_n));
+   $mainman=0;
+-  $footer = "<P>\n<address>$opt_n manual<br>" .
+-    `date +"%B %Y"` . "</address></body></html>";
++  $footer = "<P>\n<address>$opt_n manual<br>" . get_date .
++    "</address></body></html>";
+ #print "c: $opt_c \n";
+ } else {
+   if ($opt_f) {
diff -Nru gap-4r7p9/debian/patches/series gap-4r7p9/debian/patches/series
--- gap-4r7p9/debian/patches/series     2015-06-17 18:27:52.000000000 +0200
+++ gap-4r7p9/debian/patches/series     2016-04-10 18:37:18.000000000 +0200
@@ -8,3 +8,4 @@
 upstream-env-tmpdir
 fix-basecc
 fix-testinstall.g
+honour-SOURCE_DATE_EPOCH-in-convert.pl.patch

Attachment: signature.asc
Description: PGP signature

_______________________________________________
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