diff options
author | Thierry Vignaud <tv@mageia.org> | 2013-02-09 12:20:39 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2013-02-09 12:20:39 +0000 |
commit | 9eca2b973e99171862d18c8acf469a620e435924 (patch) | |
tree | d0d0ed6c5cba2ae6fed7df7e58fa5cb8ff7106b5 /urpm/install.pm | |
parent | 2bc79300c87a438c07212112afc08fc5aa4fad89 (diff) | |
download | urpmi-9eca2b973e99171862d18c8acf469a620e435924.tar urpmi-9eca2b973e99171862d18c8acf469a620e435924.tar.gz urpmi-9eca2b973e99171862d18c8acf469a620e435924.tar.bz2 urpmi-9eca2b973e99171862d18c8acf469a620e435924.tar.xz urpmi-9eca2b973e99171862d18c8acf469a620e435924.zip |
(install_logger) keep a separate counter for erasures
only initialize $total_pkg:
- when starting a new transaction
- or on first erasure in transaction
(_compute_pkg_total) kill it (no more needed)
adjust testsuite accordingly
Diffstat (limited to 'urpm/install.pm')
-rw-r--r-- | urpm/install.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/urpm/install.pm b/urpm/install.pm index 9a3ec057..25b96114 100644 --- a/urpm/install.pm +++ b/urpm/install.pm @@ -91,29 +91,33 @@ Standard logger for transactions =cut # install logger callback -my ($erase_logger, $index); +my ($erase_logger, $index, $total_pkg, $uninst_count); sub install_logger { my ($urpm, $type, undef, $subtype, $amount, $total) = @_; - my $total_pkg = $urpm->{nb_install}; local $| = 1; if ($subtype eq 'start') { $urpm->{logger_progress} = 0; if ($type eq 'trans') { + $total_pkg = $urpm->{nb_install}; $urpm->{logger_count} ||= 0; + $uninst_count = 0; my $p = N("Preparing..."); print $p, " " x (33 - length $p); } else { my $pname; + my $cnt; if ($type eq 'uninst') { + $total_pkg = $urpm->{trans}->NElements - $index if !$uninst_count; + $cnt = ++$uninst_count; $pname = N("removing %s", $urpm->{trans}->Element_fullname($index)); $erase_logger->($urpm, undef, undef, $subtype); } else { # index already got bumped in {callback_open}: $pname = $urpm->{trans}->Element_name($index-1); + ++$urpm->{logger_count} if $pname; + $cnt = $pname ? $urpm->{logger_count} : '-'; } - ++$urpm->{logger_count} if $pname; - my $cnt = $pname ? $urpm->{logger_count} : '-'; my $s = sprintf("%9s: %-22s", $cnt . "/" . $total_pkg, $pname); print $s; $s =~ / $/ or printf "\n%9s %-22s", '', ''; |