From 8b43b4db7b04ea053ad86ac5f825395e31d320ec Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sat, 23 Mar 2013 10:54:16 +0000 Subject: display the addionnal space that will be used and the amount of downloaded packages instead of the total size of the packages (like urpmi) --- NEWS | 4 ++++ gurpmi2 | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index fec99578..b047cfe2 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +- gurpmi2: + o display the addionnal space that will be used and the amount of downloaded + packages instead of the total size of the packages (like urpmi) + Version 7.22 - 21 March 2013, by Thierry Vignaud - library: diff --git a/gurpmi2 b/gurpmi2 index 47bc0225..904df619 100755 --- a/gurpmi2 +++ b/gurpmi2 @@ -232,22 +232,23 @@ sub do_install { } sub do_install_2 () { - my @to_install; - my $sum; - foreach my $pkg (sort { $a->name cmp $b->name } @{$urpm->{depslist}}[keys %{$state->{selected}}]) { - if ($pkg->arch ne 'src') { - push @to_install, scalar $pkg->fullname; - $sum += $pkg->size; - } - } + my @to_install = map { scalar $_->fullname } @{$urpm->{depslist}}[sort { $a <=> $b } keys %{$state->{selected}}]; # sorted by medium for format_selected_packages $urpm->{nb_install} = @to_install; + my ($size, $filesize) = $urpm->selected_size_filesize($state); + my $msg2 = $size >= 0 ? + N("%s of additional disk space will be used.", formatXiB($size)) : + N("%s of disk space will be freed.", formatXiB(-$size)); + my $msg2_ = $filesize ? "\n" . N("%s of packages will be retrieved.", formatXiB($filesize)) . "\n" : ''; + my $msg3 = P("Proceed with the installation of one package?", + "Proceed with the installation of the %d packages?", + $urpm->{nb_install}, $urpm->{nb_install}); @to_install > 1 ? ask_continue_if_no_auto( (scalar(@to_install) == 1 ? N("To satisfy dependencies, the following package is going to be installed:") : N("To satisfy dependencies, the following packages are going to be installed:")) . join("\n", '', @to_install, '') - . P("(%d package, %d MB)", "(%d packages, %d MB)", scalar(@to_install), scalar(@to_install), toMb($sum)), + . "\n" . $msg2 . $msg2_ . $msg3, , \&do_install_3) : goto \&do_install_3; } -- cgit v1.2.1