| 1 | # Source: <https://sources.debian.org/patches/docbook-utils/0.6.14-4/support_source_date_epoch.patch/>
|
| 2 |
|
| 3 | Author: Reiner Herrmann <[email protected]>
|
| 4 | Description: Support SOURCE_DATE_EPOCH for timestamps
|
| 5 | To allow generating documents in a reproducible way,
|
| 6 | allow overriding the timestamp through the environment.
|
| 7 | .
|
| 8 | See also: https://reproducible-builds.org/specs/source-date-epoch/
|
| 9 | Bug-Debian: https://bugs.debian.org/800797
|
| 10 |
|
| 11 | |
| 12 | |
| 13 | @@ -57,6 +57,7 @@
|
| 14 | use SGMLS; # Use the SGMLS package.
|
| 15 | use SGMLS::Output; # Use stack-based output.
|
| 16 | use SGMLS::Refs;
|
| 17 | +use POSIX qw(strftime setlocale LC_TIME);
|
| 18 |
|
| 19 | ########################################################################
|
| 20 | # SGMLSPL script produced automatically by the script sgmlspl.pl
|
| 21 | @@ -279,6 +280,10 @@
|
| 22 | _END_BANNER
|
| 23 |
|
| 24 | my $date = `date "+%d %B %Y"`;
|
| 25 | + if ($ENV{SOURCE_DATE_EPOCH}) {
|
| 26 | + setlocale(LC_TIME, "C");
|
| 27 | + $date = strftime("%d %B %Y", gmtime($ENV{SOURCE_DATE_EPOCH} || time));
|
| 28 | + }
|
| 29 | my $manpage_date = $manpage_date || $date ;
|
| 30 |
|
| 31 | output '.TH "';
|