summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2019-08-16 19:16:07 +0000
committerNiels Thykier <niels@thykier.net>2019-08-16 19:18:37 +0000
commitc913956497dc1349115116d5e366c8010f769344 (patch)
treef22c8de5bde3002cf6b5b151b82cd94410ad43c9
parentfdd59b09dd46c80967add12b9acfe8311366b426 (diff)
downloaddebhelper-c913956497dc1349115116d5e366c8010f769344.tar.gz
Dh_Lib: Only parse dh-sequence-X in dh
We do not want to pay a non-trivial cost of loading Dpkg::Deps in every helper (for cases where that is needed to parse th dh-sequence clause). Signed-off-by: Niels Thykier <niels@thykier.net>
-rwxr-xr-xdh1
-rw-r--r--lib/Debian/Debhelper/Dh_Lib.pm7
2 files changed, 7 insertions, 1 deletions
diff --git a/dh b/dh
index bffa6606..f6f9ad7e 100755
--- a/dh
+++ b/dh
@@ -299,6 +299,7 @@ init(options => {
ignore_unknown_options => 1,
# Bundling does not work well since there are unknown options.
bundling => 0,
+ internal_parse_dh_sequence_info => 1,
);
set_buildflags();
reject_obsolete_params();
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index 070f5968..cc7b5b1c 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -201,6 +201,10 @@ our $DEB822_FIELD_REGEX = qr/
sub init {
my %params=@_;
+ if ($params{internal_parse_dh_sequence_info}) {
+ _parse_debian_control(1);
+ }
+
# Check if we can by-pass the expensive Getopt::Long by optimising for the
# common case of "-a" or "-i"
if (scalar(@ARGV) == 1 && ($ARGV[0] eq '-a' || $ARGV[0] eq '-i') &&
@@ -1582,6 +1586,7 @@ sub getpackages {
}
sub _parse_debian_control {
+ my ($parse_dh_sequence_info) = @_;
my $package="";
my $arch="";
my $section="";
@@ -1693,7 +1698,7 @@ sub _parse_debian_control {
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*[)])?(\s*[^\|]+[]>]\s*)?$/) {
+ if ($parse_dh_sequence_info and $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};