Bug#823824: asymptote: please make the build reproducible (timestamps)
Source: asymptote
Version: 2.37.real-1
Severity: wishlist
Tags: patch upstream
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org
Dear Maintainer,
While working on the `reproducible builds' effort [1], we have noticed
that 'asymptote' could not be built reproducibly.
The attached patch honours the SOURCE_DATE_EPOCH environment
variable [2] to get a reproducible documentation date from the last
debian changelog entry.
Once applied, asymptote can be built reproducibly in our current
experimental framework.
Regards,
Alexis Bienvenüe.
[1]: https://wiki.debian.org/ReproducibleBuilds
[2]: https://reproducible-builds.org/specs/source-date-epoch/
diff -Nru asymptote-2.37.real/debian/changelog asymptote-2.37.real/debian/changelog
--- asymptote-2.37.real/debian/changelog 2016-03-15 03:44:39.000000000 +0100
+++ asymptote-2.37.real/debian/changelog 2016-05-09 10:07:40.000000000 +0200
@@ -1,3 +1,9 @@
+asymptote (2.37.real-1.0~reproducible1) UNRELEASED; urgency=medium
+
+ * Honour SOURCE_DATE_EPOCH, to make the build reproducible.
+
+ -- Alexis Bienvenüe <pado@passoire.fr> Mon, 09 May 2016 10:07:40 +0200
+
asymptote (2.37.real-1) unstable; urgency=medium
* Imported Upstream version 2.37.real - the previous 2.37 was only
diff -Nru asymptote-2.37.real/debian/patches/honour-source-date-epoch asymptote-2.37.real/debian/patches/honour-source-date-epoch
--- asymptote-2.37.real/debian/patches/honour-source-date-epoch 1970-01-01 01:00:00.000000000 +0100
+++ asymptote-2.37.real/debian/patches/honour-source-date-epoch 2016-05-09 11:54:20.000000000 +0200
@@ -0,0 +1,62 @@
+Description: Honour SOURCE_DATE_EPOCH.
+ Honour the SOURCE_DATE_EPOCH environment variable to get documentation date
+ from last debian changelog entry.
+ This makes the build reproducible.
+ See https://reproducible-builds.org/specs/source-date-epoch/.
+Author: Alexis Bienvenüe <pado@passoire.fr>
+
+Index: asymptote-2.37.real/doc/FAQ/m-html.pl
+===================================================================
+--- asymptote-2.37.real.orig/doc/FAQ/m-html.pl
++++ asymptote-2.37.real/doc/FAQ/m-html.pl
+@@ -34,8 +34,8 @@ sub html_init {
+ print HTML "<html>\n";
+ $html_needpara= -1;
+ $html_end='';
+- chop($html_date=`date '+%d %B %Y'`);
+- chop($html_year=`date '+%Y'`);
++ $html_date=time2str("%d %B %Y", $ENV{SOURCE_DATE_EPOCH} || time, "UTC");
++ $html_year=time2str("%Y", $ENV{SOURCE_DATE_EPOCH} || time, "UTC");
+ }
+
+ sub html_startup {
+Index: asymptote-2.37.real/doc/FAQ/m-lout.pl
+===================================================================
+--- asymptote-2.37.real.orig/doc/FAQ/m-lout.pl
++++ asymptote-2.37.real/doc/FAQ/m-lout.pl
+@@ -23,7 +23,7 @@
+
+ sub lout_init {
+ open(LOUT,">$prefix.lout");
+- chop($dprint= `date '+%d %B %Y'`);
++ $dprint = time2str("%d %B %Y", $ENV{SOURCE_DATE_EPOCH} || time, "UTC");
+ $dprint =~ s/^0//;
+ }
+
+Index: asymptote-2.37.real/doc/FAQ/bfnnconv.pl
+===================================================================
+--- asymptote-2.37.real.orig/doc/FAQ/bfnnconv.pl
++++ asymptote-2.37.real/doc/FAQ/bfnnconv.pl
+@@ -21,6 +21,8 @@
+ # by the GPL. However, I would appreciate it if you credited me if
+ # appropriate in any documents you format using BFNN.)
+
++use Date::Format;
++
+ @outputs=('ascii','info','html');
+
+ while ($ARGV[0] =~ m/^\-/) {
+@@ -135,7 +137,12 @@ while (<>) {
+ m/([^\\])\`/ || warn "`$_'";
+ $_= $';
+ $cmd= $`.$1;
+- $it= `$cmd`; chop $it;
++ if($cmd =~ /date [\"\']\+(.*?)[\"\']/) {
++ my $format=$1;
++ $it=time2str($format, $ENV{SOURCE_DATE_EPOCH} || time, "UTC");
++ } else {
++ $it= `$cmd`; chop $it;
++ }
+ print $fh $it;
+ }
+ print $fh $_;
diff -Nru asymptote-2.37.real/debian/patches/series asymptote-2.37.real/debian/patches/series
--- asymptote-2.37.real/debian/patches/series 2016-03-15 03:44:39.000000000 +0100
+++ asymptote-2.37.real/debian/patches/series 2016-05-09 10:04:55.000000000 +0200
@@ -4,3 +4,4 @@
#old-gs-use-epswrite
#upstream-gsl2
#upstream-fix-mips-build-failure
+honour-source-date-epoch
Reply to: