[dpkg] 111/200: dpkg-buildpackage, dpkg-source: Always set SOURCE_DATE_EPOCH

Ximin Luo infinity0 at debian.org
Wed Apr 5 15:17:25 UTC 2017


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

infinity0 pushed a commit to branch master
in repository dpkg.

commit 85c3f8489e5eff5bdaf50ec3959a7798876f7a97
Author: Guillem Jover <guillem at debian.org>
Date:   Fri Dec 23 00:09:55 2016 +0100

    dpkg-buildpackage, dpkg-source: Always set SOURCE_DATE_EPOCH
    
    If we do not have a date from the changelog set it to the current time.
    
    Closes: #849081
---
 debian/changelog               | 2 ++
 scripts/Dpkg/Source/Archive.pm | 2 +-
 scripts/dpkg-buildpackage.pl   | 2 +-
 scripts/dpkg-source.pl         | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1b05a2b..ef147d5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ dpkg (1.18.19) UNRELEASED; urgency=medium
     alter its contents. Closes: #831524
   * Do not allow empty epochs and revisions in versions. When there's at
     least one colon or one dash, we should expect epoch and revision numbers.
+  * Always set SOURCE_DATE_EPOCH in dpkg-buildpackage and dpkg-source. Use
+    the current date if the changelog does not have one. Closes: #849081
   * Portability:
     - On GNU/Hurd try to use the new process executable name attribute from
       libps, to properly match on start-stop-daemon --exec.
diff --git a/scripts/Dpkg/Source/Archive.pm b/scripts/Dpkg/Source/Archive.pm
index ba377c0..33c181b 100644
--- a/scripts/Dpkg/Source/Archive.pm
+++ b/scripts/Dpkg/Source/Archive.pm
@@ -48,7 +48,7 @@ sub create {
     $spawn_opts{to_handle} = $self->get_filehandle();
     $spawn_opts{from_pipe} = \*$self->{tar_input};
     # Try to use a deterministic mtime.
-    my $mtime = $opts{source_date} // $ENV{SOURCE_DATE_EPOCH} // time;
+    my $mtime = $opts{source_date} // $ENV{SOURCE_DATE_EPOCH} || time;
     # Call tar creation process
     $spawn_opts{delete_env} = [ 'TAR_OPTIONS' ];
     $spawn_opts{exec} = [ $Dpkg::PROGTAR, '-cf', '-', '--format=gnu', '--sort=name',
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index f3d734a..114899b 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -435,7 +435,7 @@ if ($changedby) {
 }
 
 # <https://reproducible-builds.org/specs/source-date-epoch/>
-$ENV{SOURCE_DATE_EPOCH} ||= $changelog->{timestamp};
+$ENV{SOURCE_DATE_EPOCH} ||= $changelog->{timestamp} || time;
 
 my @arch_opts;
 push @arch_opts, ('--host-arch', $host_arch) if $host_arch;
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index b7776a7..2d4ae5f 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -237,7 +237,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
     my $control = Dpkg::Control::Info->new($controlfile);
 
     # <https://reproducible-builds.org/specs/source-date-epoch/>
-    $ENV{SOURCE_DATE_EPOCH} ||= $changelog->{timestamp};
+    $ENV{SOURCE_DATE_EPOCH} ||= $changelog->{timestamp} || time;
 
     my $srcpkg = Dpkg::Source::Package->new(options => \%options);
     my $fields = $srcpkg->{fields};

-- 
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