- support updateurls in yum repositories (feature #302484)
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 3 Aug 2007 11:41:17 +0000 (11:41 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 3 Aug 2007 11:41:17 +0000 (11:41 +0000)
- added all url types and other attributes

zypp/parser/yum/ProductFileReader.cc
zypp/parser/yum/schema/products.rnc

index 0a23375..7fa19e7 100644 (file)
@@ -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 @@ namespace zypp
         _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)
index 2ee534d..1c38858 100644 (file)
@@ -17,7 +17,13 @@ products = element ns1:products {
     },
     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
   }+
 }