diff options
author | Niels Thykier <niels@thykier.net> | 2019-08-15 10:16:02 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2019-08-15 10:38:38 +0000 |
commit | 4300655ff734dd14551040d61c721838fcbaf7af (patch) | |
tree | 99ea1bbf6b5ffcf7e606b478ca80b14284281015 /dh | |
parent | d3e7d3e0293166ed836ae73073eb5fdd511b8693 (diff) | |
download | debhelper-4300655ff734dd14551040d61c721838fcbaf7af.tar.gz |
Disable auto-abbrev of cli options in c13 to enable dh optimizations
Disable auto-abbreviation of command-line options in compat 13 and
re-enable dh's optimization for skipping redundant commands when
passed long options.
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'dh')
-rwxr-xr-x | dh | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -612,7 +612,7 @@ my %completed_sequences; # Get the options to pass to commands in the sequence. # Filter out options intended only for this program. my (@options, %seen_options); -my ($unoptimizable_user_option, $long_options_seen) = (0, 0); +my ($unoptimizable_user_option, $unoptimizable_option_bundle) = (0, 0); if ($sequence eq 'build-arch' || $sequence eq 'install-arch' || @@ -654,7 +654,13 @@ while (@ARGV_orig) { } if ($opt =~ m/^(--[^=]++)(?:=.*)?$/ or $opt =~ m/^(-[^-])$/) { my $optname = $1; - $long_options_seen = 1 if length($optname) > 2; + if (length($optname) > 2 and (compat(12, 1) or m/^-[^-][^=]/)) { + # We cannot optimize bundled options but we can optimize a single + # short option with an explicit parameter (-B=F is ok, -BF is not) + # In compat 12 or earlier, we also punt on long options due to + # auto-abbreviation. + $unoptimizable_option_bundle = 1 + } $seen_options{$optname} = 1; } else { $unoptimizable_user_option = 1; @@ -1040,7 +1046,7 @@ sub can_skip { # Long options are subject to abbreviations so it is # very difficult to implement this optimization with # long options. - return 0 if $long_options_seen; + return 0 if $unoptimizable_option_bundle; $need =~ s/(?:^|\s)BUILDSYSTEM(?:\s|$)/${\UNSKIPPABLE_CLI_OPTIONS_BUILD_SYSTEM}/; my @behavior_options = split(qr/\Q|\E/, $need); for my $opt (@behavior_options) { |