Install not by package name but by capability, if the string
authorMartin Vidner <mvidner@suse.cz>
Thu, 26 Jul 2007 11:55:40 +0000 (11:55 +0000)
committerMartin Vidner <mvidner@suse.cz>
Thu, 26 Jul 2007 11:55:40 +0000 (11:55 +0000)
contains one of =<> (FATE 301956).
(not working yet, probably a libzypp bug: #294727)

src/zypper-misc.cc

index 593b973..a93f28a 100644 (file)
@@ -132,6 +132,27 @@ static std::string xml_escape( const std::string &text )
 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: