diff options
-rw-r--r-- | perl-install/pkgs.pm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 08f3087c6..ab8f2c313 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -1258,12 +1258,19 @@ sub remove { sub selected_leaves { my ($packages) = @_; - my @leaves; + my $provides = $packages->{provides}; - foreach (@{$packages->{depslist}}) { - ($_->flag_requested || $_->flag_installed) && !$_->flag_base and push @leaves, $_->name; + my @l = grep { ($_->flag_requested || $_->flag_installed) && !$_->flag_base } @{$packages->{depslist}}; + + my %required_ids; + foreach (@l) { + foreach ($_->requires_nosense) { + my $h = $provides->{$_} or next; + my @provides = keys %$h; + $required_ids{$provides[0]} = 1 if @provides == 1; + } } - \@leaves; + [ map { $_->name } grep { !$required_ids{$_->id} } @l ]; } sub naughtyServers_list { |