aboutsummaryrefslogtreecommitdiffstats
path: root/URPM/Resolve.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-06-13 15:19:41 +0000
committerFrancois Pons <fpons@mandriva.com>2002-06-13 15:19:41 +0000
commit0038d5541dd565f440fabe3dcefa8485b3f8a0fe (patch)
tree9c332fe729f8d9ac3229bbe89406954e395ccf27 /URPM/Resolve.pm
parentfdbc7e991fde345831ff00348962881a91ace094 (diff)
downloadperl-URPM-0038d5541dd565f440fabe3dcefa8485b3f8a0fe.tar
perl-URPM-0038d5541dd565f440fabe3dcefa8485b3f8a0fe.tar.gz
perl-URPM-0038d5541dd565f440fabe3dcefa8485b3f8a0fe.tar.bz2
perl-URPM-0038d5541dd565f440fabe3dcefa8485b3f8a0fe.tar.xz
perl-URPM-0038d5541dd565f440fabe3dcefa8485b3f8a0fe.zip
added compute_installed_flags for yoyotte.
Diffstat (limited to 'URPM/Resolve.pm')
-rw-r--r--URPM/Resolve.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index 7b63be2..9b78d58 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -273,6 +273,29 @@ sub resolve_requested {
delete @{$state->{ask_remove}}{keys %{$state->{obsoleted}}};
}
+#- compute installed flags for all package in depslist.
+sub compute_installed_flags {
+ my ($urpm, $db) = @_;
+
+ #- first pass check according existing package.
+ $db->traverse(sub {
+ my ($p) = @_;
+ foreach (keys %{$urpm->{provides}{$p->name} || {}}) {
+ my $pkg = $urpm->{depslist}[$_];
+ $pkg->name eq $p->name or next;
+ #- compute only installed and upgrade flags.
+ $pkg->set_flag_installed($pkg->compare_pkg($p) <= 0);
+ $pkg->set_flag_upgrade(!$pkg->flag_installed);
+ }
+ });
+
+ #- second pass allow not installed package to be seen as upgrade.
+ foreach (@{$urpm->{depslist}}) {
+ $_->flag_upgrade || $_->flag_installed and next;
+ $_->set_flag_upgrade(1);
+ }
+}
+
#- select packages to upgrade, according to package already registered.
#- by default, only takes best package and its obsoleted and compute
#- all installed or upgrade flag.