From e93eebce620d5f30ae350b8e7dc79c1ee5633b04 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 12 Aug 2007 13:30:49 +0000 Subject: computeGroupSize(): use packageCallbackChoices() --- perl-install/install/pkgs.pm | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'perl-install/install') diff --git a/perl-install/install/pkgs.pm b/perl-install/install/pkgs.pm index 5322892c5..dbf6c07c6 100644 --- a/perl-install/install/pkgs.pm +++ b/perl-install/install/pkgs.pm @@ -463,7 +463,7 @@ sub computeGroupSize { } join("\t", map { join('&&', @$_) } @r); } - my (%group, %memo, $slowpart_counter); + my (%group, %memo); log::l("install::pkgs::computeGroupSize"); my $time = time(); @@ -496,26 +496,18 @@ sub computeGroupSize { foreach ($pkg->requires_nosense) { my @choices = keys %{$packages->{provides}{$_} || {}}; if (@choices <= 1) { - push @l2, @choices; - } elsif (! find { exists $newSelection{$_} } @choices) { - my ($candidate_id, $prefer_id); - foreach (@choices) { - ++$slowpart_counter; - my $ppkg = $packages->{depslist}[$_] or next; - $ppkg->flag_available and $prefer_id = $candidate_id = undef, last; - exists $preferred{$ppkg->name} and $prefer_id = $_; - $ppkg->name =~ /kernel-\d/ and $prefer_id ||= $_; - foreach my $l ($ppkg->requires_nosense) { - $l =~ /locales-/ or next; - my $pppkg = packageByName($packages, $l) or next; - $pppkg->flag_available and $prefer_id ||= $_; - } - $candidate_id = $_; - } - if (defined $prefer_id || defined $candidate_id) { - push @l2, defined $prefer_id ? $prefer_id : $candidate_id; + #- only one choice :) + } elsif (find { exists $newSelection{$_} } @choices) { + @choices = (); + } else { + my @choices_pkgs = map { $packages->{depslist}[$_] } @choices; + if (find { $_->flag_available } @choices_pkgs) { + @choices = (); #- one package is already selected (?) + } else { + @choices = map { $_->id } packageCallbackChoices($packages, undef, undef, \@choices_pkgs, $_); } } + push @l2, @choices; } } -- cgit v1.2.1