aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--URPM.pm18
-rw-r--r--URPM.xs8
-rw-r--r--URPM/Resolve.pm11
-rw-r--r--perl-URPM.spec8
4 files changed, 31 insertions, 14 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) = @_;
diff --git a/URPM.xs b/URPM.xs
index a7165bc..fa7c6ba 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1590,6 +1590,14 @@ Pkg_flag_selected(pkg)
RETVAL
int
+Pkg_flag_available(pkg)
+ URPM::Package pkg
+ CODE:
+ RETVAL = pkg->flag & FLAG_INSTALLED || (pkg->flag & FLAG_UPGRADE ? pkg->flag & (FLAG_REQUESTED | FLAG_REQUIRED) : 0);
+ OUTPUT:
+ RETVAL
+
+int
Pkg_rate(pkg)
URPM::Package pkg
CODE:
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index 960ea66..1a0fc12 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -196,17 +196,6 @@ sub resolve_requested {
#- check if package is not already installed before trying to use it, compute
#- obsoleted package too. this is valable only for non source package.
if ($pkg->arch ne 'src') {
- unless ($pkg->flag_upgrade || $pkg->flag_installed) {
- #- assume for this small algorithm package to be upgradable.
- $pkg->set_flag_upgrade;
- $db->traverse_tag('name', [ $pkg->name ], sub {
- my ($p) = @_;
- $pkg->set_flag_installed; #- there is at least one package installed (whatever its version).
- $pkg->flag_upgrade and $pkg->set_flag_upgrade($pkg->compare_pkg($p) > 0);
- });
- }
- $pkg->flag_installed && !$pkg->flag_upgrade and next;
-
#- keep in mind the provides of this package, so that future requires can be satisfied
#- with this package potentially.
foreach ($pkg->provides) {
diff --git a/perl-URPM.spec b/perl-URPM.spec
index 197b979..ebc6a1f 100644
--- a/perl-URPM.spec
+++ b/perl-URPM.spec
@@ -1,7 +1,7 @@
%define name perl-URPM
%define real_name URPM
-%define version 0.09
-%define release 2mdk
+%define version 0.10
+%define release 1mdk
%{expand:%%define rpm_version %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' rpm)}
@@ -48,6 +48,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Mon Jul 15 2002 François Pons <fpons@mandrakesoft.com> 0.10-1mdk
+- added search method for search from name.
+- added composite flag_available method (installed or selected).
+
* Thu Jul 11 2002 François Pons <fpons@mandrakesoft.com> 0.09-2mdk
- fixed ask_unselect computation.
- added clear_state option to relove_requested (rollback state