summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--urpm/select.pm10
-rw-r--r--urpm/util.pm4
3 files changed, 15 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 14d6122d..24d8a5e3 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@
o don't overwrite existing urpmi.cfg with an empty file
when disk is full (#30945)
- urpmi
+ o prefer best architecture over exact name
+ (eg: urpmi libfoo-devel prefers lib64foo-devel over libfoo-devel)
o [bugfix] fix urpmi --parallel (#30996)
o fix "Argument list too long" when calling curl/wget/proz
(things should work even in case of one big transaction) (#30848)
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.
diff --git a/urpm/util.pm b/urpm/util.pm
index 47a89f08..321902b4 100644
--- a/urpm/util.pm
+++ b/urpm/util.pm
@@ -5,7 +5,7 @@ package urpm::util;
use strict;
use Exporter;
our @ISA = 'Exporter';
-our @EXPORT = qw(quotespace unquotespace
+our @EXPORT = qw(min quotespace unquotespace
remove_internal_name
reduce_pathname offset_pathname
untaint
@@ -17,6 +17,8 @@ our @EXPORT = qw(quotespace unquotespace
(our $VERSION) = q($Revision$) =~ /(\d+)/;
+sub min { my $n = shift; $_ < $n and $n = $_ foreach @_; $n }
+
#- quoting/unquoting a string that may be containing space chars.
sub quotespace { my $x = $_[0] || ''; $x =~ s/(\s)/\\$1/g; $x }
sub unquotespace { my $x = $_[0] || ''; $x =~ s/\\(\s)/$1/g; $x }