Displays full info for the specified packages.
.TP
-.B install (in) <name> ...
+.B install (in) <capability> ...
Install resolvables.
+
+Capability is: NAME, or "NAME OP EDITION", where OP is < <= = >= > and
+EDITION is VERSION[-RELEASE].
+
+Names are not only package names but any symbols provided by packages:
+/bin/vi, libcurl.so.3, perl(Time::ParseDate). Just remember to quote to protect the
+special characters from the shell.
+
.TP
\fI\-c, \-\-catalog\fR <catalog>
Only from this catalog (FIXME not implemented yet)
\fI\-t, \-\-type\fR <resolvable_type>
Type of resolvable (default: package)
.TP
+.I \-n, \-\-name
+Select resolvables by older method, considering just names, not capabilities.
+.TP
.I \-y, \-\-no\-confirm
Don't require user confirmation to proceed with installation.
.TP
.BR update .
.TP
-.B remove (rm) <name> ...
+.B remove (rm) <capability> ...
Remove resolvables.
.TP
\fI\-t, -\-type\fR <resolvable_type>
Type of resolvable (default: package)
.TP
+.I \-n, \-\-name
+Select resolvables by older method, considering just names, not capabilities.
+.TP
.I \-y, \-\-no-confirm
Don't require user confirmation.
+Capability is usually a plain name, for details see the install
+command.
+
.TP
.B update (up) [options]
Update all installed resolvables with newer versions, where applicable.
-------------------------------------------------------------------
+Fri Jul 27 19:06:58 CEST 2007 - mvidner@suse.cz
+
+- Implemented capabilities for installing and removing, allowing to
+ install by provided tags and files (F#301956) or a specific
+ version (F#302186): zypper in 'clamav = 0.90-0.1'; zypper rm
+ /bin/vi; zypper in libcurl.so.3; zypper in 'perl(Time::ParseDate)'
+- Added --name,-n to install and remove to use the old selection
+ method in case the new one does not work.
+
+-------------------------------------------------------------------
Thu Jul 26 17:19:59 CEST 2007 - jkupec@suse.cz
- output clean-up (#216042)
}
+// on error print a message and return noCap
+Capability safe_parse_cap (const ResObject::Kind &kind, const string & capstr) {
+ Capability cap;
+ try {
+ cap = CapFactory().parse (kind, capstr);
+ }
+ catch (const Exception& e) {
+ ZYPP_CAUGHT(e);
+ cerr << format (_("Cannot parse capability '%s'.")) % capstr << endl;
+ }
+ return cap;
+}
// this does only resolvables with this _name_.
// we could also act on _provides_
void mark_for_install( const ResObject::Kind &kind,
const std::string &name )
{
- if (name.find_first_of ("=<>") != string::npos) {
- // use resolver. (or use it always?)
- // Resolver.h
- Capability cap;
- try {
- cap = CapFactory().parse (kind, name);
- }
- catch (const Exception& e) {
- ZYPP_CAUGHT(e);
- cerr << "Cannot parse requirement: '" << name << "'" << endl;
- }
-
- if (cap != Capability::noCap) {
- Resolver_Ptr resolver = zypp::getZYpp()->resolver();
- cerr_vv << "Adding requirement " << cap << endl;
- resolver->addRequire (cap);
- }
-
- return;
- }
-
const ResPool &pool = God->pool();
// name and kind match:
}
}
+void mark_by_name (bool install_not_delete,
+ const ResObject::Kind &kind,
+ const string &name )
+{
+ if (install_not_delete)
+ mark_for_install(kind, name);
+ else
+ mark_for_uninstall(kind, name);
+}
+
+// don't try NAME-EDITION yet, could be confused by
+// dbus-1-x11, java-1_4_2-gcj-compat, ...
+/*
+bool mark_by_name_edition (...)
+ static const regex rx_name_edition("(.*?)-([0-9].*)");
+
+ smatch m;
+ if (! is_cap && regex_match (capstr, m, rx_name_edition)) {
+ capstr = m.str(1) + " = " + m.str(2);
+ is_cap = true;
+ }
+
+*/
+
+void mark_by_capability (bool install_not_delete,
+ const ResObject::Kind &kind,
+ const string &capstr )
+{
+ Capability cap = safe_parse_cap (kind, capstr);
+
+ if (cap != Capability::noCap) {
+ Resolver_Ptr resolver = zypp::getZYpp()->resolver();
+ if (install_not_delete) {
+ cerr_vv << "Adding requirement " << cap << endl;
+ resolver->addRequire (cap);
+ }
+ else {
+ cerr_vv << "Adding conflict " << cap << endl;
+ resolver->addConflict (cap);
+ }
+ }
+}
+
+
// debugging
static
ostream& operator << (ostream & stm, ios::iostate state)
*/
void cond_init_target();
+/// Parse a capability string. On error print a message and return noCap
+zypp::Capability safe_parse_cap (const zypp::ResObject::Kind &kind,
+ 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_by_name (bool install_not_delete,
+ const zypp::ResObject::Kind &kind,
+ const std::string &name );
+void mark_by_capability (bool install_not_delete,
+ const zypp::ResObject::Kind &kind,
+ const std::string &capstr );
+
int show_summary();
//std::string calculate_token();
static struct option install_options[] = {
{"catalog", required_argument, 0, 'c'},
{"type", required_argument, 0, 't'},
+ {"name", no_argument, 0, 'n'},
{"no-confirm", no_argument, 0, 'y'},
{"auto-agree-with-licenses", no_argument, 0, 'l'},
{"help", no_argument, 0, 'h'},
" Command options:\n"
"\t--catalog,-c\t\t\tOnly from this catalog (under development)\n"
"\t--type,-t <resolvable_type>\tType of resolvable (package, patch, pattern, product) (default: package)\n"
+ "\t--name,-n\t\t\tSelect resolvables by plain name, not by capability\n"
"\t--no-confirm,-y\t\t\tDo not require user confirmation to proceed with installation\n"
"\t--auto-agree-with-licenses,-l\tAutomatically say 'yes' to third party license confirmation prompt.\n"
"\t\t\t\t\tSee man zypper for more details.\n"
else if (command == ZypperCommand::REMOVE) {
static struct option remove_options[] = {
{"type", required_argument, 0, 't'},
+ {"name", no_argument, 0, 'n'},
{"no-confirm", no_argument, 0, 'y'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
"\n"
" Command options:\n"
"\t--type,-t <resolvable_type>\tType of resolvable (package, patch, pattern, product) (default: package)\n"
+ "\t--name,-n\t\t\tSelect resolvables by plain name, not by capability\n"
"\t--no-confirm,-y\t\t\tDo not require user confirmation\n"
);
}
cond_init_target ();
cond_load_resolvables();
+ bool install_not_remove = command == ZypperCommand::INSTALL;
+ bool just_name = copts.count("name"); // compatibility method
for ( vector<string>::const_iterator it = arguments.begin(); it != arguments.end(); ++it ) {
- if (command == ZypperCommand::INSTALL) {
- mark_for_install(kind, *it);
- }
- else {
- mark_for_uninstall(kind, *it);
- }
+ if (just_name)
+ mark_by_name (install_not_remove, kind, *it);
+ else
+ mark_by_capability (install_not_remove, kind, *it);
}
- solve_and_commit (copts.count("no-confirm") || gSettings.non_interactive);
+ solve_and_commit (copts.count("no-confirm") || gSettings.non_interactive, !just_name);
return ZYPPER_EXIT_OK;
}
# norootforbuild
Name: @PACKAGE@
-BuildRequires: libzypp-devel >= 3.11.9 boost-devel >= 1.33.1 gettext-devel >= 0.15 readline-devel >= 5.1
+BuildRequires: libzypp-devel >= 3.12.0 boost-devel >= 1.33.1 gettext-devel >= 0.15 readline-devel >= 5.1
BuildRequires: gcc-c++ >= 4.2 cmake >= 2.4.6 pkg-config >= 0.20
Requires: procps
License: GPL