From 5e8cc5185a12d7d46034c10b214a97b5b9b96eee Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 27 Feb 2012 20:49:33 +0000 Subject: fix urpmi failing silently and with exit status 0 when package installation fails due to either conflicts (mdv#63072) or to unselecting package (inspirated by mdv, mdv#63940) --- urpmi | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'urpmi') diff --git a/urpmi b/urpmi index 8fb1086a..bd1520b2 100755 --- a/urpmi +++ b/urpmi @@ -496,6 +496,9 @@ that are older than the installed ones:\n%s", $list); $msg .= N("\nContinue installation anyway?"); $force || message_input_($msg . N(" (Y/n) "), boolean => 1) !~ /[$noexpr]/ or exit 17; } + # Whatever option we selected, the overall installation should fail if some packages are unselected + $urpm::postponed_msg .= $msg . "\n"; + $urpm::postponed_code = 17; } my @ask_unselect = urpm::select::unselected_packages($urpm, $state); @@ -511,6 +514,9 @@ if (@ask_unselect) { $msg .= N("\nContinue installation anyway?"); $force || message_input_($msg . N(" (Y/n) "), boolean => 1) !~ /[$noexpr]/ or exit 17; } + # Whatever option we selected, the overall installation should fail if some packages are unselected + $urpm::postponed_msg .= $msg . "\n"; + $urpm::postponed_code = 17; } if (my @conflicting_pkgs_msgs = @@ -681,6 +687,9 @@ unless ($env) { urpm::removable::try_umounting_removables($urpm); } +# Merge postponed exit code to the result of package installation. +$exit_code ||= $urpm::postponed_code; + #- restart urpmi if needed, keep command line for that. if ($restart_itself && !$exit_code) { print N("restarting urpmi"), "\n"; @@ -707,4 +716,7 @@ if ($pid_err || $pid_out) { close STDOUT; } +# Show postponed message before exiting +print $urpm::postponed_msg if $urpm::postponed_code != 0; + exit($exit_code); -- cgit v1.2.1