summaryrefslogtreecommitdiffstats
path: root/urpm/select.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-06-07 18:22:35 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-06-07 18:22:35 +0000
commit0ca6719f421a9c5ac971f30fcd9a20782f38435a (patch)
treec246022b5b8688d3a4444945d093fdcfc82a440d /urpm/select.pm
parent8a79470e525a0c0523953cafa526e7c56647ddaf (diff)
downloadurpmi-0ca6719f421a9c5ac971f30fcd9a20782f38435a.tar
urpmi-0ca6719f421a9c5ac971f30fcd9a20782f38435a.tar.gz
urpmi-0ca6719f421a9c5ac971f30fcd9a20782f38435a.tar.bz2
urpmi-0ca6719f421a9c5ac971f30fcd9a20782f38435a.tar.xz
urpmi-0ca6719f421a9c5ac971f30fcd9a20782f38435a.zip
- urpmi
o prefer best architecture over exact name (eg: urpmi libfoo-devel prefers lib64foo-devel over libfoo-devel) - add function min()
Diffstat (limited to 'urpm/select.pm')
-rw-r--r--urpm/select.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/urpm/select.pm b/urpm/select.pm
index 4b6f90a8..16aa2e87 100644
--- a/urpm/select.pm
+++ b/urpm/select.pm
@@ -51,6 +51,16 @@ sub search_packages {
? $_ : @{[]};
} $urpm->packages_providing($v))
{
+ #- find the lowest value of is_arch_compat
+ my %compats;
+ push @{$compats{$_->is_arch_compat}}, $_ foreach @l;
+
+ delete $compats{0}; #- means not compatible
+ #- if there are pkgs matching arch, prefer them
+ if (%compats) {
+ @l = @{$compats{min(keys %compats)}};
+ }
+
#- we assume that if there is at least one package providing
#- the resource exactly, this should be the best one; but we
#- first check if one of the packages has the same name as searched.