aboutsummaryrefslogtreecommitdiffstats
path: root/URPM
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-06-18 16:14:14 +0000
committerFrancois Pons <fpons@mandriva.com>2003-06-18 16:14:14 +0000
commitd08e53b8320807a33d8c6884808d47cea3e6bca5 (patch)
treef0e5dc8493395444315179eef68d19ebde13239f /URPM
parentaac3c8f4e85c25563a79891013fbc456427ef162 (diff)
downloadperl-URPM-d08e53b8320807a33d8c6884808d47cea3e6bca5.tar
perl-URPM-d08e53b8320807a33d8c6884808d47cea3e6bca5.tar.gz
perl-URPM-d08e53b8320807a33d8c6884808d47cea3e6bca5.tar.bz2
perl-URPM-d08e53b8320807a33d8c6884808d47cea3e6bca5.tar.xz
perl-URPM-d08e53b8320807a33d8c6884808d47cea3e6bca5.zip
0.91-4mdk
Diffstat (limited to 'URPM')
-rw-r--r--URPM/Resolve.pm33
1 files changed, 20 insertions, 13 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index 1de44e6..5e5df28 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -412,20 +412,11 @@ sub resolve_requested {
if ($pkg->flag_installed && !$pkg->flag_upgrade) {
my $allow;
#- the same or a more recent package is installed,
- #- but this package may be required explicitely, in such
- #- case we can ask to remove all the previous one and
- #- choose this one to install.
$db->traverse_tag('name', [ $pkg->name ], sub {
my ($p) = @_;
- if ($pkg->compare_pkg($p) < 0) {
- $allow = ++$state->{oldpackage};
- #- avoid recusive rejects, else everything may be removed.
- my $rv = $state->{rejected}{$p->fullname} ||= {};
- $rv->{closure}{$pkg->fullname} = { old_requested => 1 };
- $rv->{removed} = 1;
- }
+ $allow ||= $pkg->compare_pkg($p) < 0;
});
- #- if nothing has been removed, just ignore it.
+ #- if nothing has been found, just ignore it.
$allow or next;
}
}
@@ -466,15 +457,31 @@ sub resolve_requested {
#- examine rpm db too.
$db->traverse_tag('whatprovides', [ $n ], sub {
my ($p) = @_;
- !$o || eval($p->compare($v) . $o . 0) or return;
+ my $satisfied = !$o || eval($p->compare($v) . $o . 0);
+
+ $n eq $p->name && $p->name eq $pkg->name && $p->fullname ne $pkg->fullname ||
+ $satisfied or return;
#- do not propagate now the broken dependencies as they are
#- computed later.
my $rv = $state->{rejected}{$p->fullname} ||= {};
$rv->{closure}{$pkg->fullname} = undef;
- $rv->{obsoleted} = 1;
$rv->{size} = $p->size;
+ if ($p->name eq $pkg->name) {
+ #- all packages older than the current one are obsoleted,
+ #- the others are simply removed (the result is the same).
+ if ($satisfied) {
+ $rv->{obsoleted} = 1;
+ } else {
+ $rv->{closure}{$pkg->fullname} = { old_requested => 1 };
+ $rv->{removed} = 1;
+ ++$state->{oldpackage};
+ }
+ } else {
+ $rv->{obsoleted} = 1;
+ }
+
foreach ($p->provides) {
#- check differential provides between obsoleted package and newer one.
if (my ($pn, $ps) = /^([^\s\[]*)(?:\[\*\])?\[?([^\s\]]*\s*[^\s\]]*)/) {