ref: refs/heads/SuSE-Code-11-Branch
commit 06310fe6052e2ca1361ec5934ecd0aeb6e0a05c0
Author: Michael Andres
Date: Mon Nov 30 18:00:18 2009 +0100
Also parse <product> tag from .prod files <upgrade> section.
---
tests/parser/ProductFileReader_test.cc | 2 ++
tests/parser/ProductFileReader_test.dat | 1 +
zypp/parser/ProductFileReader.cc | 6 +++++-
zypp/parser/ProductFileReader.h | 2 ++
4 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/tests/parser/ProductFileReader_test.cc b/tests/parser/ProductFileReader_test.cc
index cab2ff2..e4dc55a 100644
--- a/tests/parser/ProductFileReader_test.cc
+++ b/tests/parser/ProductFileReader_test.cc
@@ -26,12 +26,14 @@ BOOST_AUTO_TEST_CASE(basic)
BOOST_CHECK_EQUAL( data.upgrades()[0].name(), "openSUSE_11.1" );
BOOST_CHECK_EQUAL( data.upgrades()[0].summary(), "openSUSE 11.1" );
BOOST_CHECK_EQUAL( data.upgrades()[0].repository(), "http://download.opensuse.org/distribution/openSUSE/11.1" );
+ BOOST_CHECK_EQUAL( data.upgrades()[0].product(), "used on entreprise products" );
BOOST_CHECK_EQUAL( data.upgrades()[0].notify(), true );
BOOST_CHECK_EQUAL( data.upgrades()[0].status(), "stable" );
BOOST_CHECK_EQUAL( data.upgrades()[1].name(), "openSUSE_Factory" );
BOOST_CHECK_EQUAL( data.upgrades()[1].summary(), "openSUSE Factory" );
BOOST_CHECK_EQUAL( data.upgrades()[1].repository(), "http://download.opensuse.org/distribution/openSUSE/Factory" );
+ BOOST_CHECK_EQUAL( data.upgrades()[1].product(), "" );
BOOST_CHECK_EQUAL( data.upgrades()[1].notify(), false );
BOOST_CHECK_EQUAL( data.upgrades()[1].status(), "unstable" );
}
diff --git a/tests/parser/ProductFileReader_test.dat b/tests/parser/ProductFileReader_test.dat
index e57bc1d..3fe0033 100644
--- a/tests/parser/ProductFileReader_test.dat
+++ b/tests/parser/ProductFileReader_test.dat
@@ -23,6 +23,7 @@ This is the Server product of the SUSE Linux Enterprise edition. It is an altern
<name>openSUSE_11.1</name>
<summary>openSUSE 11.1</summary>
<repository>http://download.opensuse.org/distribution/openSUSE/11.1</repository>
+ <product>used on entreprise products</product>
<notify>true</notify>
<status>stable</status>
</upgrade>
diff --git a/zypp/parser/ProductFileReader.cc b/zypp/parser/ProductFileReader.cc
index 1e6ef13..8c8eeeb 100644
--- a/zypp/parser/ProductFileReader.cc
+++ b/zypp/parser/ProductFileReader.cc
@@ -41,6 +41,7 @@ namespace zypp
std::string _name;
std::string _summary;
std::string _repository;
+ std::string _product;
DefaultIntegral _notify;
std::string _status;
};
@@ -52,6 +53,7 @@ namespace zypp
std::string ProductFileData::Upgrade::name() const { return _pimpl->_name; }
std::string ProductFileData::Upgrade::summary() const { return _pimpl->_summary; }
std::string ProductFileData::Upgrade::repository() const { return _pimpl->_repository; }
+ std::string ProductFileData::Upgrade::product() const { return _pimpl->_product; }
bool ProductFileData::Upgrade::notify() const { return _pimpl->_notify; }
std::string ProductFileData::Upgrade::status() const { return _pimpl->_status; }
@@ -111,9 +113,10 @@ namespace zypp
std::ostream & operator<<( std::ostream & str, const ProductFileData::Upgrade & obj )
{
- str << str::form( "|upgrade|%s|%s|%s|%s|",
+ str << str::form( "|upgrade|%s|%s|%s|%s|%s|",
obj.name().c_str(),
obj.repository().c_str(),
+ obj.product().c_str(),
obj.status().c_str(),
(obj.notify() ? "notify" : "noNotify") );
return str;
@@ -155,6 +158,7 @@ namespace zypp
("name", OPTIONAL, xml::parseDefAssignText( _upgrade._name ) )
("summary", OPTIONAL, xml::parseDefAssignText( _upgrade._summary ) )
("repository", OPTIONAL, xml::parseDefAssignText( _upgrade._repository ) )
+ ("product", OPTIONAL, xml::parseDefAssignText( _upgrade._product ) )
("notify", OPTIONAL, xml::parseDefAssignText( _upgrade._notify ) )
("status", OPTIONAL, xml::parseDefAssignText( _upgrade._status ) )
;
diff --git a/zypp/parser/ProductFileReader.h b/zypp/parser/ProductFileReader.h
index d30ed67..1aa26e6 100644
--- a/zypp/parser/ProductFileReader.h
+++ b/zypp/parser/ProductFileReader.h
@@ -64,6 +64,7 @@ namespace zypp
public:
///////////////////////////////////////////////////////////////////
+ /** \see http://en.opensuse.org/Product_Management/Code11/Upgrade */
struct Upgrade
{
public:
@@ -75,6 +76,7 @@ namespace zypp
std::string name() const;
std::string summary() const;
std::string repository() const;
+ std::string product() const;
bool notify() const;
std::string status() const;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org