diff options
author | Francois Pons <fpons@mandriva.com> | 2003-07-07 15:14:05 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2003-07-07 15:14:05 +0000 |
commit | 9aec64a16c4ea5e8e40ca5f1b0d078bd69a8c0e0 (patch) | |
tree | af298d664140eac50be4bb79c5e3c6754fd3b246 /URPM/Resolve.pm | |
parent | d1929249644079544e9ff985746d13125893c5a3 (diff) | |
download | perl-URPM-9aec64a16c4ea5e8e40ca5f1b0d078bd69a8c0e0.tar perl-URPM-9aec64a16c4ea5e8e40ca5f1b0d078bd69a8c0e0.tar.gz perl-URPM-9aec64a16c4ea5e8e40ca5f1b0d078bd69a8c0e0.tar.bz2 perl-URPM-9aec64a16c4ea5e8e40ca5f1b0d078bd69a8c0e0.tar.xz perl-URPM-9aec64a16c4ea5e8e40ca5f1b0d078bd69a8c0e0.zip |
0.91-9mdk
Diffstat (limited to 'URPM/Resolve.pm')
-rw-r--r-- | URPM/Resolve.pm | 27 |
1 files changed, 15 insertions, 12 deletions
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 } |