File reproducible.patch of Package texinfo
Description: Make the build reproducible
+ set the PACKAGE_DATE value to SOURCE_DATE_EPOCH if available
Author: Mattia Rizzolo <mattia@debian.org>
Author: Reiner Herrmann <reiner@reiner-h.de>
Bug-Debian: https://bugs.debian.org/783478
Forwarded: no
Last-Update: 2015-12-23
Index: texinfo-6.5/configure
===================================================================
--- texinfo-6.5.orig/configure
+++ texinfo-6.5/configure
@@ -4123,7 +4123,11 @@ fi
# Package date.
-PACKAGE_DATE=`${SHELL} "$srcdir"/build-aux/mdate-sh "$srcdir"/configure.ac`
+if test "x$SOURCE_DATE_EPOCH" = "x"; then
+ SOURCE_DATE_EPOCH=`date +%s`
+fi
+fmt="%B %d. %Y"
+PACKAGE_DATE=`date -u -d "@$SOURCE_DATE_EPOCH" "+$fmt" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+$fmt" 2>/dev/null || date -u "+$fmt"`
# We need Perl
Index: texinfo-6.5/tp/Texinfo/Convert/Text.pm
===================================================================
--- texinfo-6.5.orig/tp/Texinfo/Convert/Text.pm
+++ texinfo-6.5/tp/Texinfo/Convert/Text.pm
@@ -419,8 +419,9 @@ sub _convert($;$)
} elsif ($options->{'TEST'}) {
return 'a sunny day';
} else {
- my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)
- = localtime(time);
+ my @t = localtime(time);
+ if($ENV{SOURCE_DATE_EPOCH}) { @t = gmtime($ENV{SOURCE_DATE_EPOCH}) }
+ my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = @t;
$year += ($year < 70) ? 2000 : 1900;
return "$Texinfo::Common::MONTH_NAMES[$mon] $mday, $year";
}
Index: texinfo-6.5/tp/Texinfo/Convert/TextContent.pm
===================================================================
--- texinfo-6.5.orig/tp/Texinfo/Convert/TextContent.pm
+++ texinfo-6.5/tp/Texinfo/Convert/TextContent.pm
@@ -118,8 +118,9 @@ sub _convert($$)
if (exists($Texinfo::Common::no_brace_commands{$root->{'cmdname'}})) {
return $Texinfo::Common::no_brace_commands{$root->{'cmdname'}};
} elsif ($root->{'cmdname'} eq 'today') {
- my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)
- = localtime(time);
+ my @t = localtime(time);
+ if($ENV{SOURCE_DATE_EPOCH}) { @t = gmtime($ENV{SOURCE_DATE_EPOCH}) }
+ my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = @t;
$year += ($year < 70) ? 2000 : 1900;
return "$Texinfo::Common::MONTH_NAMES[$mon] $mday, $year";
} elsif (defined($Texinfo::Convert::Text::text_brace_no_arg_commands{$root->{'cmdname'}})) {