diff options
-rw-r--r-- | perl-install/pkgs.pm | 13 |
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 { |