From d7c19012163800168b98fd9d35918288b0c9b652 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Tue, 13 Aug 2019 19:15:55 +0000 Subject: Support build-profiles and architecture restrictions for dh-sequence-X build-depends Signed-off-by: Niels Thykier --- lib/Debian/Debhelper/Dh_Lib.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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- OR dh-sequence- ( ) - 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; } } -- cgit v1.2.3