From 4300655ff734dd14551040d61c721838fcbaf7af Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Thu, 15 Aug 2019 10:16:02 +0000 Subject: 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 --- debhelper.pod | 8 ++++++++ debian/changelog | 4 ++++ dh | 12 +++++++++--- lib/Debian/Debhelper/Dh_Getopt.pm | 3 +++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/debhelper.pod b/debhelper.pod index 9d80eb67..dca9a572 100644 --- a/debhelper.pod +++ b/debhelper.pod @@ -944,6 +944,14 @@ B that passes extra parameters to upstream test runner should be reviewed as B is not command line compatible with B. +=item - + +All debhelper like tools based on the official debhelper library +(including B and the official B tools) no longer accepts +abbreviated command parameters. At the same time, B now +optimizes out calls to redundant B helpers even when passed +long command line options. + =back =back diff --git a/debian/changelog b/debian/changelog index 0212db9e..4c92f5dc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,10 @@ debhelper (12.5) UNRELEASED; urgency=medium parameters. They have always worked since debhelper defaulted to supporting auto-abbreviated parameters, so this is simply documenting fait accompli for the most common abbreviation. + * dh_*: Disable auto-abbreviation of command line parameters in compat + 13. + * dh: Optimize out redundant helpers even when passed long options in + compat 13. [ Frank Schaefer ] * dh_installmodules: Also lok for compressed kernel modules diff --git a/dh b/dh index 5cc5bb34..547ad899 100755 --- a/dh +++ b/dh @@ -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) { diff --git a/lib/Debian/Debhelper/Dh_Getopt.pm b/lib/Debian/Debhelper/Dh_Getopt.pm index a35d9588..591f0e22 100644 --- a/lib/Debian/Debhelper/Dh_Getopt.pm +++ b/lib/Debian/Debhelper/Dh_Getopt.pm @@ -95,6 +95,9 @@ sub getoptions { Getopt::Long::config("bundling"); } Getopt::Long::config('no_ignore_case'); + if (! compat(12, 1)) { + Getopt::Long::config('no_auto_abbrev'); + } my @test; my %options=( -- cgit v1.2.3