From 9aec64a16c4ea5e8e40ca5f1b0d078bd69a8c0e0 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Mon, 7 Jul 2003 15:14:05 +0000 Subject: 0.91-9mdk --- URPM/Resolve.pm | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'URPM') diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index fb7f8b8..612e69c 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -141,7 +141,8 @@ sub unsatisfied_requires { my ($urpm, $db, $state, $pkg, %options) = @_; my %properties; - #- all requires should be satisfied according to selected package, or installed packages. + #- all requires should be satisfied according to selected packages or installed packages, + #- or the package itself. REQUIRES: foreach my $dep ($pkg->requires) { if (my ($n, $s) = $dep =~ /^([^\s\[]*)(?:\[\*\])?\[?([^\s\]]*\s*[^\s\]]*)/) { #- allow filtering on a given name (to speed up some search). @@ -170,6 +171,11 @@ sub unsatisfied_requires { } } + #- check if the package itself provides what is necessary. + foreach ($pkg->provides) { + ranges_overlap($_, $dep) and next REQUIRES; + } + #- check on installed system a package which is not obsoleted is satisfying the require. my $satisfied = 0; if ($n =~ /^\//) { @@ -512,28 +518,25 @@ sub resolve_requested { foreach my $n (keys %diff_provides) { $db->traverse_tag('whatrequires', [ $n ], sub { my ($p) = @_; - if (my @l = $urpm->unsatisfied_requires($db, $state, $p, nopromoteepoch => 0)) { - #- try if upgrading the package will be satisfying all the requires - #- else it will be necessary to ask the user for removing it. - my $packages = $urpm->find_candidate_packages($p->name, - nopromoteepoch => 0, - avoided => $state->{rejected}); + if (my @l = $urpm->unsatisfied_requires($db, $state, $p, nopromoteepoch => 1, name => $n)) { + #- try if upgrading the package will be satisfying all the requires... + #- there is no need to avoid promoting epoch as the package examined is not + #- already installed. + my $packages = $urpm->find_candidate_packages($p->name, avoided => $state->{rejected}); my $best = join '|', map { $_->id } grep { $_->fullname ne $p->fullname && - $urpm->unsatisfied_requires($db, $state, $_, - nopromoteepoch => 0, - name => $n) == 0 } + $urpm->unsatisfied_requires($db, $state, $_, name => $n) == 0 } @{$packages->{$p->name}}; if (length $best) { push @properties, { required => $best, promote => $n, psel => $pkg }; } else { #- no package have been found, we may need to remove the package examined unless - #- there exists a package that provided the unsatisfied requires. + #- there exists enough packages that provided the unsatisfied requires. my @best; foreach (@l) { $packages = $urpm->find_candidate_packages($_, - nopromoteepoch => 0, + nopromoteepoch => 1, avoided => $state->{rejected}); $best = join('|', map { $_->id } -- cgit v1.2.1