aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-07-15 16:53:28 +0000
committerFrancois Pons <fpons@mandriva.com>2002-07-15 16:53:28 +0000
commit8193e28941e92205df8d1502594b1b030c8cc27b (patch)
tree9c4c0b728822c99f2a7bc4057efb13577c7e03b1 /URPM.pm
parent8414339f861f1289bdc8cd191a765e8dec195582 (diff)
downloadperl-URPM-8193e28941e92205df8d1502594b1b030c8cc27b.tar
perl-URPM-8193e28941e92205df8d1502594b1b030c8cc27b.tar.gz
perl-URPM-8193e28941e92205df8d1502594b1b030c8cc27b.tar.bz2
perl-URPM-8193e28941e92205df8d1502594b1b030c8cc27b.tar.xz
perl-URPM-8193e28941e92205df8d1502594b1b030c8cc27b.zip
0.10-1mdk0.10
Diffstat (limited to 'URPM.pm')
-rw-r--r--URPM.pm18
1 files changed, 17 insertions, 1 deletions
diff --git a/URPM.pm b/URPM.pm
index e9a0eb2..27187fa 100644
--- a/URPM.pm
+++ b/URPM.pm
@@ -6,7 +6,7 @@ use vars qw($VERSION @ISA);
require DynaLoader;
@ISA = qw(DynaLoader);
-$VERSION = '0.09';
+$VERSION = '0.10';
bootstrap URPM $VERSION;
@@ -18,6 +18,22 @@ sub new {
}, $class;
}
+sub search {
+ my ($urpm, $name, %options) = @_;
+ my $best = undef;
+
+ foreach (keys %{$urpm->{provides}{$name} || {}}) {
+ 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;
+ !$best || $pkg->compare_pkg($best) > 0 and $best = $pkg;
+ }
+
+ $best;
+}
+
sub traverse {
my ($urpm, $callback) = @_;