summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2018-09-29 07:47:03 +0000
committerNiels Thykier <niels@thykier.net>2018-09-29 07:47:03 +0000
commit72ed1d3261730d56da6afde0ec7f52f32976e04d (patch)
tree8b1d5ee4a21e4da944a314c04e9a47be52eda89f
parentb7348f222329db9ad9a8f669850c02572d2e9dad (diff)
downloaddebhelper-72ed1d3261730d56da6afde0ec7f52f32976e04d.tar.gz
dh: Disable cli-options NOOP PROMISE optimization with long options
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/changelog6
-rwxr-xr-xdh7
2 files changed, 12 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 241fc5a8..9b9ff817 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,12 @@ debhelper (11.4.1) UNRELEASED; urgency=medium
* dh_strip: Remove empty /usr/lib/debug directories left over
by dh_dwz. Thanks to Ferenc Wágner for reporting the issue.
(Closes: #909303)
+ * dh: Disable optimization to skip tools based on command-line
+ parameters when dh is passed long options. Since debhelper
+ had implicit support for auto-abbrevation of long options
+ and people have started to rely on it, the optimization in
+ debhelper/11.4 caused regressions. The optimization is
+ still enabled for short options. (Closes: #909704)
[ Josh Triplett ]
* debhelper.pod: Document how to declare the debhelper compat
diff --git a/dh b/dh
index 9b158ead..0fea4422 100755
--- a/dh
+++ b/dh
@@ -644,7 +644,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 = 0;
+my ($unoptimizable_user_option, $long_options_seen) = (0, 0);
if ($sequence eq 'build-arch' ||
$sequence eq 'install-arch' ||
@@ -687,6 +687,7 @@ while (@ARGV_orig) {
}
if ($opt =~ m/^(--[^=]++)(?:=.*)?$/ or $opt =~ m/^(-[^-])$/) {
my $optname = $1;
+ $long_options_seen = 1 if length($optname) > 2;
$seen_options{$optname} = 1;
} else {
$unoptimizable_user_option = 1;
@@ -1069,6 +1070,10 @@ sub can_skip {
return 0 if pkgfile($pkgs, $need) ne '';
} elsif ($type eq 'cli-options') {
$had_cli_options = 1;
+ # Long options are subject to abbreviations so it is
+ # very difficult to implement this optimization with
+ # long options.
+ return 0 if $long_options_seen;
$need =~ s/(?:^|\s)BUILDSYSTEM(?:\s|$)/${\UNSKIPPABLE_CLI_OPTIONS_BUILD_SYSTEM}/;
my @behavior_options = split(qr/\Q|\E/, $need);
for my $opt (@behavior_options) {