summaryrefslogtreecommitdiff
path: root/lib/Debian
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2019-08-18 18:38:33 +0000
committerNiels Thykier <niels@thykier.net>2019-08-18 18:38:33 +0000
commite1d4bccac05c9c8d245cd74308a404c7ff59d0b9 (patch)
tree8edf32973c518b464b3cf673a4968ebbe96f3a5a /lib/Debian
parent024b390510b7237edaa0b88c2492d3e9d93503b4 (diff)
downloaddebhelper-e1d4bccac05c9c8d245cd74308a404c7ff59d0b9.tar.gz
Avoid parsing d/control before handling --help/--list
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'lib/Debian')
-rw-r--r--lib/Debian/Debhelper/Dh_Getopt.pm2
-rw-r--r--lib/Debian/Debhelper/Dh_Lib.pm7
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/Debian/Debhelper/Dh_Getopt.pm b/lib/Debian/Debhelper/Dh_Getopt.pm
index 591f0e22..0f3fb781 100644
--- a/lib/Debian/Debhelper/Dh_Getopt.pm
+++ b/lib/Debian/Debhelper/Dh_Getopt.pm
@@ -95,7 +95,7 @@ sub getoptions {
Getopt::Long::config("bundling");
}
Getopt::Long::config('no_ignore_case');
- if (! compat(12, 1)) {
+ if ( ! -f 'debian/control' or ! compat(12, 1)) {
Getopt::Long::config('no_auto_abbrev');
}
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index 7a55e22f..47cca1fb 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -199,11 +199,13 @@ our $DEB822_FIELD_REGEX = qr/
[\x21-\x39\x3B-\x7F]* # Subsequent characters (if any)
/xoa;
+our $PARSE_DH_SEQUENCE_INFO = 0;
+
sub init {
my %params=@_;
if ($params{internal_parse_dh_sequence_info}) {
- _parse_debian_control(1);
+ $PARSE_DH_SEQUENCE_INFO = 1;
}
# Check if we can by-pass the expensive Getopt::Long by optimising for the
@@ -1587,7 +1589,6 @@ sub getpackages {
}
sub _parse_debian_control {
- my ($parse_dh_sequence_info) = @_;
my $package="";
my $arch="";
my $section="";
@@ -1699,7 +1700,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 ($parse_dh_sequence_info and $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};