summaryrefslogtreecommitdiffstats
path: root/gurpmi2
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-02-27 20:49:33 +0000
committerThierry Vignaud <tv@mageia.org>2012-02-27 20:49:33 +0000
commit5e8cc5185a12d7d46034c10b214a97b5b9b96eee (patch)
tree63c3175b3585803c36448cdc4f8f5b0ff2835a59 /gurpmi2
parent7ab7fd6abde2b107c3235d9054a0e5c6ceffc922 (diff)
downloadurpmi-5e8cc5185a12d7d46034c10b214a97b5b9b96eee.tar
urpmi-5e8cc5185a12d7d46034c10b214a97b5b9b96eee.tar.gz
urpmi-5e8cc5185a12d7d46034c10b214a97b5b9b96eee.tar.bz2
urpmi-5e8cc5185a12d7d46034c10b214a97b5b9b96eee.tar.xz
urpmi-5e8cc5185a12d7d46034c10b214a97b5b9b96eee.zip
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)
Diffstat (limited to 'gurpmi2')
-rwxr-xr-xgurpmi216
1 files changed, 16 insertions, 0 deletions
diff --git a/gurpmi2 b/gurpmi2
index 754f2e8f..d1989753 100755
--- a/gurpmi2
+++ b/gurpmi2
@@ -106,6 +106,15 @@ my $restart_itself = urpm::select::resolve_dependencies($urpm,
priority_upgrade => $urpm->{options}{'priority-upgrade'},
);
my @ask_unselect = urpm::select::unselected_packages($urpm, $state);
+
+# If there are some unselected packages, designate that we are going to return nonzero code.
+if (@ask_unselect) {
+ my $unselect_msg = N("Some requested packages cannot be installed:\n%s",
+ urpm::select::translate_why_unselected($urpm, $state, @ask_unselect));
+ $urpm::postponed_msg .= $unselect_msg . "\n";
+ $urpm::postponed_code = 17;
+}
+
@ask_unselect
? ask_continue(N(
"Some requested packages cannot be installed:\n%s\nContinue installation anyway?",
@@ -410,6 +419,9 @@ sub do_install_3 () {
}
);
+ # Merge postponed exit code to the result of package installation.
+ $exit_code ||= $urpm::postponed_code;
+
#- restart gurpmi if needed, keep command line for that.
if ($restart_itself && !$exit_code) {
print N("restarting urpmi"), "\n";
@@ -420,6 +432,10 @@ sub do_install_3 () {
grep { !/^--no-priority-upgrade$|--previous-priority-upgrade=/ } @ARGV);
exec $0, @ARGV;
}
+
+ # Show postponed message before exiting
+ $urpm->{error}->($urpm::postponed_msg) if $urpm::postponed_code != 0;
+
exit $exit_code;
}