Source: tar
Version: 1.27.1-2
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps

Hi,

tar can currently not be build reproducibly, because the script debian/tarman
generates the manpage tar.1 with an embedded timestamp of the current system 
time
(which will vary with each build).

The attached patch exports the last timestamp from the Debian changelog, which 
is then
used by the script for the time strings.

Regards,
 Reiner
diff --git a/debian/changelog b/debian/changelog
index f3816b3..23f86dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+tar (1.27.1-2.0~reproducible1) UNRELEASED; urgency=low
+
+  * Set timestamp in generated manpage to latest changelog date
+    to make building the package reproducible.
+
+ -- Reiner Herrmann <rei...@reiner-h.de>  Sat, 03 Jan 2015 02:30:39 +0100
+
 tar (1.27.1-2) unstable; urgency=low
 
   * patch from David Gilman adds watch file with signature verification, 
diff --git a/debian/rules b/debian/rules
index 8adc988..28c6ded 100755
--- a/debian/rules
+++ b/debian/rules
@@ -11,6 +11,8 @@ CFLAGS += -Wall
 LDFLAGS += `dpkg-buildflags --get LDFLAGS`
 CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
 
+export BUILD_DATE = $(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p')
+
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
   NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
   MAKEFLAGS += -j$(NUMJOBS)
diff --git a/debian/tarman b/debian/tarman
index 7016931..10928a3 100644
--- a/debian/tarman
+++ b/debian/tarman
@@ -4,9 +4,10 @@
 #
 
 use strict;
+use POSIX qw(strftime);
 
-my $t = "".localtime(time);
-my $datestr = substr($t,4,3)." ".substr($t,8,2).", ".substr($t,20,4);
+my $t = $ENV{'BUILD_DATE'} // strftime("%a, %d %b %Y %H:%M:%S %z", localtime(time));
+my $datestr = substr($t,8,3)." ".substr($t,5,2).", ".substr($t,12,4);
 
 @ARGV=qw(src/tar.c);
 my $mode;

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to