From: DongHun Kwak Date: Tue, 10 Jan 2017 05:26:29 +0000 (+0900) Subject: Imported Upstream version 1.11.38 X-Git-Tag: upstream/1.11.38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F68%2F109368%2F1;p=platform%2Fupstream%2Fzypper.git Imported Upstream version 1.11.38 Change-Id: I55ed79a004189ea4e0fcccada99d390863ecb9c0 Signed-off-by: DongHun Kwak --- diff --git a/VERSION.cmake b/VERSION.cmake index 644b7cd..863bdc0 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -34,7 +34,7 @@ # SET(VERSION_MAJOR "1") SET(VERSION_MINOR "11") -SET(VERSION_PATCH "37") +SET(VERSION_PATCH "38") -# LAST RELEASED: 1.11.37 +# LAST RELEASED: 1.11.38 #======= diff --git a/doc/zypper.8 b/doc/zypper.8 index 84c494a..fb12aa9 100644 --- a/doc/zypper.8 +++ b/doc/zypper.8 @@ -2,12 +2,12 @@ .\" Title: zypper .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/09/2015 +.\" Date: 09/29/2015 .\" Manual: ZYPPER .\" Source: SUSE Linux .\" Language: English .\" -.TH "ZYPPER" "8" "09/09/2015" "SUSE Linux" "ZYPPER" +.TH "ZYPPER" "8" "09/29/2015" "SUSE Linux" "ZYPPER" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -3178,6 +3178,13 @@ No repositories are defined\&. The ZYPP library is locked, e\&.g\&. packagekit is running\&. .RE .PP +\fB8\fR \- \fBZYPPER_EXIT_ERR_COMMIT\fR +.RS 4 +An error occurred during installation or removal of packages\&. You may run +\fBzypper verify\fR +to repair any dependency problems\&. +.RE +.PP \fB100\fR \- \fBZYPPER_EXIT_INF_UPDATE_NEEDED\fR .RS 4 Returned by the patch\-check command if there are patches available for installation\&. diff --git a/doc/zypper.8.txt b/doc/zypper.8.txt index f45cd11..abb20bc 100644 --- a/doc/zypper.8.txt +++ b/doc/zypper.8.txt @@ -1606,6 +1606,8 @@ There are several exit codes defined for zypper built-in commands for use e.g. w No repositories are defined. *7* - *ZYPPER_EXIT_ZYPP_LOCKED*:: The ZYPP library is locked, e.g. packagekit is running. +*8* - *ZYPPER_EXIT_ERR_COMMIT*:: + An error occurred during installation or removal of packages. You may run *zypper verify* to repair any dependency problems. *100* - *ZYPPER_EXIT_INF_UPDATE_NEEDED*:: Returned by the patch-check command if there are patches available for installation. *101* - *ZYPPER_EXIT_INF_SEC_UPDATE_NEEDED*:: diff --git a/mkChangelog b/mkChangelog index 0a68545..0c4e4fe 100755 --- a/mkChangelog +++ b/mkChangelog @@ -48,7 +48,13 @@ esac export LC_ALL="" export LANG="en" -EDITOR=${EDITOR:-vi} + +function Edit() +{ + local FILE="$1" + vi "$FILE" + sed -i 's/ \+$//' "$FILE" +} EMAIL="$(git config --get user.email)" @@ -148,7 +154,7 @@ while true; do echo case "${RES:-e}" in [eE]*) - $EDITOR $VERSIONFILE + Edit $VERSIONFILE continue ;; [P]) @@ -182,7 +188,7 @@ trap " [ -f \"$TMPFILE\" ] && /bin/rm -f -- \"$TMPFILE\" " 0 1 2 3 13 15 RES=e while [ "$RES" == "e" ]; do - $EDITOR $TMPFILE + Edit $TMPFILE echo awk '{print}/^----------/{n=n+1; if ( n == 2 ) exit 0; }' $TMPFILE read -n 1 -p "$(Gecho "(a)bort, (c)ontinue, (s)ubmitt, (e)dit : ")" RES diff --git a/package/zypper.changes b/package/zypper.changes index 1e6fab5..5a3c488 100644 --- a/package/zypper.changes +++ b/package/zypper.changes @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Tue Sep 29 18:51:22 CEST 2015 - ma@suse.de + +- Return ZYPPER_EXIT_ERR_COMMIT if an error occurred during commit + (bsc#946750, FATE#319467) +- Do not return 0 if a commit was not performed (bsc#946750, + FATE#319467) +- BuildRequires: libzypp-devel >= 14.42.0 +- version 1.11.38 + +------------------------------------------------------------------- Thu Sep 24 15:11:01 CEST 2015 - ma@suse.de - zypper.conf: new option commit/psCheckAccessDeleted to avoid 'lsof' @@ -109,7 +119,7 @@ Thu Jun 18 19:02:32 CEST 2015 - ma@suse.de - Add git-like subcommand support for zypper. Zypper subcommands are standalone executables that live in the - zypper exec dir or are available in your $PATH (see zypper(8)). + zypper exec dir or are available in your $PATH (see zypper(8)). - version 1.11.33 ------------------------------------------------------------------- @@ -134,7 +144,7 @@ Tue Jun 2 19:52:45 CEST 2015 - ma@suse.de ------------------------------------------------------------------- Mon Jun 1 16:17:02 CEST 2015 - ma@suse.de -- removerepo: Warn user that deleting a service repo is a +- removerepo: Warn user that deleting a service repo is a volatile change (bnc#929990) - version 1.11.30 @@ -165,7 +175,7 @@ Tue Apr 7 12:12:51 CEST 2015 - ma@suse.de ------------------------------------------------------------------- Thu Apr 2 18:25:19 CEST 2015 - ma@suse.de -- Fix prompt returning undefined default value after wrong input +- Fix prompt returning undefined default value after wrong input (bnc#925696) - man: fix typo (bnc#923800) - version 1.11.25 @@ -299,7 +309,7 @@ Sun Jan 18 01:13:20 CET 2015 - ma@suse.de Wed Jan 14 11:30:43 CET 2015 - ma@suse.de - New global option --releasever: Set the value of the $releasever - variable in all .repo files. This can be used to switch to new + variable in all .repo files. This can be used to switch to new distribution repositories when performing a distribution upgrade. (bnc#911658) - BuildRequires: libzypp-devel >= 14.34.0 @@ -449,7 +459,7 @@ Thu Sep 4 01:14:52 CEST 2014 - ma@suse.de ------------------------------------------------------------------- Fri Aug 29 15:06:07 CEST 2014 - ma@suse.de -- download: use $XDG_CACHE_HOME/zypp/packages for non-root user +- download: use $XDG_CACHE_HOME/zypp/packages for non-root user (bnc#891515) - download --dry-run: list packages we would download - Accept -f,--force option with refresh-services(refs) @@ -479,7 +489,7 @@ Fri Jul 25 13:08:33 CEST 2014 - ma@suse.de ------------------------------------------------------------------- Mon Jul 14 17:49:48 CEST 2014 - ma@suse.de -- refresh-services: add option --restore-status to undo user +- refresh-services: add option --restore-status to undo user modifications applied to service repositories - drop rug compatibility in manpage docs and help output (FATE#317708) @@ -510,7 +520,7 @@ Wed May 14 13:58:10 CEST 2014 - ma@suse.de ------------------------------------------------------------------- Thu May 8 19:01:49 CEST 2014 - ma@suse.de -- Notify user about expiring trusted keys; show trusted keys in +- Notify user about expiring trusted keys; show trusted keys in verbose mode. - Enable --with-interactive for update too (bnc#827953) - Highlight missing update repos in product info @@ -616,7 +626,7 @@ Thu Jan 30 01:14:17 CET 2014 - ma@suse.de ------------------------------------------------------------------- Wed Jan 29 10:57:54 CET 2014 - ma@suse.de -- Don't treat missing packages due to download mode as error in +- Don't treat missing packages due to download mode as error in fileconflict check. - Add --replacefiles option to resolve file conflicts (bnc#673720) - version 1.10.4 @@ -905,11 +915,11 @@ Tue Mar 26 08:55:59 CET 2013 - ma@suse.de Tue Mar 19 13:55:03 CET 2013 - ma@suse.de - disable repo permanently if required by user -- also search in file list when searching for a path name in +- also search in file list when searching for a path name in provides (bnc #798290) - add option --verbose to search command (show details about matches) - enable substrings and wildcards for 'info' (bnc #741758) -- add search for provides, requires, conflicts, suggests and obsoletes, +- add search for provides, requires, conflicts, suggests and obsoletes, search for capabilities - version 1.8.13 @@ -970,7 +980,7 @@ Sun Feb 10 01:13:38 CET 2013 - ma@suse.de ------------------------------------------------------------------- Thu Feb 7 14:30:47 CET 2013 - ma@suse.de -- zypper commandline args must not silently overrule locks +- zypper commandline args must not silently overrule locks (bnc#742633,bnc#788863) - version 1.8.10 @@ -987,7 +997,7 @@ Mon Feb 4 12:36:21 CET 2013 - ma@suse.de ------------------------------------------------------------------- Wed Jan 30 12:32:41 CET 2013 - ma@suse.de -- Add '--oldpackage' to allow rollback without malicious --force +- Add '--oldpackage' to allow rollback without malicious --force (bnc#795076) - Add missing --recommends to verify command (bnc#722551) - version 1.8.9 @@ -996,7 +1006,7 @@ Wed Jan 30 12:32:41 CET 2013 - ma@suse.de Fri Jan 18 21:17:52 CET 2013 - ma@suse.de - Add source-download command (fate#313445) -- Fixing permissions is obsolete since zypper refresh wrapper has +- Fixing permissions is obsolete since zypper refresh wrapper has been dropped (bnc#764119) - Fix excess whitespace in install counter (bnc#674572) - version 1.8.8 @@ -1090,7 +1100,7 @@ Sun Oct 28 01:14:13 CEST 2012 - ma@suse.de ------------------------------------------------------------------- Thu Oct 25 18:08:59 CEST 2012 - ma@suse.de -- Fix source-install to accept package names and lookup their +- Fix source-install to accept package names and lookup their source package (bnc#785832) - version 1.8.5 @@ -1208,7 +1218,7 @@ Mon Jun 25 10:29:19 CEST 2012 - ma@suse.de - Fix spacing bug in progress bar (bnc#674572) - consider dual width fonts in output (bnc#766443) -- Don't treat patches with licensed packages as interactive if +- Don't treat patches with licensed packages as interactive if --auto-agree-with-licenses is used (bnc#730824) - version 1.7.3 @@ -1403,7 +1413,7 @@ Tue Jan 10 18:32:11 CET 2012 - ma@suse.de ------------------------------------------------------------------- Tue Jan 10 13:52:48 CET 2012 - ma@suse.de -- Return nonzero (104 - INF_CAP_NOT_FOUND) when query matches no +- Return nonzero (104 - INF_CAP_NOT_FOUND) when query matches no package (bnc#719690) ------------------------------------------------------------------- @@ -1771,7 +1781,7 @@ Wed May 18 10:28:13 CEST 2011 - dheidler@suse.de ------------------------------------------------------------------- Fri May 13 11:38:30 CEST 2011 - ma@suse.de -- fix get_installed_providers by capability not to use selectables +- fix get_installed_providers by capability not to use selectables (bnc#693576) - 1.6.3 @@ -1795,7 +1805,7 @@ Mon Apr 18 08:27:15 UTC 2011 - dmacvicar@suse.de ------------------------------------------------------------------- Fri Apr 15 21:50:24 CEST 2011 - ma@suse.de -- Fix list-patches/updates xml output to include architecture and +- Fix list-patches/updates xml output to include architecture and patch status information (bnc#687529) - Fix search xml output to actually write xml. (bnc#687529) - 1.5.8 @@ -1834,7 +1844,7 @@ Mon Jan 17 11:38:05 CET 2011 - ma@suse.de ------------------------------------------------------------------- Fri Jan 14 12:48:51 CET 2011 - ma@suse.de -- Report service plugin excetions during refresh, but continue. +- Report service plugin excetions during refresh, but continue. ------------------------------------------------------------------- Thu Dec 23 14:49:05 CET 2010 - dheidler@suse.de @@ -2035,7 +2045,7 @@ Thu May 6 18:51:03 CEST 2010 - jkupec@suse.cz ------------------------------------------------------------------- Mon May 3 13:26:06 CEST 2010 - ma@suse.de -- Don't suggest "zypper ps" after update, if zypper itself is the only +- Don't suggest "zypper ps" after update, if zypper itself is the only process with deleted files open. ------------------------------------------------------------------- @@ -2159,7 +2169,7 @@ Fri Feb 19 12:01:39 CET 2010 - jkupec@suse.cz ------------------------------------------------------------------- Wed Feb 10 16:01:15 CET 2010 - ma@suse.de -- Fix 'zypper products' failing to list installed products under +- Fix 'zypper products' failing to list installed products under certain conditions (bnc #578721) - Fix SEGV if $HOME or $PWD are unset in the environment (bnc #578684) - 1.2.17 @@ -2295,7 +2305,7 @@ Fri Nov 6 15:35:46 CET 2009 - jkupec@suse.cz ------------------------------------------------------------------- Fri Nov 6 15:24:22 CET 2009 - ma@suse.de -- al/rl: Support 'kind:name' notation if -t is not given. Also required +- al/rl: Support 'kind:name' notation if -t is not given. Also required to remove a specific lock as rl does not yet support -t. (bnc 551956) ------------------------------------------------------------------- diff --git a/src/PackageArgs.cc b/src/PackageArgs.cc index c7e630e..a5a09a5 100644 --- a/src/PackageArgs.cc +++ b/src/PackageArgs.cc @@ -248,7 +248,7 @@ void PackageArgs::argsToCaps(const zypp::ResKind & kind) zypper.out().error(str::form( _("'%s' is not a package name or capability."), arg.c_str())); zypper.setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS); - ZYPP_THROW(ExitRequestException()); + ZYPP_THROW(ExitRequestException("cli option given after args")); } MIL << "got " << (dont?"un":"") << "wanted '" << parsedcap << "'"; diff --git a/src/Summary.cc b/src/Summary.cc index 1fd7050..4041b72 100644 --- a/src/Summary.cc +++ b/src/Summary.cc @@ -696,7 +696,7 @@ void Summary::writeReinstalled(ostream & out) // if the package updates. Technically every app-package update // is an 'application reinstall', because the providing package // changes. - return; + continue; label = _PL( "The following application is going to be reinstalled:", "The following %d applications are going to be reinstalled:", diff --git a/src/Zypper.cc b/src/Zypper.cc index 84cff9e..87b4074 100644 --- a/src/Zypper.cc +++ b/src/Zypper.cc @@ -836,7 +836,7 @@ void Zypper::processGlobalOptions() { out().error( _("The path specified in the --root option must be absolute.")); - _exit_code = ZYPPER_EXIT_ERR_INVALID_ARGS; + setExitCode( ZYPPER_EXIT_ERR_INVALID_ARGS ); return; } @@ -1175,13 +1175,13 @@ void Zypper::safeDoCommand() catch (const AbortRequestException & ex) { ZYPP_CAUGHT(ex); - // << _("User requested to abort.") << endl; out().error(ex.asUserString()); } catch (const ExitRequestException & e) { - MIL << "Caught exit request:" << endl << e.msg() << endl; + ZYPP_CAUGHT(e); + MIL << "Caught exit request: exitCode " << exitCode() << endl; } catch (const Exception & ex) { @@ -3118,7 +3118,7 @@ void Zypper::doCommand() out().error(excpt_r.asString()); setExitCode(ZYPPER_EXIT_ZYPP_LOCKED); - throw (ExitRequestException("ZYpp locked")); + ZYPP_THROW( ExitRequestException("ZYpp locked") ); } else { @@ -3131,7 +3131,7 @@ void Zypper::doCommand() out().error(e.asString()); setExitCode(ZYPPER_EXIT_ZYPP_LOCKED); - throw (ExitRequestException("ZYpp locked")); + ZYPP_THROW( ExitRequestException("ZYpp locked") ); } } } @@ -3140,7 +3140,7 @@ void Zypper::doCommand() ZYPP_CAUGHT (excpt_r); out().error(excpt_r.msg()); setExitCode(ZYPPER_EXIT_ERR_ZYPP); - throw (ExitRequestException("ZYpp error, cannot get ZYpp lock")); + ZYPP_THROW( ExitRequestException("ZYpp error, cannot get ZYpp lock") ); } } // === execute command === @@ -3879,7 +3879,7 @@ void Zypper::doCommand() "Patches are not installed in sense of copied files, database records,\n" "or similar.")); setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS); - throw ExitRequestException("not implemented"); + ZYPP_THROW( ExitRequestException("not implemented") ); } // can't remove source package @@ -3888,7 +3888,7 @@ void Zypper::doCommand() out().error( _("Uninstallation of a source package not defined and implemented.")); setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS); - throw ExitRequestException("not implemented"); + ZYPP_THROW( ExitRequestException("not implemented") ); } // parse the download options to check for errors @@ -4042,7 +4042,7 @@ void Zypper::doCommand() out().error(str::form(_("%s contradicts %s"), "--capability", (sropts.force ? "--force" : "--name"))); setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS); - ZYPP_THROW(ExitRequestException()); + ZYPP_THROW(ExitRequestException("invalid args")); } if (install_not_remove && sropts.force_by_cap && sropts.force) @@ -4051,7 +4051,7 @@ void Zypper::doCommand() out().error(str::form(_("%s cannot currently be used with %s"), "--force", "--capability")); setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS); - ZYPP_THROW(ExitRequestException()); + ZYPP_THROW(ExitRequestException("invalid args")); } if (install_not_remove && (optit = copts.find("from")) != copts.end()) @@ -4073,7 +4073,7 @@ void Zypper::doCommand() { setExitCode(ZYPPER_EXIT_INF_CAP_NOT_FOUND); if (globalOpts().non_interactive) - ZYPP_THROW(ExitRequestException()); + ZYPP_THROW(ExitRequestException("name or capability not found")); } // give user feedback from package selection @@ -4835,7 +4835,7 @@ void Zypper::doCommand() { setExitCode(ZYPPER_EXIT_INF_CAP_NOT_FOUND); if (globalOpts().non_interactive) - ZYPP_THROW(ExitRequestException()); + ZYPP_THROW(ExitRequestException("name or capability not found")); } } diff --git a/src/Zypper.h b/src/Zypper.h index fc20f45..3bf3cc1 100644 --- a/src/Zypper.h +++ b/src/Zypper.h @@ -437,7 +437,7 @@ private: class ExitRequestException : public zypp::Exception { public: - ExitRequestException(const std::string & msg = "") : zypp::Exception(msg) {} + ExitRequestException(const std::string & msg ) : zypp::Exception(msg) {} }; #endif /*ZYPPER_H*/ diff --git a/src/main.h b/src/main.h index 86691f9..fb5c20f 100644 --- a/src/main.h +++ b/src/main.h @@ -15,6 +15,7 @@ #define ZYPPER_EXIT_ERR_PRIVILEGES 5 // unsufficient privileges for the operation #define ZYPPER_EXIT_NO_REPOS 6 // no repositories defined #define ZYPPER_EXIT_ZYPP_LOCKED 7 // libzypp is locked, e.g. packagekit is running +#define ZYPPER_EXIT_ERR_COMMIT 8 // an error occurred during commit. // info #define ZYPPER_EXIT_INF_UPDATE_NEEDED 100 // update needed diff --git a/src/repos.cc b/src/repos.cc index b4f9e01..355bb41 100644 --- a/src/repos.cc +++ b/src/repos.cc @@ -916,8 +916,7 @@ void init_target (Zypper & zypper) ); zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); - throw ExitRequestException( - "Target initialization failed: " + e.msg()); + ZYPP_THROW( ExitRequestException("Target initialization failed: " + e.msg()) ); } done = true; diff --git a/src/solve-commit.cc b/src/solve-commit.cc index 937bdda..0636c36 100755 --- a/src/solve-commit.cc +++ b/src/solve-commit.cc @@ -364,7 +364,10 @@ static bool dist_upgrade(Zypper & zypper) report_unknown_repos(zypper.out(), not_found); if (!not_found.empty()) - throw ExitRequestException("Some of specified repositories were not found."); + { + zypper.setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS); + ZYPP_THROW( ExitRequestException("Some of specified repositories were not found.") ); + } if ( ! specified.empty() ) { @@ -568,7 +571,7 @@ void solve_and_commit (Zypper & zypper) if (zypper.cOpts().count("debug-solver")) { make_solver_test_case(zypper); - return; + return; // ZYPPER_EXIT_OK } MIL << "got solution, showing summary" << endl; @@ -641,7 +644,6 @@ void solve_and_commit (Zypper & zypper) (summary.packagesToGetAndInstall() && zypper.command() == ZypperCommand::REMOVE); - bool do_commit = false; PromptOptions popts; // translators: These are the "Continue?" prompt options corresponding to // "Yes / No / show Problems / Versions / Arch / Repository / @@ -680,6 +682,7 @@ void solve_and_commit (Zypper & zypper) string prompt_text = _("Continue?"); + bool do_commit = false; unsigned int reply; do { @@ -752,12 +755,20 @@ void solve_and_commit (Zypper & zypper) if (need_another_solver_run) continue; - // COMMIT - - if (do_commit) + if ( ! do_commit ) { + zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); + return; + } + else + { + // COMMIT + if (!confirm_licenses(zypper)) + { + zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); return; + } try { @@ -771,23 +782,30 @@ void solve_and_commit (Zypper & zypper) gData.rpm_pkgs_total = God->resolver()->getTransaction().actionSize(); gData.rpm_pkg_current = 0; - ostringstream s; - s << _("committing"); MIL << "committing..."; - if (copts.count("dry-run")) - s << " " << _("(dry run)") << endl; - zypper.out().info(s.str(), Out::HIGH); + MIL << "committing..." << endl; + if ( zypper.out().verbosity() >= Out::HIGH ) + { + ostringstream s; + s << _("committing"); + if ( copts.count("dry-run") ) + s << " " << _("(dry run)"); + zypper.out().info( s.str(), Out::HIGH ); + } ZYppCommitResult result = God->commit(get_commit_policy(zypper)); - - MIL << endl << "DONE" << endl; - gData.show_media_progress_hack = false; - if ( ! result.noError() ) - zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); + USR << dump(result.transaction()) << endl; + if ( !result.allDone() && !( copts.count("dry-run") && result.noError() ) ) + { zypper.setExitCode( result.attemptToModify() ? ZYPPER_EXIT_ERR_COMMIT : ZYPPER_EXIT_ERR_ZYPP ); } // error message comes later.... - s.clear(); s << result; - zypper.out().info(s.str(), Out::HIGH); + MIL << endl << "DONE" << endl; + if ( zypper.out().verbosity() >= Out::HIGH ) + { + ostringstream s; + s << result; + zypper.out().info( s.str(), Out::HIGH ); + } show_update_messages(zypper, result.updateMessages()); } @@ -797,7 +815,7 @@ void solve_and_commit (Zypper & zypper) zypper.out().error(e, _("Problem retrieving the package file from the repository:"), _("Please see the above error message for a hint.")); - zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); + zypper.setExitCode(ZYPPER_EXIT_ERR_COMMIT); return; } catch ( zypp::repo::RepoException & e ) @@ -840,7 +858,7 @@ void solve_and_commit (Zypper & zypper) zypper.out().error(e, _("Problem retrieving the package file from the repository:"), hint); - zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); + zypper.setExitCode(ZYPPER_EXIT_ERR_COMMIT); return; } catch ( const zypp::FileCheckException & e ) @@ -854,7 +872,7 @@ void solve_and_commit (Zypper & zypper) "- refresh the repositories using 'zypper refresh'\n" "- use another installation medium (if e.g. damaged)\n" "- use another repository")); - zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); + zypper.setExitCode(ZYPPER_EXIT_ERR_COMMIT); return; } catch ( const Exception & e ) @@ -863,34 +881,44 @@ void solve_and_commit (Zypper & zypper) zypper.out().error(e, _("Problem occured during or after installation or removal of packages:"), _("Please see the above error message for a hint.")); - zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); + zypper.setExitCode(ZYPPER_EXIT_ERR_COMMIT); + return; } - // install any pending source packages - //! \todo This won't be necessary once we get a new solver flag - //! for installing source packages without their build deps - if (!zypper.runtimeData().srcpkgs_to_install.empty()) - install_src_pkgs(zypper); - - // set return value to 'reboot needed' - if (summary.needMachineReboot()) - { - zypper.setExitCode(ZYPPER_EXIT_INF_REBOOT_NEEDED); - zypper.out().warning( - _("One of installed patches requires reboot of" - " your machine. Reboot as soon as possible."), Out::QUIET); - } - // set return value to 'restart needed' (restart of package manager) - // however, 'reboot needed' takes precedence - else if (zypper.exitCode() != ZYPPER_EXIT_INF_REBOOT_NEEDED && summary.needPkgMgrRestart()) - { - zypper.setExitCode(ZYPPER_EXIT_INF_RESTART_NEEDED); - zypper.out().warning( - _("One of installed patches affects the package" - " manager itself. Run this command once more to install any other" - " needed patches."), - Out::QUIET, Out::TYPE_NORMAL); // don't show this to machines - } + if ( zypper.exitCode() != ZYPPER_EXIT_OK ) + { + zypper.out().error(_("Installation has completed with error.") ); + if ( zypper.exitCode() == ZYPPER_EXIT_ERR_COMMIT ) + zypper.out().error( boost::format( _("You may run '%1%' to repair any dependency problems.") ) % "zypper verify" ); + } + else + { + // install any pending source packages + //! \todo This won't be necessary once we get a new solver flag + //! for installing source packages without their build deps + if (!zypper.runtimeData().srcpkgs_to_install.empty()) + install_src_pkgs(zypper); + + // set return value to 'reboot needed' + if (summary.needMachineReboot()) + { + zypper.setExitCode(ZYPPER_EXIT_INF_REBOOT_NEEDED); + zypper.out().warning( + _("One of installed patches requires reboot of" + " your machine. Reboot as soon as possible."), Out::QUIET); + } + // set return value to 'restart needed' (restart of package manager) + // however, 'reboot needed' takes precedence + else if (zypper.exitCode() != ZYPPER_EXIT_INF_REBOOT_NEEDED && summary.needPkgMgrRestart()) + { + zypper.setExitCode(ZYPPER_EXIT_INF_RESTART_NEEDED); + zypper.out().warning( + _("One of installed patches affects the package" + " manager itself. Run this command once more to install any other" + " needed patches."), + Out::QUIET, Out::TYPE_NORMAL); // don't show this to machines + } + } // check for running services (fate #300763) if ( ! ( zypper.cOpts().count("download-only") || zypper.cOpts().count("dry-run") ) diff --git a/src/utils/misc.cc b/src/utils/misc.cc index ba9ca8f..01a5d4c 100644 --- a/src/utils/misc.cc +++ b/src/utils/misc.cc @@ -590,7 +590,7 @@ DownloadMode get_download_option(Zypper & zypper, bool quiet) zypper.out().info(str::form(_("Available download modes: %s"), "only, in-advance, in-heaps, as-needed")); zypper.setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS); - throw ExitRequestException("Unknown download mode"); + ZYPP_THROW( ExitRequestException("Unknown download mode") ); } // warn about the override, both were specified diff --git a/src/utils/prompt.cc b/src/utils/prompt.cc index 880344b..212e9c4 100644 --- a/src/utils/prompt.cc +++ b/src/utils/prompt.cc @@ -356,7 +356,8 @@ unsigned int get_prompt_reply(Zypper & zypper, "If you run zypper without a terminal, use '%s' global\n" "option to make zypper use default answers to prompts." ), "--non-interactive")); - throw ExitRequestException("Cannot read input. Bad stream or EOF."); + zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); + ZYPP_THROW( ExitRequestException("Cannot read input. Bad stream or EOF.") ); } if (reply.empty()) diff --git a/zypper.spec.cmake b/zypper.spec.cmake index 375b0e8..399983f 100644 --- a/zypper.spec.cmake +++ b/zypper.spec.cmake @@ -22,7 +22,7 @@ BuildRequires: boost-devel >= 1.33.1 BuildRequires: cmake >= 2.4.6 BuildRequires: gcc-c++ >= 4.7 BuildRequires: gettext-devel >= 0.15 -BuildRequires: libzypp-devel >= 14.40.0 +BuildRequires: libzypp-devel >= 14.42.0 BuildRequires: readline-devel >= 5.1 Requires: procps %if 0%{?suse_version}