Author: jkupec Date: Fri May 9 17:08:27 2008 New Revision: 10021 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10021&view=rev Log: - set proper exit status after installation/removal failed (bnc #381203) Modified: trunk/zypper/src/zypper-rpm-callbacks.h Modified: trunk/zypper/src/zypper-rpm-callbacks.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-rpm-callbacks.h?rev=10021&r1=10020&r2=10021&view=diff ============================================================================== --- trunk/zypper/src/zypper-rpm-callbacks.h (original) +++ trunk/zypper/src/zypper-rpm-callbacks.h Fri May 9 17:08:27 2008 @@ -94,6 +94,7 @@ { Zypper::instance()->out().progressEnd("run-script", _label, true); Zypper::instance()->out().error(description); + Zypper::instance()->setExitCode(ZYPPER_EXIT_ERR_ZYPP); } /** Report success. */ @@ -142,9 +143,12 @@ virtual void finish( Error error, const std::string & reason ) { Zypper::instance()->out() - .progressEnd("read-installed-packages", _("Reading installed packages")); + .progressEnd("read-installed-packages", _("Reading installed packages"), error != NO_ERROR); if (error != NO_ERROR) + { Zypper::instance()->out().error(zcb_error2str(error, reason)); + Zypper::instance()->setExitCode(ZYPPER_EXIT_ERR_ZYPP); + } } }; @@ -180,15 +184,18 @@ virtual void finish( zypp::Resolvable::constPtr /*resolvable*/, Error error, const std::string & reason ) { - Zypper::instance()->out().progressEnd("remove-resolvable", _label); if (error != NO_ERROR) - Zypper::instance()->out().error(zcb_error2str(error, reason)); + // don't write to output, the error should have been reported in problem() (bnc #381203) + Zypper::instance()->setExitCode(ZYPPER_EXIT_ERR_ZYPP); + else + Zypper::instance()->out().progressEnd("remove-resolvable", _label); } }; ostream& operator << (ostream& stm, zypp::target::rpm::InstallResolvableReport::RpmLevel level) { static const char * level_s[] = { - // TranslatorExplanation --nodeps and --force are options of the rpm command, don't translate + // TranslatorExplanation --nodeps and --force are options of the rpm command, don't translate + //! \todo use format "", _("(with --nodeps)"), _("(with --nodeps --force)") }; return stm << level_s[level]; @@ -225,7 +232,7 @@ if (level < RPM_NODEPS_FORCE) { DBG << "Install failed, will retry more aggressively" - " (with --no-deps, --force)." << std::endl; + " (with --nodeps, --force)." << std::endl; return ABORT; } @@ -247,13 +254,11 @@ return; } - Zypper::instance()->out().progressEnd("remove-resolvable", _label); if (error != NO_ERROR) - { - ostringstream s; - s << level << " " << zcb_error2str(error, reason); - Zypper::instance()->out().error(s.str()); - } + // don't write to output, the error should have been reported in problem() (bnc #381203) + Zypper::instance()->setExitCode(ZYPPER_EXIT_ERR_ZYPP); + else + Zypper::instance()->out().progressEnd("install-resolvable", _label); } }; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org