From e731c1fcca81470e08f81ded165243bc5f05f8d0 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 1 May 2016 17:20:16 +0200 Subject: Dpkg::Build::Types: Allow disabling the checks in set_build_type() This makes it possible to test the different code paths. --- scripts/Dpkg/Build/Types.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'scripts/Dpkg/Build/Types.pm') diff --git a/scripts/Dpkg/Build/Types.pm b/scripts/Dpkg/Build/Types.pm index 9f19c77e8..7f6f1bc65 100644 --- a/scripts/Dpkg/Build/Types.pm +++ b/scripts/Dpkg/Build/Types.pm @@ -160,19 +160,23 @@ sub build_is return $current_type == $bits; } -=item set_build_type($build_type, $build_option) +=item set_build_type($build_type, $build_option, %opts) Set the current build type to $build_type, which was specified via the $build_option command-line option. +The function will check and abort on incompatible build type assignments, +this behavior can be disabled by using the boolean option "nocheck". + =cut sub set_build_type { - my ($build_type, $build_option) = @_; + my ($build_type, $build_option, %opts) = @_; usageerr(g_('cannot combine %s and %s'), $current_option, $build_option) - if build_has_none(BUILD_DEFAULT) and $current_type != $build_type; + if not $opts{nocheck} and + build_has_none(BUILD_DEFAULT) and $current_type != $build_type; $current_type = $build_type; $current_option = $build_option; -- cgit v1.2.3