summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2019-07-20 08:06:23 +0000
committerNiels Thykier <niels@thykier.net>2019-07-20 08:06:23 +0000
commitcda77b19e43a00d29e43d4191ec92ecd40d6b850 (patch)
tree800de3bd593e74e259f75ab413efeec89907b744
parent19abeb8750372291d372b5edf3248b768f986ad3 (diff)
downloaddebhelper-cda77b19e43a00d29e43d4191ec92ecd40d6b850.tar.gz
dh: Move an if-elsif chain out of an if and de-indent
Signed-off-by: Niels Thykier <niels@thykier.net>
-rwxr-xr-xdh77
1 files changed, 37 insertions, 40 deletions
diff --git a/dh b/dh
index e3d3c60e..c45b2aea 100755
--- a/dh
+++ b/dh
@@ -1050,50 +1050,47 @@ sub can_skip {
my ($all_pkgs, $had_cli_options);
foreach my $skipinfo (@skipinfo) {
+ my $type = 'pkgfile';
+ my $need = $skipinfo;
if ($skipinfo=~/^([a-zA-Z0-9-_]+)\((.*)\)$/) {
- my $type = $1;
- my $need = $2;
- if ($type eq 'tmp') {
- foreach my $package (@packages) {
- my $tmp = tmpdir($package);
- return 0 if -e "$tmp/$need";
- }
- } elsif ($type eq 'pkgfile' or $type eq 'pkgfile-logged') {
- my $pkgs;
- if ($type eq 'pkgfile') {
- $pkgs = \@packages;
- }
- else {
- $all_pkgs //= [ getpackages() ];
- $pkgs = $all_pkgs;
- }
- # Use the secret bulk check call
- return 0 if pkgfile($pkgs, $need) ne '';
- } elsif ($type eq 'cli-options') {
- $had_cli_options = 1;
- # If cli-options is empty, we no the helper does not
- # react to any thing and can always be skipped.
- next if $need =~ m/^\s*$/;
- # 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) {
- return 0 if exists($seen_options{$opt});
- }
- } elsif ($type eq 'buildsystem') {
- require Debian::Debhelper::Dh_Buildsystems;
- my $system = Debian::Debhelper::Dh_Buildsystems::load_buildsystem(undef, $need);
- return 0 if defined($system);
+ ($type, $need) = ($1, $2);
+ }
+ if ($type eq 'tmp') {
+ foreach my $package (@packages) {
+ my $tmp = tmpdir($package);
+ return 0 if -e "$tmp/$need";
+ }
+ } elsif ($type eq 'pkgfile' or $type eq 'pkgfile-logged') {
+ my $pkgs;
+ if ($type eq 'pkgfile') {
+ $pkgs = \@packages;
} else {
- # Unknown hint - make no assumptions
- return 0;
+ $all_pkgs //= [ getpackages() ];
+ $pkgs = $all_pkgs;
}
- } else {
# Use the secret bulk check call
- return 0 if pkgfile(\@packages, $skipinfo) ne '';
+ return 0 if pkgfile($pkgs, $need) ne '';
+ } elsif ($type eq 'cli-options') {
+ $had_cli_options = 1;
+ # If cli-options is empty, we know the helper does not
+ # react to any thing and can always be skipped.
+ next if $need =~ m/^\s*$/;
+ # 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) {
+ return 0 if exists($seen_options{$opt});
+ }
+ } elsif ($type eq 'buildsystem') {
+ require Debian::Debhelper::Dh_Buildsystems;
+ my $system = Debian::Debhelper::Dh_Buildsystems::load_buildsystem(undef, $need);
+ return 0 if defined($system);
+ } else {
+ # Unknown hint - make no assumptions
+ return 0;
}
}
return 0 if not $had_cli_options and %seen_options;