about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Terry <me@xwvvvvwx.com>2019-10-18 16:05:19 +0200
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2019-11-03 10:55:45 +0100
commitcd87f1ba239b79eb69ba86938644a1307243f45d (patch)
tree649d62a469ef06bf3fd02cd62fd145640e0f738b
parent3cf749b58f718626b83a75bb0c4917ade9615a30 (diff)
downloadnixlib-cd87f1ba239b79eb69ba86938644a1307243f45d.tar
nixlib-cd87f1ba239b79eb69ba86938644a1307243f45d.tar.gz
nixlib-cd87f1ba239b79eb69ba86938644a1307243f45d.tar.bz2
nixlib-cd87f1ba239b79eb69ba86938644a1307243f45d.tar.lz
nixlib-cd87f1ba239b79eb69ba86938644a1307243f45d.tar.xz
nixlib-cd87f1ba239b79eb69ba86938644a1307243f45d.tar.zst
nixlib-cd87f1ba239b79eb69ba86938644a1307243f45d.zip
automake-1.15: deterministic documentation generation
automake 1.15 uses a bundled version of help2man from 2012 that
does not support the SOURCE_DATE_EPOCH environment variable.

This means that the build date is included in the generated
documentation, breaking reproducibility.

This changes adds the SOURCE_DATE_EPOCH support from the current
help2man to the version bundled in automake 1.15.
-rw-r--r--pkgs/development/tools/misc/automake/automake-1.15.x.nix2
-rw-r--r--pkgs/development/tools/misc/automake/help2man-SOURCE_DATE_EPOCH-support.patch41
2 files changed, 43 insertions, 0 deletions
diff --git a/pkgs/development/tools/misc/automake/automake-1.15.x.nix b/pkgs/development/tools/misc/automake/automake-1.15.x.nix
index e1aeb025c30f..f1a486446170 100644
--- a/pkgs/development/tools/misc/automake/automake-1.15.x.nix
+++ b/pkgs/development/tools/misc/automake/automake-1.15.x.nix
@@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
 
   setupHook = ./setup-hook.sh;
 
+  patches = [ ./help2man-SOURCE_DATE_EPOCH-support.patch ];
+
   # Disable indented log output from Make, otherwise "make.test" will
   # fail.
   preCheck = "unset NIX_INDENT_MAKE";
diff --git a/pkgs/development/tools/misc/automake/help2man-SOURCE_DATE_EPOCH-support.patch b/pkgs/development/tools/misc/automake/help2man-SOURCE_DATE_EPOCH-support.patch
new file mode 100644
index 000000000000..048f75e63343
--- /dev/null
+++ b/pkgs/development/tools/misc/automake/help2man-SOURCE_DATE_EPOCH-support.patch
@@ -0,0 +1,41 @@
+From 2e3357d7f0d63f1caeb40d9644c2436a5cd0da5f Mon Sep 17 00:00:00 2001
+From: David Terry <me@xwvvvvwx.com>
+Date: Fri, 18 Oct 2019 10:23:11 +0200
+Subject: [PATCH] help2man: add support for SOURCE_DATE_EPOCH
+
+---
+ doc/help2man | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/doc/help2man b/doc/help2man
+index af4306f..4a64167 100755
+--- a/doc/help2man
++++ b/doc/help2man
+@@ -213,11 +213,23 @@ sub get_option_value;
+ my $help_text   = get_option_value $ARGV[0], $help_option;
+ $version_text ||= get_option_value $ARGV[0], $version_option;
+ 
++# By default the generated manual pages will include the current date.  This may
++# however be overriden by setting the environment variable $SOURCE_DATE_EPOCH
++# to an integer value of the seconds since the UNIX epoch.  This is primarily
++# intended to support reproducible builds (wiki.debian.org/ReproducibleBuilds)
++# and will additionally ensure that the output date string is UTC.
++my $epoch_secs = time;
++if (exists $ENV{SOURCE_DATE_EPOCH} and $ENV{SOURCE_DATE_EPOCH} =~ /^(\d+)$/)
++{
++    $epoch_secs = $1;
++    $ENV{TZ} = 'UTC';
++}
++
+ # Translators: the following message is a strftime(3) format string, which in
+ # the English version expands to the month as a word and the full year.  It
+ # is used on the footer of the generated manual pages.  If in doubt, you may
+ # just use %x as the value (which should be the full locale-specific date).
+-my $date = enc strftime _("%B %Y"), localtime;
++my $date = enc strftime _("%B %Y"), localtime $epoch_secs;
+ (my $program = $ARGV[0]) =~ s!.*/!!;
+ my $package = $program;
+ my $version;
+-- 
+2.23.0
+