summaryrefslogtreecommitdiff
path: root/lib/Debian
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2019-08-13 19:15:55 +0000
committerNiels Thykier <niels@thykier.net>2019-08-16 18:46:00 +0000
commitd7c19012163800168b98fd9d35918288b0c9b652 (patch)
treedfb0fdcb1b3fa3a9e5ad4e83fe70a40176765406 /lib/Debian
parent2fd94649173464628cd732ee20834bb634fc62a2 (diff)
downloaddebhelper-d7c19012163800168b98fd9d35918288b0c9b652.tar.gz
Support build-profiles and architecture restrictions for dh-sequence-X build-depends
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'lib/Debian')
-rw-r--r--lib/Debian/Debhelper/Dh_Lib.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index 7e6d0976..0ae27474 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -1691,8 +1691,9 @@ sub getpackages {
error("Could not parse desired debhelper compat level from relation: $dep");
}
# Build-Depends on dh-sequence-<foo> OR dh-sequence-<foo> (<op> <version>)
- if ($dep =~ m/^dh-sequence-(${PKGNAME_REGEX})\s*(?:[(]\s*(?:[<>]?=|<<|>>)\s*(${PKGVERSION_REGEX})\s*[)])?$/) {
+ if ($dep =~ m/^dh-sequence-(${PKGNAME_REGEX})\s*(?:[(]\s*(?:[<>]?=|<<|>>)\s*(?:${PKGVERSION_REGEX})\s*[)])?(\s*[^\|]+[]>]\s*)?$/) {
my $sequence = $1;
+ my $has_profile_or_arch_restriction = $2 ? 1 : 0;
my $addon_type = $field2addon_type{$field};
if (not defined($field)) {
warning("Cannot map ${field} to an add-on type (like \"both\", \"indep\" or \"arch\")");
@@ -1702,6 +1703,13 @@ sub getpackages {
error("Saw $dep multiple times (last time in $field). However dh only support that build-"
. 'dependency at most once across all Build-Depends(-Arch|-Indep) fields');
}
+ if ($has_profile_or_arch_restriction) {
+ require Dpkg::Deps;
+ my $dpkg_dep = Dpkg::Deps::deps_parse($dep, build_profiles => \@profiles, build_dep => 1,
+ reduce_restrictions => 1);
+ # If dpkg reduces it to nothing, then it was not relevant for us after all
+ next if not $dpkg_dep;
+ }
$dh_bd_sequences{$sequence} = $addon_type;
}
}