From be9080e72e8b3da823d7cdbe6cbbae853b1ec542 Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Mon, 6 Aug 2007 16:04:26 +0000 Subject: [PATCH] - changed the versioned capability to be expected as NAME[OP] (without spaces) --- doc/zypper.8 | 4 ++-- src/zypper-misc.cc | 19 ++++++++++++++++++- src/zypper.cc | 4 ++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/doc/zypper.8 b/doc/zypper.8 index 5b0a4c1..3ed601f 100644 --- a/doc/zypper.8 +++ b/doc/zypper.8 @@ -50,8 +50,8 @@ Displays full info for the specified packages. .B install (in) ... Install resolvables. -Capability is: NAME, or "NAME OP EDITION", where OP is < <= = >= > and -EDITION is VERSION[-RELEASE]. +Capability is: NAME, or "NAME[OP]", where OP is < <= = >= > and +EDITION is VERSION[-RELEASE], for example: zypper-0.8.8-2. 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 diff --git a/src/zypper-misc.cc b/src/zypper-misc.cc index 263b153..a158189 100644 --- a/src/zypper-misc.cc +++ b/src/zypper-misc.cc @@ -136,7 +136,24 @@ static std::string xml_escape( const std::string &text ) Capability safe_parse_cap (const ResObject::Kind &kind, const string & capstr) { Capability cap; try { - cap = CapFactory().parse (kind, capstr); + // expect named caps as NAME[OP] + // transform to NAME[ OP ] (add spaces) + string new_capstr = capstr; + cout_vv << "capstr: " << capstr << endl; + int op_pos = capstr.find_first_of("<>="); + if (op_pos != string::npos) + { + new_capstr.insert(op_pos, " "); + cout_vv << "new capstr: " << new_capstr << endl; + op_pos = new_capstr.find_first_not_of("<>=", op_pos + 1); + if (op_pos != string::npos && new_capstr.size() > op_pos) + { + new_capstr.insert(op_pos, " "); + cout_vv << "new capstr: " << new_capstr << endl; + } + } + + cap = CapFactory().parse (kind, new_capstr); } catch (const Exception& e) { ZYPP_CAUGHT(e); diff --git a/src/zypper.cc b/src/zypper.cc index 97b7d6e..04c8ad6 100644 --- a/src/zypper.cc +++ b/src/zypper.cc @@ -284,7 +284,7 @@ int one_command(const ZypperCommand & command, int argc, char **argv) "install (in) [options] ...\n" "\n" "Install resolvables with specified capabilities. A capability is" - " NAME[ OP ], where OP is one of <, <=, =, >=, >.\n" + " NAME[OP], where OP is one of <, <=, =, >=, >.\n" "\n" " Command options:\n" "-r, --repo Install resolvables only from repository specified by alias.\n" @@ -313,7 +313,7 @@ int one_command(const ZypperCommand & command, int argc, char **argv) "remove (rm) [options] ...\n" "\n" "Remove resolvables with specified capabilities. A capability is" - " NAME[ OP ], where OP is one of <, <=, =, >=, >.\n" + " NAME[OP], where OP is one of <, <=, =, >=, >.\n" "\n" " Command options:\n" "-r, --repo Operate only with resolvables from repository specified by alias.\n" -- 2.7.4