Source: docbook-utils
Version: 0.6.14-3
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: toolchain timestamps locale
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that docbook-utils doesn't generate reproducible manpages.
The embedded timestamp is using the build date and also varies depending
on the configured locale.

The attached patch adds support for the SOURCE_DATE_EPOCH environment
variable [2] and uses the C locale for the human-readable month
(which also fixes #214982).

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds
[2]: https://reproducible-builds.org/specs/source-date-epoch/

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..ce5559c
--- /dev/null
+++ b/debian/patches/support_source_date_epoch.patch
@@ -0,0 +1,29 @@
+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/
+
+Index: docbook-utils-0.6.14/helpers/docbook2man-spec.pl
+===================================================================
+--- docbook-utils-0.6.14.orig/helpers/docbook2man-spec.pl
++++ docbook-utils-0.6.14/helpers/docbook2man-spec.pl
+@@ -57,6 +57,7 @@ Software Foundation, 675 Mass Ave, Cambr
+ 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
+@@ -278,7 +279,8 @@ sgml('</REFMETA>', sub {
+ .\\" etc. to Steve Cheng <steve\@ggi-project.org>.
+ _END_BANNER
+ 
+-	my $date = `date "+%d %B %Y"`;
++	setlocale(LC_TIME, "C");
++	my $date = strftime("%d %B %Y", gmtime($ENV{SOURCE_DATE_EPOCH} || time));
+ 	my $manpage_date = $manpage_date || $date ;
+ 
+ 	output '.TH "';

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to