summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-08-09 17:17:43 +0000
committerFrancois Pons <fpons@mandriva.com>2002-08-09 17:17:43 +0000
commit8d71f7e07c4e5413924052e46286ded0788a8b30 (patch)
tree6115d0c2ee0c700701ebddaf54266c3679a22eee
parent16081dbe0b2a41c9eb00fec7a566c17d0721a81e (diff)
downloaddrakx-8d71f7e07c4e5413924052e46286ded0788a8b30.tar
drakx-8d71f7e07c4e5413924052e46286ded0788a8b30.tar.gz
drakx-8d71f7e07c4e5413924052e46286ded0788a8b30.tar.bz2
drakx-8d71f7e07c4e5413924052e46286ded0788a8b30.tar.xz
drakx-8d71f7e07c4e5413924052e46286ded0788a8b30.zip
take care of packages already installed that will be removed (untested).
-rw-r--r--perl-install/pkgs.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index e7170831a..cf33d6a12 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -96,9 +96,17 @@ sub invCorrectSize { ($_[0] - $C) / $B }
sub selectedSize {
my ($packages) = @_;
my $size = 0;
+ #- take care of packages selected...
foreach (@{$packages->{depslist}}) {
$_->flag_selected and $size += $_->size;
}
+ #- but remove size of package being obsoleted or removed.
+ foreach (keys %{$packages->{state}{obsoleted}}) {
+ /(.*)\.[^\.]*$/ and $size -= $packages->{sizes}{$1};
+ }
+ foreach (keys %{$packages->{state}{ask_remove}}) {
+ $size -= $packages->{sizes}{$_};
+ }
$size;
}
sub correctedSelectedSize { correctSize(selectedSize($_[0]) / sqr(1024)) }
@@ -780,8 +788,9 @@ sub cleanOldRpmDb {
sub selectPackagesAlreadyInstalled {
my ($packages, $prefix) = @_;
- log::l("computing installed flags only");
- $packages->compute_installed_flags($packages->{rpmdb});
+ log::l("computing installed flags and size of installed packages");
+ $packages->{sizes} = $packages->compute_installed_flags($packages->{rpmdb});
+ ref $packages->{sizes} or $packages->{sizes} = {}; #- safe guard for right perl-URPM TO BE REMOVED SOON
}
sub selectPackagesToUpgrade {