[dpkg] 104/187: Dpkg::Build::Type: Always map the build type to the shortest string form
Reiner Herrmann
reiner at reiner-h.de
Sun Nov 6 12:46:30 UTC 2016
This is an automated email from the git hooks/post-receive script.
deki-guest pushed a commit to branch master
in repository dpkg.
commit bc4ceb7af5ee80eb8f13852251f2b351f59ef06d
Author: Guillem Jover <guillem at debian.org>
Date: Wed Oct 5 04:11:36 2016 +0200
Dpkg::Build::Type: Always map the build type to the shortest string form
We should try to map to the shortest string to make life easier.
---
debian/changelog | 2 ++
scripts/Dpkg/Build/Types.pm | 12 ++++++++----
scripts/t/Dpkg_Build_Types.t | 6 +++---
scripts/t/dpkg_buildpackage.t | 2 --
4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 4386bcf..025b4ba 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -60,6 +60,8 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
- Prefix private Dpkg::Source::Package::* functions with _.
- Defer filehandle closures in Dpkg::IPC::spawn() to avoid double-close.
Closes: #839905, #840293
+ - Always map the build type to the shortest string form in
+ Dpkg::Build::Type::get_build_options_from_type().
* Packaging:
- Add liblocale-gettext-perl to libdpkg-perl Recommends.
- Wrap and document dependency relationships.
diff --git a/scripts/Dpkg/Build/Types.pm b/scripts/Dpkg/Build/Types.pm
index 9a921fa..45a81d3 100644
--- a/scripts/Dpkg/Build/Types.pm
+++ b/scripts/Dpkg/Build/Types.pm
@@ -100,13 +100,13 @@ use constant BUILD_FULL => BUILD_BINARY | BUILD_SOURCE;
my $current_type = BUILD_FULL | BUILD_DEFAULT;
my $current_option = undef;
-my @build_types = qw(source any all);
+my @build_types = qw(full source binary any all);
my %build_types = (
full => BUILD_FULL,
source => BUILD_SOURCE,
+ binary => BUILD_BINARY,
any => BUILD_ARCH_DEP,
all => BUILD_ARCH_INDEP,
- binary => BUILD_BINARY,
);
=back
@@ -224,11 +224,15 @@ Get the current build type as a set of comma-separated string options.
sub get_build_options_from_type
{
- return 'full' if build_has_all(BUILD_FULL);
+ my $local_type = $current_type;
my @parts;
foreach my $type (@build_types) {
- push @parts, $type if build_has_all($build_types{$type});
+ my $part_bits = $build_types{$type};
+ if (($local_type & $part_bits) == $part_bits) {
+ push @parts, $type;
+ $local_type &= ~$part_bits;
+ }
}
return join ',', @parts;
diff --git a/scripts/t/Dpkg_Build_Types.t b/scripts/t/Dpkg_Build_Types.t
index 857e6e9..7fa70cc 100644
--- a/scripts/t/Dpkg_Build_Types.t
+++ b/scripts/t/Dpkg_Build_Types.t
@@ -26,18 +26,18 @@ ok(build_is(BUILD_DEFAULT | BUILD_FULL), 'build is default full');
is(get_build_options_from_type(), 'full', 'build is full');
set_build_type(BUILD_DEFAULT | BUILD_BINARY, '--default-binary');
-is(get_build_options_from_type(), 'any,all', 'build is any,all');
+is(get_build_options_from_type(), 'binary', 'build is binary');
ok(build_is(BUILD_DEFAULT | BUILD_BINARY), 'build is default binary');
set_build_type(BUILD_SOURCE | BUILD_ARCH_INDEP, '--build=source,all');
is(get_build_options_from_type(), 'source,all', 'build is source,all');
set_build_type_from_options('any,all', '--build=any,all', nocheck => 1);
-is(get_build_options_from_type(), 'any,all', 'build is any,all');
+is(get_build_options_from_type(), 'binary', 'build is binary from any,all');
ok(build_is(BUILD_BINARY), 'build is any,all');
set_build_type_from_options('binary', '--build=binary', nocheck => 1);
-is(get_build_options_from_type(), 'any,all', 'build is binary');
+is(get_build_options_from_type(), 'binary', 'build is binary');
ok(build_is(BUILD_BINARY), 'build is binary');
set_build_type_from_options('source,all', '--build=source,all', nocheck => 1);
diff --git a/scripts/t/dpkg_buildpackage.t b/scripts/t/dpkg_buildpackage.t
index 4d87c03..a369665 100644
--- a/scripts/t/dpkg_buildpackage.t
+++ b/scripts/t/dpkg_buildpackage.t
@@ -176,8 +176,6 @@ sub test_build
set_build_type($type, 'buildtype', nocheck => 1);
my $typename = get_build_options_from_type();
- $typename = 'full' if $typename eq 'source,any,all';
- $typename = 'binary' if $typename eq 'any,all';
chdir $dirname;
spawn(exec => [ "$srcdir/dpkg-buildpackage.pl", '--host-arch=amd64',
--
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