diff options
author | Francois Pons <fpons@mandriva.com> | 2002-08-23 13:06:08 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-08-23 13:06:08 +0000 |
commit | 351cb5fbce6d663fc57b3f4662762737d913f116 (patch) | |
tree | 160919ee1ec7bb0b1be113e995005b003214c2ea /URPM.pm | |
parent | be7994d2fd461c3594afb4bad5e0ef7276594a3b (diff) | |
download | perl-URPM-351cb5fbce6d663fc57b3f4662762737d913f116.tar perl-URPM-351cb5fbce6d663fc57b3f4662762737d913f116.tar.gz perl-URPM-351cb5fbce6d663fc57b3f4662762737d913f116.tar.bz2 perl-URPM-351cb5fbce6d663fc57b3f4662762737d913f116.tar.xz perl-URPM-351cb5fbce6d663fc57b3f4662762737d913f116.zip |
0.70-1mdk.0.70
Diffstat (limited to 'URPM.pm')
-rw-r--r-- | URPM.pm | 37 |
1 files changed, 33 insertions, 4 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 { |