From 9632cd2bcb01a72f9389f3ef148e2e2b70a4b6ea Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 14 Apr 2016 18:00:52 +0200 Subject: further simplify --- urpm/install.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/urpm/install.pm b/urpm/install.pm index 7c32fa0a..a351c9d8 100644 --- a/urpm/install.pm +++ b/urpm/install.pm @@ -94,7 +94,7 @@ See L for parameters =cut # install logger callback -my ($erase_logger, $index, $total_pkg, $uninst_count); +my ($erase_logger, $index, $total_pkg, $uninst_count, $current_pkg); sub install_logger { my ($urpm, $type, undef, $subtype, $amount, $total) = @_; local $| = 1; @@ -113,7 +113,7 @@ sub install_logger { 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)); + $pname = N("removing %s", $current_pkg); $erase_logger->($urpm, undef, undef, $subtype); } else { $pname = $urpm->{trans}->Element_name($index); @@ -285,14 +285,14 @@ sub _get_callbacks { my ($urpm, undef, undef, $subtype) = @_; if ($subtype eq 'start') { - my ($name, $fullname) = ($trans->Element_name($index), $trans->Element_fullname($index)); + my $name = $trans->Element_name($index); my @previous = map { $trans->Element_name($_) } 0 .. ($index - 1); # looking at previous packages in transaction # we should be looking only at installed packages, but it should not give a different result if (member($name, @previous)) { - $urpm->{log}("removing upgraded package $fullname"); + $urpm->{log}("removing upgraded package $current_pkg"); } else { - $urpm->{print}(N("removing package %s", $fullname)) if $verbose >= 0; + $urpm->{print}(N("removing package %s", $current_pkg)) if $verbose >= 0; } } }; @@ -302,6 +302,7 @@ sub _get_callbacks { $options->{callback_elem} ||= sub { my (undef, undef, undef, undef, $idx, undef) = @_; $index = $idx; + $current_pkg = $trans->Element_fullname($idx); }; $options->{callback_error} ||= sub { my ($urpm, undef, $id, $subtype, undef, undef, $fullname) = @_; -- cgit v1.2.1