On Sun, Jul 03, 2016 at 01:19:44PM +0200, Guido Günther wrote:
> Would it make sense to force the C locale only if SOURCE_DATE_EPOCH is
> set to not modify existing behaviour? Otherwise I'm all for an NMU.

Yes, that makes sense.  I attached an updated patch, which behaves as
before if SOURCE_DATE_EPOCH is not set.

Regards,
  Reiner
diff --git a/debian/patches/series b/debian/patches/series
index 6e5630a..795b9d1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@ bug_212088.patch
 bug_214982.patch
 bug_394511.patch
 bug_528334.patch
+support_source_date_epoch.patch
diff --git a/debian/patches/support_source_date_epoch.patch b/debian/patches/support_source_date_epoch.patch
new file mode 100644
index 0000000..20d196d
--- /dev/null
+++ b/debian/patches/support_source_date_epoch.patch
@@ -0,0 +1,28 @@
+Author: Reiner Herrmann <rei...@reiner-h.de>
+Description: Support SOURCE_DATE_EPOCH for timestamps
+ To allow generating documents in a reproducible way,
+ allow overriding the timestamp through the environment.
+ .
+ See also: https://reproducible-builds.org/specs/source-date-epoch/
+
+--- a/helpers/docbook2man-spec.pl
++++ b/helpers/docbook2man-spec.pl
+@@ -57,6 +57,7 @@
+ use SGMLS;			# Use the SGMLS package.
+ use SGMLS::Output;		# Use stack-based output.
+ use SGMLS::Refs;
++use POSIX qw(strftime setlocale LC_TIME);
+ 
+ ########################################################################
+ # SGMLSPL script produced automatically by the script sgmlspl.pl
+@@ -279,6 +280,10 @@
+ _END_BANNER
+ 
+ 	my $date = `date "+%d %B %Y"`;
++	if ($ENV{SOURCE_DATE_EPOCH}) {
++		setlocale(LC_TIME, "C");
++		$date = strftime("%d %B %Y", gmtime($ENV{SOURCE_DATE_EPOCH} || time));
++	}
+ 	my $manpage_date = $manpage_date || $date ;
+ 
+ 	output '.TH "';

Attachment: signature.asc
Description: Digital signature

Reply via email to