diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.com> | 2006-09-05 16:14:15 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.com> | 2006-09-05 16:14:15 +0000 |
commit | 43335ddfcd9e3cb59b292edde9363bfcb37e403f (patch) | |
tree | 36012a0257ac55426abbf11504dedede5d1204a4 /URPM | |
parent | 8419fcf128dd8ee549550ab5f8f541779341553c (diff) | |
download | perl-URPM-43335ddfcd9e3cb59b292edde9363bfcb37e403f.tar perl-URPM-43335ddfcd9e3cb59b292edde9363bfcb37e403f.tar.gz perl-URPM-43335ddfcd9e3cb59b292edde9363bfcb37e403f.tar.bz2 perl-URPM-43335ddfcd9e3cb59b292edde9363bfcb37e403f.tar.xz perl-URPM-43335ddfcd9e3cb59b292edde9363bfcb37e403f.zip |
Micro-optimisation, and make comments more explicit
Diffstat (limited to 'URPM')
-rw-r--r-- | URPM/Resolve.pm | 13 |
1 files 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) { |