error while parsing the edition of a package
authorStefan Schubert <schubi@suse.de>
Thu, 19 Jan 2006 12:55:40 +0000 (12:55 +0000)
committerStefan Schubert <schubi@suse.de>
Thu, 19 Jan 2006 12:55:40 +0000 (12:55 +0000)
zypp/solver/temporary/Package.cc
zypp/solver/temporary/XmlParser.cc

index fb4eae2..5fa8132 100644 (file)
@@ -453,7 +453,6 @@ Package::Package (XmlNode_constPtr node, Channel_constPtr channel, const Resolva
         release = update->package()->release();
 
     }
-#if 0 //Is this really needed ?
     else {
 
         /* Otherwise, try to find where the package provides itself,
@@ -461,17 +460,19 @@ Package::Package (XmlNode_constPtr node, Channel_constPtr channel, const Resolva
 
         if (!provides().empty())
             for (CapSet::const_iterator iter = provides().begin(); iter != provides().end(); iter++) {
-                if ((*iter)->relation() == Rel::EQ &&
-                    ((*iter)->name() == name))
-                {
-                    epoch = (*iter)->epoch();
-                    version = (*iter)->version();
-                    release = (*iter)->release();
-                    break;
-                }
+               std::string capString = (*iter).asString();
+               std::string cmpString = name + " == ";
+               string::size_type ret = capString.find (cmpString);             
+               if (ret != string::npos)
+               {
+                   Edition edition = Edition(capString.substr (cmpString.length()));
+                    epoch = edition.epoch();
+                    version = edition.version();
+                    release = edition.release();
+                   break;
+               }
             }
     }
-#endif
 
     Edition     _edition( version, release, zypp::str::numstring(epoch) );
     shared_ptr<zypp::detail::PackageImpl> pkgImpl;
index 3f35440..dfb6fd0 100644 (file)
@@ -433,7 +433,7 @@ XmlParser::endElement(const char *name)
 void
 XmlParser::toplevelStart(const std::string & name, const xmlChar **attrs)
 {
-    _XXX("RC_SPEW_XML") << "XmlParser::toplevelStart(" << name << ")" << endl;
+//    _XXX("RC_SPEW_XML") << "XmlParser::toplevelStart(" << name << ")" << endl;
 
     if ((name == "package")
        || (name == "pattern")
@@ -538,7 +538,7 @@ XmlParser::resolvableStart(const std::string & name, const xmlChar **attrs)
        _current_dep_list = _toplevel_dep_list = &_current_freshens;
     }
     else {
-       _XXX("RC_SPEW_XML") << "! Not handling " << name << " in package start" << endl;
+//     _XXX("RC_SPEW_XML") << "! Not handling " << name << " in package start" << endl;
     }
 }
 
@@ -633,19 +633,21 @@ XmlParser::resolvableEnd (const std::string & name)
            _current_resitem_fileSize = update->packageSize();
            _current_resitem_installedSize = update->installedSize();
        }
-#if 0 //Is this really needed ?
        else {
            for (CapSet::const_iterator iter = _current_provides.begin(); iter != _current_provides.end(); iter++) {
-               if ((*iter)->relation() == Rel::EQ
-                   && ((*iter)->name() == _current_resitem_name))
+               std::string capString = (*iter).asString();
+               std::string cmpString = _current_resitem_name + " == ";
+               string::size_type ret = capString.find (cmpString);             
+               if (ret != string::npos)
                {
-                   _current_resitem_kind = (*iter)->kind();
-                   _current_resitem_edition = (*iter)->edition();
+                   string editionStr = capString.substr (cmpString.length());
+                   _current_resitem_kind = (*iter).refers();
+                   _current_resitem_edition = Edition (editionStr);
                    break;
                }
            }
        }
-#endif
+
        // check if we provide ourselfs properly
 
        CapFactory  factory;