diff options
author | Francois Pons <fpons@mandriva.com> | 2002-06-13 15:19:41 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-06-13 15:19:41 +0000 |
commit | 0038d5541dd565f440fabe3dcefa8485b3f8a0fe (patch) | |
tree | 9c332fe729f8d9ac3229bbe89406954e395ccf27 | |
parent | fdbc7e991fde345831ff00348962881a91ace094 (diff) | |
download | perl-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.
-rw-r--r-- | URPM/Resolve.pm | 23 |
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. |