Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

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.

authored by David Terry and committed by Frederik Rietdijk cd87f1ba 3cf749b5

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