diff options
-rw-r--r-- | URPM.pm | 37 | ||||
-rw-r--r-- | perl-URPM.spec | 7 |
2 files changed, 38 insertions, 6 deletions
@@ -22,16 +22,45 @@ sub search { my ($urpm, $name, %options) = @_; my $best = undef; - foreach (keys %{$urpm->{provides}{$name} || {}}) { + #- tries other alternative if no strict searching. + unless ($options{strict}) { + if ($name =~ /^(.*)-([^\-]*)-([^\-]*)\.([^\.\-]*)$/) { + foreach (keys %{$urpm->{provides}{$1} || {}}) { + my $pkg = $urpm->{depslist}[$_]; + $pkg->fullname eq $name and return $pkg; + } + } + if ($name =~ /^(.*)-([^\-]*)-([^\-]*)$/) { + foreach (keys %{$urpm->{provides}{$1} || {}}) { + my $pkg = $urpm->{depslist}[$_]; + my ($n, $v, $r, $a) = $pkg->fullname; + $options{src} && $a eq 'src' || $pkg->is_arch_compat or next; + $n eq $1 or next; + !$best || $pkg->compare_pkg($best) > 0 and $best = $pkg; + } + $best and return $best; + } + if ($name =~ /^(.*)-([^\-]*)$/) { + foreach (keys %{$urpm->{provides}{$1} || {}}) { + my $pkg = $urpm->{depslist}[$_]; + my ($n, $v, $r, $a) = $pkg->fullname; + $options{src} && $a eq 'src' || $pkg->is_arch_compat or next; + $n eq $1 or next; + !$best || $pkg->compare_pkg($best) > 0 and $best = $pkg; + } + $best and return $best; + } + } + + foreach (keys %{$urpm->{provides}{$_} || {}}) { my $pkg = $urpm->{depslist}[$_]; my ($n, $v, $r, $a) = $pkg->fullname; - $options{src} && $a eq 'src' || $pkg->is_arch_compat or next; - $n eq $name || !$options{strict} && ("$n-$v" eq $name || "$n-$v-$r" eq $name || "$n-$v-$r.$a" eq $name) or next; + $n eq $name or next; !$best || $pkg->compare_pkg($best) > 0 and $best = $pkg; } - $best; + return $best; } sub traverse { diff --git a/perl-URPM.spec b/perl-URPM.spec index 2ed806e..06925e9 100644 --- a/perl-URPM.spec +++ b/perl-URPM.spec @@ -1,7 +1,7 @@ %define name perl-URPM %define real_name URPM -%define version 0.60 -%define release 8mdk +%define version 0.70 +%define release 1mdk %{expand:%%define rpm_version %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' rpm)} @@ -48,6 +48,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Fri Aug 23 2002 François Pons <fpons@mandrakesoft.com> 0.70-1mdk +- fixed search method to work correctly. + * Tue Aug 13 2002 François Pons <fpons@mandrakesoft.com> 0.60-8mdk - fixed request_packages_to_upgrade no more working correctly. |