[Reproducible-commits] [dpkg] 46/74: dpkg-buildpackage: Preset build timestamp to latest changelog entry

Mattia Rizzolo mattia at debian.org
Sun Jul 3 22:22:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to annotated tag 1.18.8
in repository dpkg.

commit 5dc74874e6cf26e01105d8b1798e39b8b8d9e126
Author: Guillem Jover <guillem at debian.org>
Date:   Fri May 13 02:40:09 2016 +0200

    dpkg-buildpackage: Preset build timestamp to latest changelog entry
    
    Set the SOURCE_DATE_EPOCH environment variable to Unix timestamp since
    the epoch of the latest entry in debian/changelog. This enables build
    to be easily reproduced as the dates captured in the «.deb» archives
    will be deterministic.
    
    SOURCE_DATE_EPOCH can also be externaly set before running
    dpkg-buildpackage to reproduce the build with an arbitrary date.
    
    Closes: #759999
    Ref: https://reproducible-builds.org/specs/source-date-epoch/
    Base-on-patch-by: Jérémy Bobbio <lunar at debian.org>
---
 debian/changelog             | 3 +++
 man/dpkg-buildpackage.1      | 5 +++++
 scripts/dpkg-buildpackage.pl | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 464a29a..e44c420 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -33,6 +33,9 @@ dpkg (1.18.8) UNRELEASED; urgency=medium
     in dpkg-deb.
   * Set ar timestamp and tar mtime clamping to SOURCE_DATE_EPOCH if defined
     in dpkg-deb. Base on a patch by Jérémy Bobbio <lunar at debian.org>.
+  * Preset build timestamp to latest changelog entry in dpkg-buildpackage,
+    by setting SOURCE_DATE_EPOCH environment variable if it is not already
+    defined. Based on a patch by Jérémy Bobbio <lunar at debian.org>.
     Closes: #759999
   * Perl modules:
     - Use warnings::warnif() instead of carp() for deprecated warnings.
diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index 6908905..437a7b2 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -470,6 +470,11 @@ standalone should be supported.
 \fBdpkg\-architecture\fP is called with the \fB\-a\fP and \fB\-t\fP
 parameters forwarded. Any variable that is output by its \fB\-s\fP
 option is integrated in the build environment.
+
+.TP
+.B SOURCE_DATE_EPOCH
+This variable is set to the Unix timestamp since the epoch of the
+latest entry in \fIdebian/changelog\fP, if it is not already defined.
 .
 .SH FILES
 .TP
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 7ff0384..714f571 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -415,6 +415,8 @@ if ($changedby) {
     $maintainer = mustsetvar($changelog->{maintainer}, g_('source changed by'));
 }
 
+# <https://reproducible-builds.org/specs/source-date-epoch/>
+$ENV{SOURCE_DATE_EPOCH} ||= $changelog->{timestamp};
 
 my @arch_opts;
 push @arch_opts, ('--host-arch', $host_arch) if $host_arch;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list