summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2013-04-01 13:45:57 +0000
committerThierry Vignaud <tv@mageia.org>2013-04-01 13:45:57 +0000
commitd1fffb9a03a3a5203a2beb98a249c00f47e05ae3 (patch)
tree83f7b790053be4e4501cb9701cb2db522a0ef688
parentaa0521f925500d8117ca5c14f9e5065fb066a0ce (diff)
downloadurpmi-d1fffb9a03a3a5203a2beb98a249c00f47e05ae3.tar
urpmi-d1fffb9a03a3a5203a2beb98a249c00f47e05ae3.tar.gz
urpmi-d1fffb9a03a3a5203a2beb98a249c00f47e05ae3.tar.bz2
urpmi-d1fffb9a03a3a5203a2beb98a249c00f47e05ae3.tar.xz
urpmi-d1fffb9a03a3a5203a2beb98a249c00f47e05ae3.zip
fix package count when a package has a %pretrans scriptlet
(spot by Colin on installing a minimal system with urpmi) callback_open got called one too much (it got called twice for first package which is actually filesystem), thus we bump the index one too much. the call chain is: rpmtsRun() -> runTransScripts() -> rpmteProcess() which says: /* Dont bother opening for elements without pre/posttrans scripts */ But since we now have package ('filesystem') with %pretrans due to /usr migration, it goes further and calls rpmteOpen()->rpmteFDHeader() which notifys us about a package opening in order to get its file descriptor.
-rw-r--r--NEWS2
-rw-r--r--urpm/install.pm6
2 files changed, 4 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 91128987..f2aebaad 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
- library:
o display exceptions that happened while downloading (mga#9529)
+- urpmi:
+ o fix package count when a package has a %pretrans scriptlet
Version 7.23 - 21 March 2013, by Thierry Vignaud
diff --git a/urpm/install.pm b/urpm/install.pm
index e6f120d1..0e132484 100644
--- a/urpm/install.pm
+++ b/urpm/install.pm
@@ -115,11 +115,11 @@ sub install_logger {
$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);
+ $pname = $urpm->{trans}->Element_name($index);
++$urpm->{logger_count} if $pname;
$cnt = $pname ? $urpm->{logger_count} : '-';
}
+ $index++;
my $s = sprintf("%9s: %-22s", $cnt . "/" . $total_pkg, $pname);
print $s;
$s =~ / $/ or printf "\n%9s %-22s", '', '';
@@ -266,7 +266,6 @@ sub _get_callbacks {
my ($callback_open_helper, $callback_close_helper) = ($options->{callback_open_helper}, $options->{callback_close_helper});
$options->{callback_open} = sub {
my ($_data, $_type, $id) = @_;
- $index++;
$callback_open_helper and $callback_open_helper->(@_);
$fh = urpm::sys::open_safe($urpm, '<', $install->{$id} || $upgrade->{$id});
$fh ? fileno $fh : undef;
@@ -295,7 +294,6 @@ sub _get_callbacks {
} else {
$urpm->{print}(N("removing package %s", $fullname)) if $verbose >= 0;
}
- $index++;
}
};