aboutsummaryrefslogtreecommitdiffstats
path: root/URPM/Resolve.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-08-06 15:04:16 +0000
committerFrancois Pons <fpons@mandriva.com>2002-08-06 15:04:16 +0000
commitc53d099f289f0857c81b85a8020b3baffe0d1cc5 (patch)
tree89b57dbab0af2604226719f5cc5935db742e06b1 /URPM/Resolve.pm
parentbbd74ab99a912ccce2e13be10ded0ef71ec59305 (diff)
downloadperl-URPM-c53d099f289f0857c81b85a8020b3baffe0d1cc5.tar
perl-URPM-c53d099f289f0857c81b85a8020b3baffe0d1cc5.tar.gz
perl-URPM-c53d099f289f0857c81b85a8020b3baffe0d1cc5.tar.bz2
perl-URPM-c53d099f289f0857c81b85a8020b3baffe0d1cc5.tar.xz
perl-URPM-c53d099f289f0857c81b85a8020b3baffe0d1cc5.zip
0.60-2mdk
Diffstat (limited to 'URPM/Resolve.pm')
-rw-r--r--URPM/Resolve.pm42
1 files changed, 25 insertions, 17 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index 04c47bc..07f2f18 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -142,7 +142,7 @@ sub resolve_requested {
#- package present or by a new package to upgrade), then requires not satisfied and
#- finally conflicts that will force a new upgrade or a remove.
while (defined ($dep = shift @properties)) {
- my (@chosen_requested, @chosen_upgrade, @chosen, %diff_provides, $pkg);
+ my (@chosen, %diff_provides, $pkg);
#- take the best package for each choices of same name.
my $packages = $urpm->find_candidate_packages($dep);
foreach (values %$packages) {
@@ -164,6 +164,7 @@ sub resolve_requested {
$_ = $best_requested || $best;
}
if (keys(%$packages) > 1) {
+ my (@chosen_requested_upgrade, @chosen_requested, @chosen_upgrade);
#- package should be prefered if one of their provides is referenced
#- in requested hash or package itself is requested (or required).
#- if there is no preference choose the first one (higher probability
@@ -172,27 +173,34 @@ sub resolve_requested {
$p or next; #- this could happen if no package are suitable for this arch.
exists $state->{obsoleted}{$p->fullname} and next; #- avoid taking what is removed (incomplete).
exists $state->{selected}{$p->id} and $pkg = $p, last; #- already selected package is taken.
- if (exists $requested{$p->id}) {
- push @chosen_requested, $p; #- this only works if id (or choices of id) are used in requested.
- } else {
- unless ($p->flag_upgrade || $p->flag_installed) {
- #- assume for this small algorithm package to be upgradable.
- $p->set_flag_upgrade;
- $db->traverse_tag('name', [ $p->name ], sub {
- my ($pp) = @_;
- $p->set_flag_installed;
- $p->flag_upgrade and $p->set_flag_upgrade($p->compare_pkg($pp) > 0);
- });
- }
- if ($p->flag_installed) {
+ unless ($p->flag_upgrade || $p->flag_installed) {
+ #- assume for this small algorithm package to be upgradable.
+ $p->set_flag_upgrade;
+ $db->traverse_tag('name', [ $p->name ], sub {
+ my ($pp) = @_;
+ $p->set_flag_installed;
+ $p->flag_upgrade and $p->set_flag_upgrade($p->compare_pkg($pp) > 0);
+ });
+ }
+ if ($p->flag_installed) {
+ if (exists $requested{$p->id}) {
+ push @chosen_requested_upgrade, $p;
+ } else {
push @chosen_upgrade, $p;
+ }
+ } else {
+ if (exists $requested{$p->id}) {
+ push @chosen_requested, $p;
} else {
push @chosen, $p;
}
}
}
- @chosen_requested > 0 and @chosen = @chosen_requested;
- @chosen_requested == 0 and @chosen_upgrade > 0 and @chosen = @chosen_upgrade;
+ if (@chosen_requested_upgrade > 0 || @chosen_requested > 0) {
+ @chosen = @chosen_requested_upgrade > 0 ? @chosen_requested_upgrade : @chosen_requested;
+ } else {
+ @chosen_upgrade > 0 and @chosen = @chosen_upgrade;
+ }
} else {
@chosen = values %$packages;
}
@@ -274,7 +282,7 @@ sub resolve_requested {
}
#- check differential provides between obsoleted package and newer one.
if (my ($pn, $ps) = /^([^\s\[]*)(?:\[\*\])?\[?([^\s\]]*\s*[^\s\]]*)/) {
- ($state->{provided}{$pn} || {})->{$ps} or $diff_provides{$_} = undef;
+ ($state->{provided}{$pn} || {})->{$ps} or $diff_provides{$pn} = undef;
}
}
});