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;
}
// 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:
// 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;
}
};
// 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:
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
*/
void mark_by_capability (const Zypper & zypper,
- bool install_not_delete,
+ bool install_not_remove,
const ResObject::Kind &kind,
const string &capstr )
{
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);
}
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) {
}
}
- zypper.setExitCode(retv);
+ if (zypper.exitCode() == ZYPPER_EXIT_OK) // don't overwrite previously set exit code
+ zypper.setExitCode(retv);
}
// TODO confirm licenses
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_by_name (bool install_not_delete,
+void mark_for_uninstall(Zypper & zypper,
+ const zypp::ResObject::Kind &kind,
+ const std::string &name);
+
+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