[zypp-commit] r8489 - in /branches/tmp/ma/jump_sat/zypper: doc/zypper.8 package/zypper.changes src/zypper-main.h src/zypper-misc.cc src/zypper-misc.h src/zypper.cc
Author: dmacvicar Date: Wed Feb 6 03:15:49 2008 New Revision: 8489 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8489&view=rev Log: merge trunk revision 8453 Modified: branches/tmp/ma/jump_sat/zypper/doc/zypper.8 branches/tmp/ma/jump_sat/zypper/package/zypper.changes branches/tmp/ma/jump_sat/zypper/src/zypper-main.h branches/tmp/ma/jump_sat/zypper/src/zypper-misc.cc branches/tmp/ma/jump_sat/zypper/src/zypper-misc.h branches/tmp/ma/jump_sat/zypper/src/zypper.cc Modified: branches/tmp/ma/jump_sat/zypper/doc/zypper.8 URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/zypper/doc/zypper.8?rev=8489&r1=8488&r2=8489&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/zypper/doc/zypper.8 (original) +++ branches/tmp/ma/jump_sat/zypper/doc/zypper.8 Wed Feb 6 03:15:49 2008 @@ -1,4 +1,4 @@ -.TH "zypper" "8" "0.9.6" "zypper" "System Tools" +.TH "zypper" "8" "0.9.7" "zypper" "System Tools" .SH "SYNTAX" .LP zypper [\fI\-\-global\-options\fR] <\fBcommand\fR> [\fI\-\-command\-options\fR] [\fBcommand-arguments\fR] @@ -582,7 +582,11 @@ .TP 103 - ZYPPER_EXIT_INF_RESTART_NEEDED Returned after a successfull installation of a patch which requires restart of the package manager itself. This means that one of patches to be installed affects the package manager itself and the command used (e.g. zypper update) needs to be executed once again to install any remaining patches. - +.TP +104 - ZYPPER_EXIT_INF_CAP_NOT_FOUND +Returned by the \fBinstall\fR and the \fBremove\fR command in case any of the +arguments does not match any of the available (or installed) resolvable names +or other capabilities. .SH "COMPATIBILITY WITH RUG" .LP Modified: branches/tmp/ma/jump_sat/zypper/package/zypper.changes URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/zypper/package/zypper.changes?rev=8489&r1=8488&r2=8489&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/zypper/package/zypper.changes (original) +++ branches/tmp/ma/jump_sat/zypper/package/zypper.changes Wed Feb 6 03:15:49 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Feb 4 11:44:08 CET 2008 - jkupec@suse.cz + +- new exit code 104 ZYPPER_EXIT_INF_CAP_NOT_FOUND (bnc #358326) +- r8451 + +------------------------------------------------------------------- Fri Feb 1 18:25:17 CET 2008 - jkupec@suse.cz - --no-refresh global option added (bnc #356741) Modified: branches/tmp/ma/jump_sat/zypper/src/zypper-main.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/zypper/src/zypper-main.h?rev=8489&r1=8488&r2=8489&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/zypper/src/zypper-main.h (original) +++ branches/tmp/ma/jump_sat/zypper/src/zypper-main.h Wed Feb 6 03:15:49 2008 @@ -6,6 +6,7 @@ // ===== exit codes ====== #define ZYPPER_EXIT_OK 0 + // errors #define ZYPPER_EXIT_ERR_BUG 1 // undetermined error #define ZYPPER_EXIT_ERR_SYNTAX 2 // syntax error, e.g. zypper instal, zypper in --unknown option @@ -19,6 +20,7 @@ #define ZYPPER_EXIT_INF_SEC_UPDATE_NEEDED 101 // security update needed #define ZYPPER_EXIT_INF_REBOOT_NEEDED 102 // reboot needed after install/upgrade #define ZYPPER_EXIT_INF_RESTART_NEEDED 103 // restart of package manager itself needed +#define ZYPPER_EXIT_INF_CAP_NOT_FOUND 104 // given capability not found (for install/remove) #define VERBOSITY_NORMAL 0 Modified: branches/tmp/ma/jump_sat/zypper/src/zypper-misc.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/zypper/src/zypper-misc.cc?rev=8489&r1=8488&r2=8489&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/zypper/src/zypper-misc.cc (original) +++ branches/tmp/ma/jump_sat/zypper/src/zypper-misc.cc Wed Feb 6 03:15:49 2008 @@ -257,6 +257,7 @@ cap = Capability( new_capstr.c_str(), kind ); } catch (const Exception& e) { + //! \todo check this handling (should we fail or set a special exit code?) ZYPP_CAUGHT(e); cerr << format (_("Cannot parse capability '%s'.")) % capstr << endl; } @@ -266,8 +267,9 @@ // this does only resolvables with this _name_. // we could also act on _provides_ // TODO edition, arch -void mark_for_install( const ResObject::Kind &kind, - const std::string &name ) +void mark_for_install(Zypper & zypper, + const ResObject::Kind &kind, + const std::string &name) { const ResPool &pool = God->pool(); // name and kind match: @@ -284,7 +286,7 @@ // TranslatorExplanation e.g. "package 'pornview' not found" cerr << format(_("%s '%s' not found")) % kind_to_string_localized(kind,1) % name << endl; WAR << format("%s '%s' not found") % kind % name << endl; - + zypper.setExitCode(ZYPPER_EXIT_INF_CAP_NOT_FOUND); return; } @@ -339,8 +341,9 @@ }; // mark all matches -void mark_for_uninstall( const ResObject::Kind &kind, - const std::string &name ) +void mark_for_uninstall(Zypper & zypper, + const ResObject::Kind &kind, + const std::string &name) { const ResPool &pool = God->pool(); // name and kind match: @@ -357,18 +360,20 @@ if (!deleter.found) { // TranslatorExplanation e.g. "package 'pornview' not found" cerr << format(_("%s '%s' not found")) % kind_to_string_localized(kind,1) % name << endl; - return; //error? + zypper.setExitCode(ZYPPER_EXIT_INF_CAP_NOT_FOUND); + return; } } -void mark_by_name (bool install_not_delete, +void mark_by_name (Zypper & zypper, + bool install_not_remove, const ResObject::Kind &kind, const string &name ) { - if (install_not_delete) - mark_for_install(kind, name); + if (install_not_remove) + mark_for_install(zypper, kind, name); else - mark_for_uninstall(kind, name); + mark_for_uninstall(zypper, kind, name); } // don't try NAME-EDITION yet, could be confused by @@ -386,7 +391,7 @@ */ void mark_by_capability (const Zypper & zypper, - bool install_not_delete, + bool install_not_remove, const ResObject::Kind &kind, const string &capstr ) { @@ -396,7 +401,7 @@ cout_vv << "Capability: " << cap << endl; Resolver_Ptr resolver = zypp::getZYpp()->resolver(); - if (install_not_delete) { + if (install_not_remove) { cerr_vv << "Adding requirement " << cap << endl; resolver->addRequire (cap); } @@ -546,10 +551,12 @@ else if (rproblems.empty()) { // should not happen! If solve() failed at least one problem must be set! stm << _("Specified capability not found") << endl; + zypper.setExitCode(ZYPPER_EXIT_INF_CAP_NOT_FOUND); return false; } // for many problems, list them shortly first + //! \todo handle resolver problems caused by --capability mode arguments specially to give proper output (bnc #337007) if (rproblems.size() > 1) { for (i = b; i != e; ++i) { @@ -1589,7 +1596,8 @@ } } - zypper.setExitCode(retv); + if (zypper.exitCode() == ZYPPER_EXIT_OK) // don't overwrite previously set exit code + zypper.setExitCode(retv); } // TODO confirm licenses Modified: branches/tmp/ma/jump_sat/zypper/src/zypper-misc.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/zypper/src/zypper-misc.h?rev=8489&r1=8488&r2=8489&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/zypper/src/zypper-misc.h (original) +++ branches/tmp/ma/jump_sat/zypper/src/zypper-misc.h Wed Feb 6 03:15:49 2008 @@ -27,18 +27,23 @@ const std::string &capstr); zypp::ResObject::Kind string_to_kind (const std::string &skind); -void mark_for_install( const zypp::ResObject::Kind &kind, - const std::string &name ); -void mark_for_uninstall( const zypp::ResObject::Kind &kind, - const std::string &name ); +void mark_for_install(Zypper & zypper, + const zypp::ResObject::Kind &kind, + const std::string &name); + +void mark_for_uninstall(Zypper & zypper, + const zypp::ResObject::Kind &kind, + const std::string &name); -void mark_by_name (bool install_not_delete, +void mark_by_name (Zypper & zypper, + bool install_not_remove, const zypp::ResObject::Kind &kind, - const std::string &name ); + const std::string &name); + void mark_by_capability (const Zypper & zypper, - bool install_not_delete, + bool install_not_remove, const zypp::ResObject::Kind &kind, - const std::string &capstr ); + const std::string &capstr); /** * Reset all selections made by mark_* methods. Needed in the shell to reset Modified: branches/tmp/ma/jump_sat/zypper/src/zypper.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/zypper/src/zypper.cc?rev=8489&r1=8488&r2=8489&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/zypper/src/zypper.cc (original) +++ branches/tmp/ma/jump_sat/zypper/src/zypper.cc Wed Feb 6 03:15:49 2008 @@ -68,7 +68,7 @@ { MIL << "Bye!" << endl; } - + Zypper_Ptr Zypper::instance() { static Zypper_Ptr _instance; @@ -1805,7 +1805,7 @@ if (by_capability) mark_by_capability (*this, install_not_remove, kind, *it); else - mark_by_name (install_not_remove, kind, *it); + mark_by_name (*this, install_not_remove, kind, *it); } // rpm files -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
dmacvicar@svn.opensuse.org