- adapt Product to provde distribution info
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 20 Oct 2006 10:15:07 +0000 (10:15 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 20 Oct 2006 10:15:07 +0000 (10:15 +0000)
- bump version

VERSION
zypp/parser/xmlstore/XMLProductParser.cc
zypp/source/susetags/ProductMetadataParser.cc
zypp/target/store/serialize.cc

diff --git a/VERSION b/VERSION
index 100d7b2..de672cd 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -49,5 +49,5 @@ dnl ==================================================
 m4_define([LIBZYPP_MINOR],      [4])
 m4_define([LIBZYPP_COMPATMINOR], [4])
 dnl ==================================================
-m4_define([LIBZYPP_PATCH],      [1])
+m4_define([LIBZYPP_PATCH],      [2])
 dnl ==================================================
index 887a5cb..fffeee1 100644 (file)
@@ -74,12 +74,19 @@ namespace zypp {
             else if (name == "release-notes-url") {
               productPtr->releasenotesurl = _helper.content(child);
             }
+            else if (name == "distribution-name") {
+              productPtr->dist_name = _helper.content(child);
+            }
+            else if (name == "distribution-edition") {
+              productPtr->dist_version = _helper.content(child);
+            }
             else if (name == "shortname") {
               productPtr->short_name.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
             }
             else if (name == "product-flags") {
               parseProductFlags( productPtr, child);
             }
+            
            else if (name == "update-urls") {
               parseUpdateUrls( productPtr, child);
            }
index cb61553..bf7f02e 100644 (file)
@@ -253,8 +253,6 @@ void ProductMetadataParser::parse( const Pathname & file_r, Source_Ref source_r
 
     MIL << "Product arch is " << prodarch << endl;
 
-#warning EXCHANGE CODE AS SOON AS TARGET STORE SERIALIZES AND RESTORES DISTPRODUCT AND VERSION
-#if 0
     // Insert a "Provides" _dist_name" == _dist_version"
     CapFactory capfactory;
     prodImpl->_deps[Dep::PROVIDES].insert( capfactory.parse( ResTraits<Product>::kind,
@@ -263,18 +261,7 @@ void ProductMetadataParser::parse( const Pathname & file_r, Source_Ref source_r
                       Edition( prodImpl->_dist_version ) ) );
 
     NVRAD dataCollect( prodImpl->_name, Edition( prodImpl->_version ), prodarch, prodImpl->_deps );
-#else
-    // before we used to create the product with name and version instead of distname and distversion
-    // but now we use distname and distversion and we insert a "Provides" with name and version
-    // (#205392)
-    CapFactory capfactory;
-    prodImpl->_deps[Dep::PROVIDES].insert( capfactory.parse( ResTraits<Product>::kind,
-                      prodImpl->_name,
-                      Rel::EQ,
-                      Edition( prodImpl->_version ) ) );
-
-    NVRAD dataCollect( prodImpl->_dist_name, Edition( prodImpl->_dist_version ), prodarch, prodImpl->_deps );
-#endif
+    
     result = detail::makeResolvableFromImpl( dataCollect, prodImpl );
   }
   catch (const Exception & excpt_r)
index dc1fd21..312ea48 100644 (file)
@@ -28,6 +28,8 @@
 #include "serialize.h"
 #include "xml_escape_parser.hpp"
 
+#define SERIALIZER_VERSION "2.0"
+
 using namespace std;
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -95,7 +97,7 @@ std::string toXML( const Edition &edition )
 {
   stringstream out;
   // sad the yum guys did not acll it edition
-  out << "<version ver=\"" << xml_escape(edition.version()) << "\" rel=\"" << xml_escape(edition.release()) << "\"/>";
+  out << "<version ver=\"" << xml_escape(edition.version()) << "\" rel=\"" << xml_escape(edition.release()) << "\" epoch=\"" << edition.epoch() << "\" />";
   return out.str();
 }
 
@@ -277,7 +279,7 @@ std::string toXML( const Language::constPtr &obj )
 {
   stringstream out;
   out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
-  out << "<language xmlns=\"http://www.novell.com/metadata/zypp/xml-store\">" << std::endl;
+  out << "<language version=\"" << SERIALIZER_VERSION << "\" xmlns=\"http://www.novell.com/metadata/zypp/xml-store\">" << std::endl;
   out << toXML(static_cast<Resolvable::constPtr>(obj)) << std::endl;
   out << toXML(static_cast<ResObject::constPtr>(obj));
   out << "</language>" << std::endl;
@@ -290,7 +292,7 @@ std::string toXML( const Selection::constPtr &obj )
 {
   stringstream out;
   out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
-  out << "<pattern xmlns=\"http://www.novell.com/metadata/zypp/xml-store\">" << std::endl;
+  out << "<pattern version=\"" << SERIALIZER_VERSION << "\" xmlns=\"http://www.novell.com/metadata/zypp/xml-store\">" << std::endl;
   
   out << toXML(static_cast<Resolvable::constPtr>(obj)) << std::endl;
   out << toXML(static_cast<ResObject::constPtr>(obj));
@@ -319,7 +321,7 @@ std::string toXML( const Pattern::constPtr &obj )
 {
   stringstream out;
   out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
-  out << "<pattern xmlns=\"http://www.novell.com/metadata/zypp/xml-store\">" << std::endl;
+  out << "<pattern version=\"" << SERIALIZER_VERSION << "\" xmlns=\"http://www.novell.com/metadata/zypp/xml-store\">" << std::endl;
 
   out << toXML(static_cast<Resolvable::constPtr>(obj)) << std::endl;
   out << toXML(static_cast<ResObject::constPtr>(obj));
@@ -338,7 +340,7 @@ std::string toXML( const Product::constPtr &obj )
 {
   stringstream out;
   out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
-  out << "<product xmlns=\"http://www.novell.com/metadata/zypp/xml-store\" type=\"" << xml_escape(obj->category()) << "\">" << std::endl;
+  out << "<product version=\"" << SERIALIZER_VERSION << "\" xmlns=\"http://www.novell.com/metadata/zypp/xml-store\" type=\"" << xml_escape(obj->category()) << "\">" << std::endl;
   out << toXML(static_cast<Resolvable::constPtr>(obj)) << std::endl;
   #warning "FIXME description and displayname of products"
   
@@ -348,6 +350,8 @@ std::string toXML( const Product::constPtr &obj )
   detail::ResImplTraits<Product::Impl>::constPtr pipp( detail::ImplConnect::resimpl( obj ) );
   out << translatedTextToXML(pipp->shortName(), "shortname");
   
+  out << "  <distribution-name>" << xml_escape(obj->distributionName()) << "</distribution-name>" << std::endl;
+  out << "  <distribution-edition>" << xml_escape(obj->distributionEdition().asString()) << "</distribution-edition>" << std::endl;
   out << "  <source>" << xml_escape(obj->source().alias()) << "</source>" << std::endl;  
   out << "  <release-notes-url>" << xml_escape(obj->releaseNotesUrl().asString()) << "</release-notes-url>" << std::endl;
   out << "  <update-urls>" << std::endl;
@@ -414,7 +418,7 @@ std::string toXML( const Patch::constPtr &obj )
 {
   stringstream out;
   out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
-  out << "<patch xmlns=\"http://www.novell.com/metadata/zypp/xml-store\">" << std::endl; 
+  out << "<patch version=\"" << SERIALIZER_VERSION << "\" xmlns=\"http://www.novell.com/metadata/zypp/xml-store\">" << std::endl; 
   
   // reuse Resolvable information serialize function
   out << toXML(static_cast<Resolvable::constPtr>(obj));
@@ -445,7 +449,7 @@ std::string toXML( const source::SourceInfo &obj )
 {
   stringstream out;
   out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
-  out << "<source  xmlns=\"http://www.novell.com/metadata/zypp/xml-store\">" << std::endl;
+  out << "<source version=\"" << SERIALIZER_VERSION << "\" xmlns=\"http://www.novell.com/metadata/zypp/xml-store\">" << std::endl;
   out << "  <enabled>" << obj.enabled() << "</enabled>" << std::endl;
   out << "  <auto-refresh>" << obj.autorefresh() << "</auto-refresh>" << std::endl;
   out << "  <product-dir>" << obj.path() << "</product-dir>" << std::endl;