summaryrefslogtreecommitdiff
path: root/scripts/dpkg-source.pl
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2016-08-20 18:47:41 +0200
committerGuillem Jover <guillem@debian.org>2016-10-30 04:45:18 +0100
commit6c32c76ba20b641e14fc1533cecb3ca674850a90 (patch)
treeaf9414f40be14ba3bedf4f557aa75bb8676f5402 /scripts/dpkg-source.pl
parent66a12fb8b22f13bb89dd59bf13db2fb939d3de87 (diff)
downloaddpkg-6c32c76ba20b641e14fc1533cecb3ca674850a90.tar.gz
dpkg-source: Make the program reproducible when run standalone
Running dpkg-source directly is more common than running dpkg-deb directly. In addition dpkg-source needs to parse the changelog anyway, something that dpkg-deb does not need nor, in any case, has an easy way to do currently. So let's make it generate reproducible source by default.
Diffstat (limited to 'scripts/dpkg-source.pl')
-rwxr-xr-xscripts/dpkg-source.pl3
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 40a70fd14..bf2c5bec8 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -236,6 +236,9 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
my $changelog = changelog_parse(%ch_options);
my $control = Dpkg::Control::Info->new($controlfile);
+ # <https://reproducible-builds.org/specs/source-date-epoch/>
+ $ENV{SOURCE_DATE_EPOCH} ||= $changelog->{timestamp};
+
my $srcpkg = Dpkg::Source::Package->new(options => \%options);
my $fields = $srcpkg->{fields};