From a610abc6fca411e3e03f9e580c2152470d706bda Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Fri, 16 Aug 2019 19:07:06 +0000 Subject: Generalize and move logic for filtering out arch-only helpers Signed-off-by: Niels Thykier --- dh | 3 --- lib/Debian/Debhelper/Sequence.pm | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dh b/dh index a44bd12d..bffa6606 100755 --- a/dh +++ b/dh @@ -418,9 +418,6 @@ qw{ dh_makeshlibs dh_shlibdeps })); -if (! getpackages("arch")) { - @ba=(); -} my @b=qw{ dh_installdeb dh_gencontrol diff --git a/lib/Debian/Debhelper/Sequence.pm b/lib/Debian/Debhelper/Sequence.pm index fc857055..4fd599b8 100644 --- a/lib/Debian/Debhelper/Sequence.pm +++ b/lib/Debian/Debhelper/Sequence.pm @@ -8,6 +8,7 @@ use warnings; use Exporter qw(import); +use Debian::Debhelper::Dh_Lib qw(getpackages); use Debian::Debhelper::SequencerUtil qw(extract_rules_target_name sequence_type SEQUENCE_NO_SUBSEQUENCES SEQUENCE_ARCH_INDEP_SUBSEQUENCES SEQUENCE_TYPE_ARCH_ONLY SEQUENCE_TYPE_INDEP_ONLY SEQUENCE_TYPE_BOTH); @@ -112,8 +113,12 @@ sub flatten_sequence { my ($this, $sequence_type) = @_; die("Invalid sequence type $sequence_type") if $sequence_type eq SEQUENCE_NO_SUBSEQUENCES; my @cmds; + my $has_arch_pkgs = getpackages("arch") ? 1 : 0; + my $has_indep_pkgs = getpackages("indep") ? 1 : 0; for my $cmd_desc (@{$this->{'_cmds'}}) { my $seq_limitation = $cmd_desc->{'sequence-limitation'}; + next if ($seq_limitation eq SEQUENCE_TYPE_ARCH_ONLY and not $has_arch_pkgs); + next if ($seq_limitation eq SEQUENCE_TYPE_INDEP_ONLY and not $has_indep_pkgs); if ($seq_limitation eq $sequence_type or $sequence_type eq SEQUENCE_TYPE_BOTH or $seq_limitation eq SEQUENCE_TYPE_BOTH) { my $cmd = $cmd_desc->{'command'}; my @cmd_options = $cmd_desc->{'command-options'}; -- cgit v1.2.3