diff options
author | Guillem Jover <guillem@debian.org> | 2019-03-21 03:11:57 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2019-10-12 16:37:22 +0200 |
commit | c4530cbda9144accd41255da96288ad530554b58 (patch) | |
tree | e76da5e4cc2b47d80145662e1c13b40d7add522a | |
parent | 1046c10897ba54a67ce5bd5760d054e39440a865 (diff) | |
download | dpkg-c4530cbda9144accd41255da96288ad530554b58.tar.gz |
dpkg-genbuildinfo: Do not include irrelevant packages in the Binary field
This change is the companion to the one in dpkg-genchanges that lists
only relevant packages, instead of all the ones listed in debian/control,
but for the .buildinfo file instead of the .changes file.
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | man/deb-buildinfo.man | 3 | ||||
-rwxr-xr-x | scripts/dpkg-genbuildinfo.pl | 12 |
3 files changed, 14 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index 5cf0d7bfe..3e6612de0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium * dpkg-buildpackage: Remove transient backwards R³ compatibility code. * buildtools.mk: Add support for nostrip in DEB_BUILD_OPTIONS when setting the STRIP variable. + * dpkg-genbuildinfo: Do not include irrelevant packages in the Binary field. * Documentation: - man: Fix uncommon wording constructs. * Build system: diff --git a/man/deb-buildinfo.man b/man/deb-buildinfo.man index 6a9d00b40..5f24a2aae 100644 --- a/man/deb-buildinfo.man +++ b/man/deb-buildinfo.man @@ -72,8 +72,9 @@ If the source version differs from the binary version, then the \fIsource-name\fP will be followed by a \fIsource-version\fP in parenthesis. This can happen when the build is for a binary-only non-maintainer upload. .TP -.BR Binary: " \fIbinary-package-list\fP (required)" +.BR Binary: " \fIbinary-package-list\fP (required in context)" This folded field is a space-separated list of binary packages built. +If the build is source-only, then the field is omitted (since dpkg 1.20.0). .TP .BR Architecture: " \fIarch-list\fP (required)" This space-separated field lists the architectures of the files currently diff --git a/scripts/dpkg-genbuildinfo.pl b/scripts/dpkg-genbuildinfo.pl index 827b6679f..5b2cfe6f7 100755 --- a/scripts/dpkg-genbuildinfo.pl +++ b/scripts/dpkg-genbuildinfo.pl @@ -69,6 +69,7 @@ my $buildinfo_format = '1.0'; my $buildinfo; my $checksums = Dpkg::Checksums->new(); +my %distbinaries; my %archadded; my @archvalues; @@ -385,6 +386,15 @@ if (build_has_any(BUILD_BINARY)) { # Make us a bit idempotent. next if $file->{filename} =~ m/\.buildinfo$/; + if (defined $file->{arch}) { + my $arch_all = debarch_eq('all', $file->{arch}); + + next if build_has_none(BUILD_ARCH_INDEP) and $arch_all; + next if build_has_none(BUILD_ARCH_DEP) and not $arch_all; + + $distbinaries{$file->{package}} = 1 if defined $file->{package}; + } + my $path = "$uploadfilesdir/$file->{filename}"; $checksums->add_from_file($path, key => $file->{filename}); @@ -397,7 +407,7 @@ if (build_has_any(BUILD_BINARY)) { $fields->{'Format'} = $buildinfo_format; $fields->{'Source'} = $spackage; -$fields->{'Binary'} = join(' ', map { $_->{'Package'} } $control->get_packages()); +$fields->{'Binary'} = join(' ', sort keys %distbinaries); # Avoid overly long line by splitting over multiple lines. if (length($fields->{'Binary'}) > 980) { $fields->{'Binary'} =~ s/(.{0,980}) /$1\n/g; |