Author: dmacvicar Date: Fri Aug 3 13:41:17 2007 New Revision: 6428 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6428&view=rev Log: - support updateurls in yum repositories (feature #302484) - added all url types and other attributes Modified: trunk/libzypp/zypp/parser/yum/ProductFileReader.cc trunk/libzypp/zypp/parser/yum/schema/products.rnc Modified: trunk/libzypp/zypp/parser/yum/ProductFileReader.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/ProductFileReader.cc?rev=6428&r1=6427&r2=6428&view=diff ============================================================================== --- trunk/libzypp/zypp/parser/yum/ProductFileReader.cc (original) +++ trunk/libzypp/zypp/parser/yum/ProductFileReader.cc Fri Aug 3 13:41:17 2007 @@ -10,6 +10,7 @@ #include "zypp/base/Logger.h" #include "zypp/parser/xml/Reader.h" #include "zypp/data/ResolvableData.h" +#include "zypp/ZConfig.h" #include "zypp/parser/yum/FileReaderBaseImpl.h" #include "zypp/parser/yum/ProductFileReader.h" @@ -155,6 +156,90 @@ _product->description.setText(reader_r.nodeText().asString(), locale); return true; } + + // xpath: /products/product/distribution-name (+) + if (reader_r->name() == "distribution-name") + { + _product->distributionName = reader_r.nodeText().asString(); + return true; + } + + // xpath: /products/product/distribution-edition (+) + if (reader_r->name() == "distribution-edition") + { + _product->distributionEdition = reader_r.nodeText().asString(); + return true; + } + + // xpath: /products/product/release-notes-url (+) + if (reader_r->name() == "release-notes-url") + { + string value = reader_r.nodeText().asString(); + + for( std::string::size_type pos = value.find("%a"); + pos != std::string::npos; + pos = value.find("%a") ) + { + value.replace( pos, 2, ZConfig::instance().systemArchitecture().asString() ); + } + try + { + _product->releasenotesUrl = value; + } + catch( const Exception & excpt_r ) + { + WAR << "Malformed url ignored: '" << value << "' " << excpt_r.asString() << endl; + } + return true; + } + + // xpath: /products/product/update-url (*) + if (reader_r->name() == "update-url") + { + string value = reader_r.nodeText().asString(); + + try + { + _product->updateUrls.push_back(Url(value)); + } + catch( const Exception & excpt_r ) + { + WAR << "Malformed url ignored: '" << value << "' " << excpt_r.asString() << endl; + } + return true; + } + + // xpath: /products/product/extra-url (*) + if (reader_r->name() == "extra-url") + { + string value = reader_r.nodeText().asString(); + + try + { + _product->extraUrls.push_back(Url(value)); + } + catch( const Exception & excpt_r ) + { + WAR << "Malformed url ignored: '" << value << "' " << excpt_r.asString() << endl; + } + return true; + } + + // xpath: /products/product/optional-url (*) + if (reader_r->name() == "optional-url") + { + string value = reader_r.nodeText().asString(); + + try + { + _product->optionalUrls.push_back(Url(value)); + } + catch( const Exception & excpt_r ) + { + WAR << "Malformed url ignored: '" << value << "' " << excpt_r.asString() << endl; + } + return true; + } } else if (reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT) Modified: trunk/libzypp/zypp/parser/yum/schema/products.rnc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/schema/products.rnc?rev=6428&r1=6427&r2=6428&view=diff ============================================================================== --- trunk/libzypp/zypp/parser/yum/schema/products.rnc (original) +++ trunk/libzypp/zypp/parser/yum/schema/products.rnc Fri Aug 3 13:41:17 2007 @@ -17,7 +17,13 @@ }, element ns1:displayname { localized-string }+, element ns1:shortname { localized-string }*, + element ns1:distribution-name { text }, + element ns1:distribution-edition { text }, element ns1:description { localized-string }+, + element ns1:release-notes-url { text }?, + element ns1:update-url { text }*, + element ns1:optional-url { text }*, + element ns1:extra-url { text }*, dependencies }+ } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org