Просмотр исходного кода

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
Guillem Jover лет назад: 9
Родитель
Сommit
85c3f8489e
4 измененных файлов с 5 добавлено и 3 удалено
  1. 2 0
      debian/changelog
  2. 1 1
      scripts/Dpkg/Source/Archive.pm
  3. 1 1
      scripts/dpkg-buildpackage.pl
  4. 1 1
      scripts/dpkg-source.pl

+ 2 - 0
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.

+ 1 - 1
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',

+ 1 - 1
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;

+ 1 - 1
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};