summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Build/Types.pm
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-11-26 14:00:30 +0300
committerIgor Pashev <pashev.igor@gmail.com>2019-11-26 14:00:30 +0300
commit414ea1706306e061fc44a8b5ce3042d4f0728489 (patch)
treeef0b2c4eac79e479ed686a5d88d7b3b954717824 /scripts/Dpkg/Build/Types.pm
parented2b463626bd721942143baa6207f2ccac67a616 (diff)
parent89afa9af7cd589eb8384ed96b6d86dd59d56bdf5 (diff)
downloaddpkg-414ea1706306e061fc44a8b5ce3042d4f0728489.tar.gz
Merge https://salsa.debian.org/dpkg-team/dpkg
Diffstat (limited to 'scripts/Dpkg/Build/Types.pm')
-rw-r--r--scripts/Dpkg/Build/Types.pm37
1 files changed, 35 insertions, 2 deletions
diff --git a/scripts/Dpkg/Build/Types.pm b/scripts/Dpkg/Build/Types.pm
index 45a81d3ba..9fd0344df 100644
--- a/scripts/Dpkg/Build/Types.pm
+++ b/scripts/Dpkg/Build/Types.pm
@@ -33,6 +33,7 @@ our @EXPORT = qw(
build_is
set_build_type
set_build_type_from_options
+ set_build_type_from_targets
get_build_options_from_type
);
@@ -108,6 +109,15 @@ my %build_types = (
any => BUILD_ARCH_DEP,
all => BUILD_ARCH_INDEP,
);
+my %build_targets = (
+ 'clean' => BUILD_SOURCE,
+ 'build' => BUILD_BINARY,
+ 'build-arch' => BUILD_ARCH_DEP,
+ 'build-indep' => BUILD_ARCH_INDEP,
+ 'binary' => BUILD_BINARY,
+ 'binary-arch' => BUILD_ARCH_DEP,
+ 'binary-indep' => BUILD_ARCH_INDEP,
+);
=back
@@ -193,9 +203,10 @@ sub set_build_type
$current_option = $build_option;
}
-=item set_build_type_from_options($build_type, $build_option, %opts)
+=item set_build_type_from_options($build_types, $build_option, %opts)
-Set the current build type from a list of build type components.
+Set the current build type from a list of comma-separated build type
+components.
The function will check and abort on incompatible build type assignments,
this behavior can be disabled by using the boolean option "nocheck".
@@ -216,6 +227,28 @@ sub set_build_type_from_options
set_build_type($build_type, $build_option, %opts);
}
+=item set_build_type_from_targets($build_targets, $build_option, %opts)
+
+Set the current build type from a list of comma-separated build target
+components.
+
+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_from_targets
+{
+ my ($build_targets, $build_option, %opts) = @_;
+
+ my $build_type = 0;
+ foreach my $target (split /,/, $build_targets) {
+ $build_type |= $build_targets{$target} // BUILD_BINARY;
+ }
+
+ set_build_type($build_type, $build_option, %opts);
+}
+
=item get_build_options_from_type()
Get the current build type as a set of comma-separated string options.