Author: mlandres
Date: Wed Aug 6 17:17:49 2008
New Revision: 10765
URL: http://svn.opensuse.org/viewcvs/zypp?rev=10765&view=rev
Log:
- Cleanup, mostly by removing, unused parser code and related classes.
Added:
trunk/libzypp/zypp/parser/xml/XmlEscape.h
trunk/libzypp/zypp/parser/xml/xml_escape_parser.cpp (props changed)
- copied unchanged from r10761, trunk/libzypp/zypp/parser/xml_escape_parser.cpp
trunk/libzypp/zypp/parser/xml/xml_escape_parser.hpp (props changed)
- copied unchanged from r10761, trunk/libzypp/zypp/parser/xml_escape_parser.hpp
trunk/libzypp/zypp/parser/xml_escape_parser.hpp
Removed:
trunk/libzypp/devel/devel.ma/testdrafts/RepoParser.cc
trunk/libzypp/tests/zypp/TranslatedText_test.cc
trunk/libzypp/zypp/TranslatedText.cc
trunk/libzypp/zypp/TranslatedText.h
trunk/libzypp/zypp/data/
trunk/libzypp/zypp/parser/LibXMLHelper.cc
trunk/libzypp/zypp/parser/LibXMLHelper.h
trunk/libzypp/zypp/parser/TagParser.cc
trunk/libzypp/zypp/parser/TagParser.h
trunk/libzypp/zypp/parser/XMLNodeIterator.cc
trunk/libzypp/zypp/parser/XMLNodeIterator.h
trunk/libzypp/zypp/parser/xml_escape_parser.cpp
trunk/libzypp/zypp/parser/xml_parser_assert.h
trunk/libzypp/zypp/parser/xmlstore/
Modified:
trunk/libzypp/devel/devel.ma/Test.cc
trunk/libzypp/package/libzypp.changes
trunk/libzypp/tests/zypp/CMakeLists.txt
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/RepoManager.cc
trunk/libzypp/zypp/parser/plaindir/RepoParser.cc
trunk/libzypp/zypp/parser/plaindir/RepoParser.h
trunk/libzypp/zypp/parser/susetags/ContentFileReader.cc
trunk/libzypp/zypp/parser/susetags/ContentFileReader.h
trunk/libzypp/zypp/parser/xml/XmlString.h
Modified: trunk/libzypp/devel/devel.ma/Test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Test.cc?rev=10765&r1=10764&r2=10765&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Test.cc (original)
+++ trunk/libzypp/devel/devel.ma/Test.cc Wed Aug 6 17:17:49 2008
@@ -19,162 +19,11 @@
#include
#include
-#include "zypp/parser/TagParser.h"
-#include "zypp/parser/susetags/PackagesFileReader.h"
-#include "zypp/parser/susetags/PackagesLangFileReader.h"
-#include "zypp/parser/susetags/PatternFileReader.h"
-#include "zypp/parser/susetags/ContentFileReader.h"
-#include "zypp/parser/susetags/RepoIndex.h"
-#include "zypp/parser/susetags/RepoParser.h"
-#include "zypp/cache/CacheStore.h"
-
using namespace std;
using namespace zypp;
-using namespace zypp::parser;
-using namespace zypp::parser::susetags;
///////////////////////////////////////////////////////////////////
-struct DummyConsumer : public zypp::data::ResolvableDataConsumer
- , private base::NonCopyable
-{
- std::string idString( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
- {
- std::string ret( kind_r.asString() );
- ret += ":";
- ret += res_r->name;
- ret += "-";
- ret += res_r->edition.asString();
- ret += ".";
- ret += res_r->arch.asString();
- return ret;
- }
-
- data::RecordId _lastId;
- std::mapstd::string,data::RecordId _idMap;
- std::mapdata::RecordId,std::string _reverseMap;
-
- bool hasEntry( const std::string & id_r )
- {
- return _idMap.find( id_r ) != _idMap.end();
- }
-
- data::RecordId newId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
- {
- std::string id( idString( res_r, kind_r ) );
- if ( hasEntry( id ) )
- ZYPP_THROW(Exception(id));
- _idMap[id] = ++_lastId;
- _reverseMap[_lastId] = id;
- MIL << "NEW_ID " << _lastId << " - " << id << endl;
- logNew( res_r, kind_r );
- return _lastId;
- }
-
- data::RecordId getId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
- {
- std::string id( idString( res_r, kind_r ) );
- if ( ! hasEntry( id ) )
- ZYPP_THROW(Exception(id));
- data::RecordId ret = _idMap[id];
- DBG << ret << " " << id << endl;
- return ret;
- }
-
- std::string lookup( data::RecordId id_r )
- {
- if ( id_r == data::noRecordId )
- {
- return "";
- }
-
- if ( _reverseMap.find( id_r ) != _reverseMap.end() )
- {
- return _reverseMap[id_r];
- }
-
- WAR << "Lookup id " << id_r << "failed" << endl;
- return std::string();
- }
-
- //
- void logNew( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
- {
- std::string shr( lookup( res_r->shareDataWith ) );
- }
-
- public:
-
- virtual data::RecordId consumePackage( const data::RecordId & repository_id, const data::Package_Ptr & res_r )
- {
- return newId( res_r, ResTraits<Package>::kind );
- }
-
- virtual data::RecordId consumeSourcePackage( const data::RecordId & repository_id, const data::SrcPackage_Ptr & res_r )
- {
- return newId( res_r, ResTraits<SrcPackage>::kind );
- }
-
- virtual data::RecordId consumeProduct ( const data::RecordId & repository_id, const data::Product_Ptr & res_r )
- {
- return newId( res_r, ResTraits<Product>::kind );
- }
-
- virtual data::RecordId consumePatch ( const data::RecordId & repository_id, const data::Patch_Ptr & res_r )
- {
- return newId( res_r, ResTraits<Patch>::kind );
- }
-
- virtual data::RecordId consumePackageAtom ( const data::RecordId & repository_id, const data::PackageAtom_Ptr & res_r )
- {
- return newId( res_r, ResTraits<Atom>::kind );
- }
-
- virtual data::RecordId consumeMessage ( const data::RecordId & repository_id, const data::Message_Ptr & res_r )
- {
- return newId( res_r, ResTraits<Message>::kind );
- }
-
- virtual data::RecordId consumeScript ( const data::RecordId & repository_id, const data::Script_Ptr & res_r )
- {
- return newId( res_r, ResTraits<Script>::kind );
- }
-
- virtual data::RecordId consumePattern ( const data::RecordId & repository_id, const data::Pattern_Ptr & res_r )
- {
- return newId( res_r, ResTraits<Pattern>::kind );
- }
-
- virtual data::RecordId consumeChangelog ( const data::RecordId & repository_id, const Changelog & )
- { return data::RecordId(); }
-
- virtual data::RecordId consumeFilelist ( const data::RecordId & repository_id, const data::Filenames & )
- { return data::RecordId(); }
-
- virtual void consumeDiskUsage ( const data::RecordId & repository_id, const DiskUsage & du )
- {
- ERR << lookup( repository_id ) << endl;
- //WAR << du << endl;
- return;
- }
-
-
- void updatePackageLang( const data::RecordId & resolvable_id,
- const data::Packagebase_Ptr & data_r )
- {
- return;
- SEC << lookup( resolvable_id ) << endl;
- INT << " " << data_r->summary.text() << endl;
- INT << " " << data_r->summary.text( Locale("en") ) << endl;
- if ( data_r->licenseToConfirm.locales().size() )
- {
- INT << " " << data_r->licenseToConfirm.text() << endl;
- INT << " " << data_r->licenseToConfirm.text( Locale("en") ) << endl;
- INT << " " << data_r->licenseToConfirm.locales() << endl;
- }
- }
-};
-
/******************************************************************
**
** FUNCTION NAME : main
@@ -184,12 +33,6 @@
{
INT << "===[START]==========================================" << endl;
- Measure x("Parse");
- DummyConsumer dummy;
- RepoParser parser( data::RecordId(), dummy );
-
- parser.parse( "REPO" );
-
INT << "===[END]============================================" << endl << endl;
return 0;
}
Modified: trunk/libzypp/package/libzypp.changes
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=10765&r1=10764&r2=10765&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Wed Aug 6 17:17:49 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Wed Aug 6 17:15:48 CEST 2008 ma@suse.de
+
+- Cleanup, mostly by removing, unused parser code and related classes.
+- revision 10765
+
+-------------------------------------------------------------------
Wed Aug 6 16:23:27 CEST 2008 ma@suse.de
- Don't let exception escape MediaSetAccess dtor (bnc #415017)
Modified: trunk/libzypp/tests/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/CMakeLists.txt?rev=10765&r1=10764&r2=10765&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/tests/zypp/CMakeLists.txt Wed Aug 6 17:17:49 2008
@@ -29,7 +29,6 @@
RepoStatus
ResKind
Target
- TranslatedText
Url
Vendor
Vendor2
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=10765&r1=10764&r2=10765&view=diff
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Wed Aug 6 17:17:49 2008
@@ -65,7 +65,6 @@
SysContent.cc
Target.cc
TmpPath.cc
- TranslatedText.cc
UpgradeStatistics.cc
Url.cc
VendorAttr.cc
@@ -158,7 +157,6 @@
SysContent.h
Target.h
TmpPath.h
- TranslatedText.h
TriBool.h
UpgradeStatistics.h
Url.h
@@ -243,23 +241,6 @@
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/base
)
-SET( zypp_data_SRCS
- data/ResolvableData.cc
- data/RecordId.cc
- data/ResolvableDataConsumer.cc
-)
-
-SET( zypp_data_HEADERS
- data/ResolvableData.h
- data/RecordId.h
- data/ResolvableDataConsumer.h
-)
-
-INSTALL( FILES
- ${zypp_data_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/data
-)
-
SET( zypp_media_SRCS
media/MediaException.cc
media/MediaAccess.cc
@@ -321,27 +302,19 @@
SET( zypp_parser_SRCS
parser/ParseException.cc
- parser/TagParser.cc
parser/IniParser.cc
parser/IniDict.cc
- parser/LibXMLHelper.cc
- parser/XMLNodeIterator.cc
parser/RepoFileReader.cc
parser/RepoindexFileReader.cc
parser/ProductConfReader.cc
parser/ServiceFileReader.cc
- parser/xml_escape_parser.cpp
)
SET( zypp_parser_HEADERS
parser/ParseException.h
- parser/TagParser.h
parser/IniParser.h
parser/IniDict.h
- parser/LibXMLHelper.h
parser/ParserProgress.h
- parser/XMLNodeIterator.h
- parser/xml_parser_assert.h
parser/RepoFileReader.h
parser/ProductConfReader.h
parser/xml_escape_parser.hpp
@@ -390,6 +363,7 @@
parser/xml/Reader.cc
parser/xml/XmlString.cc
parser/xml/libxmlfwd.cc
+ parser/xml/xml_escape_parser.cpp
)
SET( zypp_parser_xml_HEADERS
@@ -399,8 +373,10 @@
parser/xml/ParseDefException.h
parser/xml/ParseDefTraits.h
parser/xml/Reader.h
+ parser/xml/XmlEscape.h
parser/xml/XmlString.h
parser/xml/libxmlfwd.h
+ parser/xml/xml_escape_parser.hpp
)
INSTALL( FILES
@@ -767,7 +743,6 @@
${zypp_parser_plaindir_SRCS}
${zypp_parser_ws_SRCS}
${zypp_parser_SRCS}
-${zypp_data_SRCS}
${zypp_media_proxyinfo_SRCS}
${zypp_media_SRCS}
${zypp_url_SRCS}
@@ -800,7 +775,6 @@
${zypp_parser_xml_HEADERS}
${zypp_parser_ws_HEADERS}
${zypp_parser_HEADERS}
-${zypp_data_HEADERS}
${zypp_ui_HEADERS}
${zypp_media_HEADERS}
${zypp_target_hal_HEADERS}
@@ -841,7 +815,6 @@
#SET_LOGGROUP( "group" ${zypp_parser_yum2_SRCS} )
#SET_LOGGROUP( "group" ${zypp_capability_SRCS} )
#SET_LOGGROUP( "group" ${zypp_ui_SRCS} )
-#SET_LOGGROUP( "group" ${zypp_data_SRCS} )
#SET_LOGGROUP( "group" ${zypp_media_SRCS} )
#SET_LOGGROUP( "group" ${zypp_target_hal_SRCS} )
#SET_LOGGROUP( "group" ${zypp_parser_xml_SRCS} )
Modified: trunk/libzypp/zypp/RepoManager.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=10765&r1=10764&r2=10765&view=diff
==============================================================================
--- trunk/libzypp/zypp/RepoManager.cc (original)
+++ trunk/libzypp/zypp/RepoManager.cc Wed Aug 6 17:17:49 2008
@@ -1345,7 +1345,7 @@
bind(&Impl::ServiceCollector::collect,collector,_1) );
// only one service definition in the file
- if ( tmpSet.size() == 1 )
+ if ( tmpSet.size() == 1 )
{
if ( filesystem::unlink(location) != 0 )
{
@@ -1447,7 +1447,7 @@
void RepoManager::refreshService( const ServiceInfo & service )
{
//! \todo add callbacks for apps (start, end, repo removed, repo added, repo changed)
-
+
// download the repo index file
media::MediaManager mediamanager;
//if (service.url().empty())
@@ -1549,7 +1549,7 @@
_pimpl->services.insert(service);
// changed name, must change also repositories
- if( oldAlias != service.alias() )
+ if( oldAlias != service.alias() )
{
std::vector<RepoInfo> toModify;
getRepositoriesInService(oldAlias,
@@ -1564,7 +1564,7 @@
//! \todo changed enabled status
if ( oldService.enabled() != service.enabled())
{
-
+
}
//! \todo refresh the service automatically if url is changed?
Modified: trunk/libzypp/zypp/parser/plaindir/RepoParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/plaindir/RepoParser.cc?rev=10765&r1=10764&r2=10765&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/plaindir/RepoParser.cc (original)
+++ trunk/libzypp/zypp/parser/plaindir/RepoParser.cc Wed Aug 6 17:17:49 2008
@@ -8,22 +8,14 @@
\---------------------------------------------------------------------*/
#include <iostream>
-#include "zypp/base/Easy.h"
#include "zypp/base/Logger.h"
-#include "zypp/base/Iterator.h"
#include "zypp/base/String.h"
-#include "zypp/base/Regex.h"
-#include
-#include
+#include "zypp/PathInfo.h"
#include "zypp/parser/plaindir/RepoParser.h"
-#include "zypp/parser/ParseException.h"
-#include "zypp/PathInfo.h"
-#include "zypp/ZConfig.h"
-using namespace std;
-using namespace zypp::target::rpm;
+using std::endl;
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -69,163 +61,6 @@
return status;
}
-/** RepoParser implementation.
- * \todo Clean data on exeption.
- */
-class RepoParser::Impl
-{
- public:
- Impl( const std::string & repositoryId_r,
- data::ResolvableDataConsumer & consumer_r,
- const ProgressData::ReceiverFnc & fnc_r )
- : _repositoryId( repositoryId_r )
- , _consumer( consumer_r )
- , _sysarch( ZConfig::instance().systemArchitecture() )
- {
- _ticks.sendTo( fnc_r );
- }
-#if 0
- int extract_packages_from_directory( const Pathname & rootpath,
- const Pathname & subdir,
- bool recursive);
-#endif
- /** Main entry to parser. */
- void parse( const Pathname & reporoot_r );
- public:
-
- private:
- std::string _repositoryId;
- data::ResolvableDataConsumer & _consumer;
- ProgressData _ticks;
- Arch _sysarch;
-
- private: // these (and _ticks) are actually scoped per parse() run.
-};
-//////////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : RepoParser::Impl::parse
-// METHOD TYPE : void
-//
-void RepoParser::Impl::parse( const Pathname & reporoot_r )
-{
- //extract_packages_from_directory( reporoot_r, Pathname(), true );
-/*if ( ! _ticks.incr() )
- ZYPP_THROW( AbortRequestException() );*/
- // Done
- if ( ! _ticks.toMax() )
- ZYPP_THROW( AbortRequestException() );
-}
-
-#if 0
-int RepoParser::Impl::extract_packages_from_directory( const Pathname & rootpath,
- const Pathname & subdir,
- bool recursive)
-{
- using target::rpm::RpmHeader;
- Pathname path = rootpath / subdir;
- Pathname filename;
- PathInfo magic;
- bool distro_magic, pkginfo_magic;
-
-// DBG << "extract_packages_from_directory(.., " << path << ", " << repo.info().alias() << ", " << recursive << ")" << endl;
-
- /*
- Check for magic files that indicate how to treat the
- directory. The files aren't read -- it is sufficient that
- they exist.
- */
-
- magic = PathInfo( path + "/RC_SKIP" );
- if (magic.isExist()) {
- return 0;
- }
-
- magic = PathInfo( path + "/RC_RECURSIVE" );
- if (magic.isExist())
- recursive = true;
-
- magic = PathInfo( path + "/RC_BY_DISTRO" );
- distro_magic = magic.isExist();
-
- pkginfo_magic = true;
- magic = PathInfo( path + "/RC_IGNORE_PKGINFO" );
- if (magic.isExist())
- pkginfo_magic = false;
-
-
- std::liststd::string dircontent;
- if (filesystem::readdir( dircontent, path, false) != 0) { // dont look for dot files
- ERR << "readdir " << path << " failed" << endl;
- return -1;
- }
-
- for (std::liststd::string::const_iterator it = dircontent.begin(); it != dircontent.end(); ++it) {
- Pathname file_path = path + *it;
- PathInfo file_info( file_path );
- if (recursive && file_info.isDir())
- {
- extract_packages_from_directory( rootpath, subdir / *it, recursive );
- }
- else if (file_info.isFile() && file_path.extension() == ".rpm" )
- {
- RpmHeader::constPtr header = RpmHeader::readPackage( file_path, RpmHeader::NOSIGNATURE );
-#warning FIX creation of Package from src.rpm header
- // make up proper location relative to rootpath (bnc #368218)
- data::Package_Ptr package = makePackageDataFromHeader( header, NULL, subdir / *it, _repositoryId );
- if (package != NULL) {
- if (Arch(package->arch).compatibleWith(_sysarch))
- {
- DBG << "Adding package " << *package << endl;
- _consumer.consumePackage( package );
- }
- else
- {
- DBG << "Ignoring package " << *package << endl;
- }
- }
- }
- }
- return 0;
-}
-#endif
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : RepoParser
-//
-///////////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : RepoParser::RepoParser
-// METHOD TYPE : Ctor
-//
-RepoParser::RepoParser( const std::string & repositoryId_r,
- data::ResolvableDataConsumer & consumer_r,
- const ProgressData::ReceiverFnc & fnc_r )
-: _pimpl( new Impl( repositoryId_r, consumer_r, fnc_r ) )
-{}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : RepoParser::~RepoParser
-// METHOD TYPE : Dtor
-//
-RepoParser::~RepoParser()
-{}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : RepoParser::parse
-// METHOD TYPE : void
-//
-void RepoParser::parse( const Pathname & reporoot_r )
-{
- _pimpl->parse( reporoot_r );
-}
-
/////////////////////////////////////////////////////////////////
} // namespace plaindir
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/parser/plaindir/RepoParser.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/plaindir/RepoParser.h?rev=10765&r1=10764&r2=10765&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/plaindir/RepoParser.h (original)
+++ trunk/libzypp/zypp/parser/plaindir/RepoParser.h Wed Aug 6 17:17:49 2008
@@ -10,15 +10,6 @@
#ifndef ZYPP_PARSER_PLAINDIR_REPOPARSER_H
#define ZYPP_PARSER_PLAINDIR_REPOPARSER_H
-#include <iosfwd>
-
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/NonCopyable.h"
-
-#include "zypp/data/RecordId.h"
-#include "zypp/data/ResolvableDataConsumer.h"
-
-#include "zypp/ProgressData.h"
#include "zypp/RepoStatus.h"
///////////////////////////////////////////////////////////////////
@@ -35,37 +26,6 @@
* \short Gives a cookie for a dir
*/
RepoStatus dirStatus( const Pathname &dir );
-
- /** Plaindir metadata parser. */
-
- class RepoParser : private base::NonCopyable
- {
- public:
- /** Ctor.
- *
- * \param repositoryId_r repository identifier
- * \param consumer_r consumer of parsed data
- * \param fnc_r progress reporting function
- */
- RepoParser( const std::string & repositoryId_r,
- data::ResolvableDataConsumer & consumer_r,
- const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
- /** Dtor */
- ~RepoParser();
-
- /** Parse a local repository located at \a reporoot_r.
- *
- * \param reporoot_r The local repositories root directory.
- * \throw Exception on errors.
- */
- void parse( const Pathname & reporoot_r );
-
- public:
- class Impl;
- private:
- RW_pointer _pimpl;
- };
- ///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
} // namespace plaindir
@@ -76,4 +36,4 @@
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
-#endif // ZYPP2_PARSER_SUSETAGS_REPOPARSER_H
+#endif // ZYPP_PARSER_PLAINDIR_REPOPARSER_H
Modified: trunk/libzypp/zypp/parser/susetags/ContentFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/ContentFileReader.cc?rev=10765&r1=10764&r2=10765&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/ContentFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/susetags/ContentFileReader.cc Wed Aug 6 17:17:49 2008
@@ -20,7 +20,6 @@
#include "zypp/parser/susetags/ContentFileReader.h"
#include "zypp/parser/susetags/RepoIndex.h"
-#include "zypp/data/ResolvableData.h"
#include "zypp/ZConfig.h"
@@ -50,13 +49,6 @@
: _parent( parent_r )
{}
- data::Product & product()
- {
- if ( !_product )
- _product = new data::Product;
- return *_product;
- }
-
RepoIndex & repoindex()
{
if ( !_repoindex )
@@ -64,20 +56,9 @@
return *_repoindex;
}
- bool hasProduct() const
- { return _product; }
-
bool hasRepoIndex() const
{ return _repoindex; }
- data::Product_Ptr handoutProduct()
- {
- data::Product_Ptr ret;
- ret.swap( _product );
- _product = 0;
- return ret;
- }
-
RepoIndex_Ptr handoutRepoIndex()
{
RepoIndex_Ptr ret;
@@ -87,71 +68,6 @@
}
public:
- bool isRel( const std::string & rel_r ) const
- {
- try
- {
- Rel( rel_r );
- return true;
- }
- catch (...)
- {}
- return false;
- }
-
- bool setUrlList( std::list<Url> & list_r, const std::string & value ) const
- {
- bool errors = false;
- std::liststd::string urls;
- if ( str::split( value, std::back_inserter(urls) ) )
- {
- for ( std::liststd::string::const_iterator it = urls.begin();
- it != urls.end(); ++it )
- {
- try
- {
- list_r.push_back( *it );
- }
- catch( const Exception & excpt_r )
- {
- WAR << *it << ": " << excpt_r << endl;
- errors = true;
- }
- }
- }
- return errors;
- }
-
- void setDependencies( data::DependencyList & deplist_r, const std::string & value ) const
- {
- std::liststd::string words;
- str::split( value, std::back_inserter( words ) );
-
- for ( std::liststd::string::const_iterator it = words.begin();
- it != words.end(); ++it )
- {
- std::string name( *it );
-
- // check for '[op edition]':
- std::liststd::string::const_iterator next = it;
- if ( ++next != words.end()
- && (*next).find_first_of( "<>=" ) != std::string::npos )
- {
- std::string op = *next;
- if ( ++next != words.end() )
- {
- // Add the 'name op edition' dependency
- deplist_r.insert( Capability( name, op, *next ) );
- it = next;
- continue;
- }
- }
-
- // Add the 'name' dependency
- deplist_r.insert( Capability( name, Capability::PARSED ) );
- }
- }
-
bool setFileCheckSum( std::map & map_r, const std::string & value ) const
{
bool error = false;
@@ -172,7 +88,6 @@
private:
const ContentFileReader & _parent;
- data::Product_Ptr _product;
RepoIndex_Ptr _repoindex;
};
///////////////////////////////////////////////////////////////////
@@ -217,11 +132,6 @@
void ContentFileReader::endParse()
{
// consume oldData
- if ( _pimpl->hasProduct() )
- {
- if ( _productConsumer )
- _productConsumer( _pimpl->handoutProduct() );
- }
if ( _pimpl->hasRepoIndex() )
{
if ( _repoIndexConsumer )
@@ -305,128 +215,6 @@
}
//
- // Product related data:
- //
- if ( key == "PRODUCT" )
- {
- std::replace( value.begin(), value.end(), ' ', '_' );
- _pimpl->product().name = value;
- }
- else if ( key == "VERSION" )
- {
- _pimpl->product().edition = Edition( value );
- }
- else if ( key == "ARCH" )
- {
- // Default product arch is noarch. We update, if the
- // ARCH.xxx tag is better than the current product arch
- // and still compatible with the sysarch.
- Arch carch( modifier );
- if ( Arch::compare( Arch(_pimpl->product().arch), carch ) < 0
- && carch.compatibleWith( sysarch ) )
- {
- _pimpl->product().arch = Arch( modifier );
- }
- }
- else if ( key == "DISTPRODUCT" )
- {
- _pimpl->product().distributionName = value;
- }
- else if ( key == "DISTVERSION" )
- {
- _pimpl->product().distributionEdition = Edition( value );
- }
- else if ( key == "VENDOR" )
- {
- _pimpl->product().vendor = value;
- }
- else if ( key == "LABEL" )
- {
- _pimpl->product().summary.setText( value, Locale(modifier) );
- }
- else if ( key == "SHORTLABEL" )
- {
- _pimpl->product().shortName.setText( value, Locale(modifier) );
- }
- else if ( key == "TYPE" )
- {
- _pimpl->product().type = value;
- }
- else if ( key == "RELNOTESURL" )
- {
- for( std::string::size_type pos = value.find("%a");
- pos != std::string::npos;
- pos = value.find("%a") )
- {
- value.replace( pos, 2, sysarch.asString() );
- }
- try
- {
- _pimpl->product().releasenotesUrl = value;
- }
- catch( const Exception & excpt_r )
- {
- WAR << errPrefix( line.lineNo(), excpt_r.asString(), *line ) << endl;
- }
- }
- else if ( key == "UPDATEURLS" )
- {
- if ( _pimpl->setUrlList( _pimpl->product().updateUrls, value ) )
- {
- WAR << errPrefix( line.lineNo(), "Ignored malformed URL(s)", *line ) << endl;
- }
- }
- else if ( key == "EXTRAURLS" )
- {
- if ( _pimpl->setUrlList( _pimpl->product().extraUrls, value ) )
- {
- WAR << errPrefix( line.lineNo(), "Ignored malformed URL(s)", *line ) << endl;
- }
- }
- else if ( key == "OPTIONALURLS" )
- {
- if ( _pimpl->setUrlList( _pimpl->product().optionalUrls, value ) )
- {
- WAR << errPrefix( line.lineNo(), "Ignored malformed URL(s)", *line ) << endl;
- }
- }
- else if ( key == "PREREQUIRES" )
- {
- _pimpl->setDependencies( _pimpl->product().deps[Dep::PREREQUIRES], value );
- }
- else if ( key == "REQUIRES" )
- {
- _pimpl->setDependencies( _pimpl->product().deps[Dep::REQUIRES], value );
- }
- else if ( key == "PROVIDES" )
- {
- _pimpl->setDependencies( _pimpl->product().deps[Dep::PROVIDES], value );
- }
- else if ( key == "CONFLICTS" )
- {
- _pimpl->setDependencies( _pimpl->product().deps[Dep::CONFLICTS], value );
- }
- else if ( key == "OBSOLETES" )
- {
- _pimpl->setDependencies( _pimpl->product().deps[Dep::OBSOLETES], value );
- }
- else if ( key == "RECOMMENDS" )
- {
- _pimpl->setDependencies( _pimpl->product().deps[Dep::RECOMMENDS], value );
- }
- else if ( key == "SUGGESTS" )
- {
- _pimpl->setDependencies( _pimpl->product().deps[Dep::SUGGESTS], value );
- }
- else if ( key == "SUPPLEMENTS" )
- {
- _pimpl->setDependencies( _pimpl->product().deps[Dep::SUPPLEMENTS], value );
- }
- else if ( key == "ENHANCES" )
- {
- _pimpl->setDependencies( _pimpl->product().deps[Dep::ENHANCES], value );
- }
- //
// ReppoIndex related data:
//
else if ( key == "DEFAULTBASE" )
@@ -494,18 +282,6 @@
//
// post processing
//
- if ( _pimpl->hasProduct() )
- {
- // Insert a "Provides" _dist_name" == _dist_version"
- if ( ! _pimpl->product().distributionName.empty() )
- {
- _pimpl->product().deps[Dep::PROVIDES].insert(
- Capability( _pimpl->product().distributionName,
- Rel::EQ,
- _pimpl->product().distributionEdition,
- ResKind::product ) );
- }
- }
if ( ! ticks.toMax() )
userRequestedAbort( line.lineNo() );
Modified: trunk/libzypp/zypp/parser/susetags/ContentFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/ContentFileReader.h?rev=10765&r1=10764&r2=10765&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/ContentFileReader.h (original)
+++ trunk/libzypp/zypp/parser/susetags/ContentFileReader.h Wed Aug 6 17:17:49 2008
@@ -26,15 +26,6 @@
{ /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
- namespace data
- { /////////////////////////////////////////////////////////////////
- class Product;
- DEFINE_PTR_TYPE(Product);
- /////////////////////////////////////////////////////////////////
- } // namespace data
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
namespace parser
{ /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
@@ -48,11 +39,12 @@
//
// CLASS NAME : ContentFileReader
//
- /** */
+ /** Parse repoindex part from a \c content file.
+ * This is all the downloader needs.
+ */
class ContentFileReader : private base::NonCopyable
{
public:
- typedef function ProductConsumer;
typedef function RepoIndexConsumer;
public:
@@ -70,10 +62,6 @@
const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
public:
- /** Consumer to call when product data were parsed. */
- void setProductConsumer( const ProductConsumer & fnc_r )
- { _productConsumer = fnc_r; }
-
/** Consumer to call when repo index was parsed. */
void setRepoIndexConsumer( const RepoIndexConsumer & fnc_r )
{ _repoIndexConsumer = fnc_r; }
@@ -99,7 +87,6 @@
private:
class Impl;
RW_pointer _pimpl;
- ProductConsumer _productConsumer;
RepoIndexConsumer _repoIndexConsumer;
};
///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp/parser/xml/XmlEscape.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/xml/XmlEscape.h?rev=10765&view=auto
==============================================================================
--- trunk/libzypp/zypp/parser/xml/XmlEscape.h (added)
+++ trunk/libzypp/zypp/parser/xml/XmlEscape.h Wed Aug 6 17:17:49 2008
@@ -0,0 +1,39 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/parser/xml/XmlEscape.h
+ *
+*/
+#ifndef ZYPP_PARSER_XML_XMLESCAPE_H
+#define ZYPP_PARSER_XML_XMLESCAPE_H
+
+// from IoBind Library:
+#include
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace xml
+ { /////////////////////////////////////////////////////////////////
+
+ /** Escape xml special charaters (<tt>& -> &</tt>; from IoBind library). */
+ inline std::string escape( const std::string & in_r )
+ { return iobind::parser::xml_escape_parser().escape( in_r ); }
+
+ /** Unescape xml special charaters (<tt>& -> &</tt>; from IoBind library) */
+ inline std::string unescape( const std::string & in_r )
+ { return iobind::parser::xml_escape_parser().unescape( in_r ); }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace xml
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_PARSER_XML_XMLESCAPE_H
Modified: trunk/libzypp/zypp/parser/xml/XmlString.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/xml/XmlString.h?rev=10765&r1=10764&r2=10765&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/xml/XmlString.h (original)
+++ trunk/libzypp/zypp/parser/xml/XmlString.h Wed Aug 6 17:17:49 2008
@@ -18,6 +18,7 @@
#include "zypp/base/PtrTypes.h"
#include "zypp/parser/xml/libxmlfwd.h"
+#include "zypp/parser/xml/XmlEscape.h"
///////////////////////////////////////////////////////////////////
namespace zypp
Added: trunk/libzypp/zypp/parser/xml_escape_parser.hpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/xml_escape_parser.hpp?rev=10765&view=auto
==============================================================================
--- trunk/libzypp/zypp/parser/xml_escape_parser.hpp (added)
+++ trunk/libzypp/zypp/parser/xml_escape_parser.hpp Wed Aug 6 17:17:49 2008
@@ -0,0 +1,6 @@
+
+#warning DEPRECATED INCLUDE: include zypp/parser/xml/XmlEscape.h instead
+#warning ....................Consider using zypp::xml::escape instead of
+#warning ....................iobind::parser::xml_escape_parser to become
+#warning ....................implementation independent.
+#include
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org