- changed the versioned capability to be expected as NAME[OP<EDITION>]
authorJan Kupec <jkupec@suse.cz>
Mon, 6 Aug 2007 16:04:26 +0000 (16:04 +0000)
committerJan Kupec <jkupec@suse.cz>
Mon, 6 Aug 2007 16:04:26 +0000 (16:04 +0000)
  (without spaces)

doc/zypper.8
src/zypper-misc.cc
src/zypper.cc

index 5b0a4c1..3ed601f 100644 (file)
@@ -50,8 +50,8 @@ Displays full info for the specified packages.
 .B install (in) <capability> ...
 Install resolvables.
 
-Capability is: NAME, or "NAME OP EDITION", where OP is < <= = >= > and
-EDITION is VERSION[-RELEASE].
+Capability is: NAME, or "NAME[OP<EDITION>]", 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
index 263b153..a158189 100644 (file)
@@ -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<EDITION>]
+    // transform to NAME[ OP <EDITION>] (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);
index 97b7d6e..04c8ad6 100644 (file)
@@ -284,7 +284,7 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
       "install (in) [options] <capability> ...\n"
       "\n"
       "Install resolvables with specified capabilities. A capability is"
-      " NAME[ OP <VERSION>], where OP is one of <, <=, =, >=, >.\n"
+      " NAME[OP<VERSION>], where OP is one of <, <=, =, >=, >.\n"
       "\n"
       "  Command options:\n"
       "-r, --repo <alias>              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] <capability> ...\n"
       "\n"
       "Remove resolvables with specified capabilities. A capability is"
-      " NAME[ OP <VERSION>], where OP is one of <, <=, =, >=, >.\n"
+      " NAME[OP<VERSION>], where OP is one of <, <=, =, >=, >.\n"
       "\n"
       "  Command options:\n"
       "-r, --repo <alias> Operate only with resolvables from repository specified by alias.\n"