[dpkg] 22/192: dpkg-genbuildinfo: Add duplicate prevention code for debian/files
Ximin Luo
infinity0 at debian.org
Tue Oct 17 11:03:53 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit 45f0c9a93098af4173a6cd6c6a90b3e5d043f213
Author: Guillem Jover <guillem at debian.org>
Date: Sun Apr 30 00:42:17 2017 +0200
dpkg-genbuildinfo: Add duplicate prevention code for debian/files
We should do something similar to what dpkg-gencontrol is doing, by
preventing duplicated entries for the same file with different versions.
In this case, because the assumption is that there can ever only be one
buildinfo file for a «source» or «all» build, but possibly multiple for
arch-specific builds (from another build driver than dpkg-buildpackage),
we filter based on this.
---
debian/changelog | 4 ++++
scripts/dpkg-genbuildinfo.pl | 14 +++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index d582817..549a630 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,10 @@ dpkg (1.18.24) UNRELEASED; urgency=medium
when printing the error message, to ease debugging those problems after
the fact. Closes: #813454, #860238
Based on a patch by Bastien ROUCARIÈS <roucaries.bastien at gmail.com>.
+ * Add duplicate prevention code for debian/files to dpkg-genbuildinfo, so
+ that successive runs with different versions and equivalent build types
+ do not generate multiple .buildinfo entries to be uploaded, which is
+ similar to what dpkg-gencontrol is doing for .deb files.
* Architecture support:
- Add support for ARM64 ILP32. Closes: #824742
Thanks to Wookey <wookey at wookware.org>.
diff --git a/scripts/dpkg-genbuildinfo.pl b/scripts/dpkg-genbuildinfo.pl
index 27bf7dc..c7d6cb1 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 get_host_arch);
+use Dpkg::Arch qw(get_build_arch get_host_arch debarch_eq);
use Dpkg::Build::Types;
use Dpkg::Build::Info qw(get_build_env_whitelist);
use Dpkg::BuildOptions;
@@ -475,6 +475,18 @@ if ($stdout) {
$dist = Dpkg::Dist::Files->new();
$dist->load($fileslistfile) if -e $fileslistfile;
+
+ foreach my $file ($dist->get_files()) {
+ if (defined $file->{package} &&
+ $file->{package} eq $spackage &&
+ $file->{package_type} eq 'buildinfo' &&
+ (debarch_eq($file->{arch}, $fields->{'Architecture'}) ||
+ debarch_eq($file->{arch}, 'all') ||
+ debarch_eq($file->{arch}, 'source'))) {
+ $dist->del_file($file->{filename});
+ }
+ }
+
$dist->add_file($buildinfo, $section, $priority);
$dist->save("$fileslistfile.new");
--
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