diff options
author | Brendan O'Dea <bod@debian.org> | 2015-06-15 23:14:05 +1000 |
---|---|---|
committer | Brendan O'Dea <bod@debian.org> | 2015-06-15 23:53:06 +1000 |
commit | 8448110e8b7567147b70ff54ddf771306a56d39d (patch) | |
tree | 82b032805f46dc86c25d9479a1aae8b6556e2426 /help2man.PL | |
parent | 610266e8eb71b4df4d70df7d6d9a0df030461e35 (diff) | |
download | help2man-8448110e8b7567147b70ff54ddf771306a56d39d.tar.gz |
Add support for reproducible builds: $SOURCE_DATE_EPOCH
Diffstat (limited to 'help2man.PL')
-rwxr-xr-x | help2man.PL | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/help2man.PL b/help2man.PL index 664cc47..96146eb 100755 --- a/help2man.PL +++ b/help2man.PL @@ -366,11 +366,23 @@ for my $hash (\(%include, %replace, %append, %append_match)) 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 = program_basename $ARGV[0]; my $package = $program; my $version; |