From 43335ddfcd9e3cb59b292edde9363bfcb37e403f Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Tue, 5 Sep 2006 16:14:15 +0000 Subject: Micro-optimisation, and make comments more explicit --- URPM/Resolve.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 886872e..6a2f96b 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -112,7 +112,8 @@ sub find_chosen_packages { #- required). #- If there is no preference, choose the first one by default (higher #- probability of being chosen) and ask the user. - #- Takes better architectures into account. + #- Packages with more compatibles architectures are always preferred. + #- Puts the results in @chosen. Other are left unordered. foreach my $p (values(%packages)) { unless ($p->flag_upgrade || $p->flag_installed) { #- assume for this small algorithm package to be upgradable. @@ -144,10 +145,14 @@ sub find_chosen_packages { push @chosen, $p; } - #- if several packages are installed, trim the choices. - if (!$urpm->{options}{morechoices} && $install && @chosen > 1) { @chosen = ($chosen[0]) } + #- if several packages were selected to match a requested installation, + #- and if --more-choices wasn't given, trim the choices to the first one. + if (!$urpm->{options}{morechoices} && $install && @chosen > 1) { + return ($chosen[0]); + } - #- packages that require locales-xxx when the corresponding locales are + #- Now we split @chosen in priority lists depending on locale. + #- Packages that require locales-xxx when the corresponding locales are #- already installed should be preferred over packages that require locales #- which are not installed. foreach (@chosen) { -- cgit v1.2.1