diff options
author | Guillem Jover <guillem@debian.org> | 2016-11-14 01:17:32 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2016-11-16 03:57:07 +0100 |
commit | d5005e4576bcf9b341e83cfb8647d5f96438642f (patch) | |
tree | a20061179ac1f8fff9d8dbb7bfc7662f84932525 /scripts/dpkg-genbuildinfo.pl | |
parent | 8ff4522cf0f08659dee954ac2c6256c607b045df (diff) | |
download | dpkg-d5005e4576bcf9b341e83cfb8647d5f96438642f.tar.gz |
dpkg-genbuildinfo: Use deterministic .buildinfo filenames
Using undeterministic filenames based on the buildinfo-id produces ugly
looking filenames, which get left behind when rebuilding the same source
multiple times as they vary by date.
There's really no great point in using unique filenames as they will end
up with different contents depending on the builder.
Diffstat (limited to 'scripts/dpkg-genbuildinfo.pl')
-rwxr-xr-x | scripts/dpkg-genbuildinfo.pl | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/scripts/dpkg-genbuildinfo.pl b/scripts/dpkg-genbuildinfo.pl index 32c7e7344..9e93d552c 100755 --- a/scripts/dpkg-genbuildinfo.pl +++ b/scripts/dpkg-genbuildinfo.pl @@ -33,7 +33,7 @@ use Dpkg (); use Dpkg::Gettext; use Dpkg::Checksums; use Dpkg::ErrorHandling; -use Dpkg::Arch qw(get_build_arch); +use Dpkg::Arch qw(get_build_arch get_host_arch); use Dpkg::Build::Types; use Dpkg::Build::Info qw(get_build_env_whitelist); use Dpkg::BuildFlags; @@ -62,7 +62,6 @@ my $admindir = $Dpkg::ADMINDIR; my $always_include_path = 0; my @build_profiles = get_build_profiles(); my $buildinfo_format = '0.1'; -my $buildinfo_id; my $buildinfo; my $checksums = Dpkg::Checksums->new(); @@ -289,7 +288,6 @@ sub usage { -F<changelog-format> force changelog format. -O[<buildinfo-file>] write to stdout (or <buildinfo-file>). -u<upload-files-dir> directory with files (default is '..'). - --buildinfo-id=<id> specify the buildinfo id for the output file. --always-include-path always include Build-Path. --admindir=<directory> change the administrative directory. -?, --help show this help message. @@ -315,8 +313,9 @@ while (@ARGV) { $stdout = 1; } elsif (m/^-O(.*)$/) { $outputfile = $1; - } elsif (m/^--buildinfo-id=(.*)$/) { - $buildinfo_id = $1; + } elsif (m/^--buildinfo-id=.*$/) { + # Deprecated option + warning('--buildinfo-id is deprecated, it is without effect'); } elsif (m/^--always-include-path$/) { $always_include_path = 1; } elsif (m/^--admindir=(.*)$/) { @@ -433,17 +432,17 @@ if ($stdout) { } elsif (defined $outputfile) { $buildinfo = basename($outputfile); } else { - if (not defined $buildinfo_id) { - require Digest::MD5; + my $arch; - my $buildinfo_contents = $fields->output(); - - my $timestamp = strftime('%Y%m%dT%H%M%Sz', gmtime); - my $buildinfo_md5 = Digest::MD5::md5_hex($buildinfo_contents); - $buildinfo_id = "$timestamp-" . substr($buildinfo_md5, 0, 8); + if (build_has_any(BUILD_ARCH_DEP)) { + $arch = get_host_arch(); + } elsif (build_has_any(BUILD_ARCH_INDEP)) { + $arch = 'all'; + } elsif (build_has_any(BUILD_SOURCE)) { + $arch = 'source'; } - $buildinfo = "${spackage}_${sversion}_${buildinfo_id}.buildinfo"; + $buildinfo = "${spackage}_${sversion}_${arch}.buildinfo"; $outputfile = "$uploadfilesdir/$buildinfo"; } |