Author: mlandres
Date: Tue Jul 10 14:17:47 2007
New Revision: 5947
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5947&view=rev
Log:
backup
Modified:
branches/REFACTORING-10_3/libzypp/devel/devel.ma/CMakeLists.txt
branches/REFACTORING-10_3/libzypp/devel/devel.ma/Parse.cc
branches/REFACTORING-10_3/libzypp/devel/devel.ma/Test.cc
Modified: branches/REFACTORING-10_3/libzypp/devel/devel.ma/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/devel/devel.ma/CMakeLists.txt?rev=5947&r1=5946&r2=5947&view=diff
==============================================================================
--- branches/REFACTORING-10_3/libzypp/devel/devel.ma/CMakeLists.txt (original)
+++ branches/REFACTORING-10_3/libzypp/devel/devel.ma/CMakeLists.txt Tue Jul 10 14:17:47 2007
@@ -39,7 +39,7 @@
ENDFOREACH( loop_var )
-FOREACH( loop_var AOUT Parse)
+FOREACH( loop_var AOUT Parse Test)
ADD_EXECUTABLE( ${loop_var}
${loop_var}.cc
)
Modified: branches/REFACTORING-10_3/libzypp/devel/devel.ma/Parse.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/devel/devel.ma/Parse.cc?rev=5947&r1=5946&r2=5947&view=diff
==============================================================================
--- branches/REFACTORING-10_3/libzypp/devel/devel.ma/Parse.cc (original)
+++ branches/REFACTORING-10_3/libzypp/devel/devel.ma/Parse.cc Tue Jul 10 14:17:47 2007
@@ -8,7 +8,6 @@
#include "zypp/ZYppFactory.h"
#include "zypp/ResPoolProxy.h"
#include
-//#include
#include "zypp/ZYppCallbacks.h"
#include "zypp/NVRAD.h"
@@ -28,7 +27,6 @@
#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"
#include "zypp/RepoManager.h"
@@ -46,6 +44,24 @@
///////////////////////////////////////////////////////////////////
+struct Xprint
+{
+ bool operator()( const PoolItem & obj_r )
+ {
+ MIL << obj_r << " " << obj_r->summary() << endl;
+ MIL << obj_r << " " << obj_r->description() << endl;
+ return true;
+ }
+
+ template<class _C>
+ bool operator()( const _C & obj_r )
+ {
+ USR << obj_r << endl;
+ return true;
+ }
+};
+
+///////////////////////////////////////////////////////////////////
struct SetTransactValue
{
SetTransactValue( ResStatus::TransactValue newVal_r, ResStatus::TransactByValue causer_r )
@@ -245,6 +261,7 @@
RepoManager repoManager;
RepoInfoList repos = repoManager.knownRepositories();
+ SEC << repos << endl;
if ( repos.empty() )
{
@@ -276,8 +293,11 @@
if ( 0 )
{
- SEC << "cleanCache" << endl;
- repoManager.cleanCache( nrepo );
+ if ( repoManager.isCached( nrepo ) )
+ {
+ SEC << "cleanCache" << endl;
+ repoManager.cleanCache( nrepo );
+ }
SEC << "buildCache" << endl;
repoManager.buildCache( nrepo );
}
@@ -290,9 +310,11 @@
}
USR << "pool: " << pool << endl;
+
SEC << pool.knownRepositoriesSize() << endl;
std::for_each( pool.knownRepositoriesBegin(), pool.knownRepositoriesEnd(), Print() );
+ std::for_each( pool.byNameBegin("glibc"), pool.byNameEnd("glibc"), Xprint() );
///////////////////////////////////////////////////////////////////
INT << "===[END]============================================" << endl << endl;
Modified: branches/REFACTORING-10_3/libzypp/devel/devel.ma/Test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/devel/devel.ma/Test.cc?rev=5947&r1=5946&r2=5947&view=diff
==============================================================================
--- branches/REFACTORING-10_3/libzypp/devel/devel.ma/Test.cc (original)
+++ branches/REFACTORING-10_3/libzypp/devel/devel.ma/Test.cc Tue Jul 10 14:17:47 2007
@@ -1,6 +1,5 @@
#include "Tools.h"
-#include
-#include
+#include "ExplicitMap.h"
#include
#include <iostream>
@@ -9,719 +8,171 @@
#include
#include
-
-#include "Measure.h"
-
-#include "zypp/parser/xml/Reader.h"
-
-using namespace std;
-using namespace zypp;
-
#include "zypp/base/Exception.h"
#include "zypp/base/InputStream.h"
#include "zypp/base/DefaultIntegral.h"
#include
#include
+
#include
-#include
-#include
#include
#include
#include
-///////////////////////////////////////////////////////////////////
-
-template<class _Cl>
- void ti( const _Cl & c )
- {
- SEC << __PRETTY_FUNCTION__ << endl;
- }
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{
- namespace parser
- {
- namespace yum
- {
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- }
- }
-}
-///////////////////////////////////////////////////////////////////
-
-bool nopNode( xml::Reader & reader_r )
-{
- return true;
-}
-
-bool accNode( xml::Reader & reader_r )
-{
- int i;
- xml::XmlString s;
-#define X(m) reader_r->m()
- i=X(readState);
- i=X(lineNumber);
- i=X(columnNumber);
- i=X(depth);
- i=X(nodeType);
- s=X(name);
- s=X(prefix);
- s=X(localName);
- i=X(hasAttributes);
- i=X(attributeCount);
- i=X(hasValue);
- s=X(value);
-#undef X
- return true;
-}
-
-bool dumpNode( xml::Reader & reader_r )
-{
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ATTRIBUTE:
- DBG << *reader_r << endl;
- break;
- case XML_READER_TYPE_ELEMENT:
- MIL << *reader_r << endl;
- break;
- default:
- WAR << *reader_r << endl;
- break;
- }
- return true;
-}
-
-bool dumpNode2( xml::Reader & reader_r )
-{
- dumpNode( reader_r );
- return reader_r.foreachNodeAttribute( dumpNode );
-}
-
-bool dumpEd( xml::Reader & reader_r )
-{
- static int num = 5;
- if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT
- && reader_r->name() == "version" )
- {
- MIL << *reader_r << endl;
- DBG << reader_r->getAttribute( "rel" ) << endl;
- ERR << *reader_r << endl;
- DBG << reader_r->getAttribute( "ver" ) << endl;
- ERR << *reader_r << endl;
- DBG << reader_r->getAttribute( "epoch" ) << endl;
- ERR << *reader_r << endl;
- WAR << Edition( reader_r->getAttribute( "ver" ).asString(),
- reader_r->getAttribute( "rel" ).asString(),
- reader_r->getAttribute( "epoch" ).asString() ) << endl;
- --num;
- }
- return num;
-}
+#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;
///////////////////////////////////////////////////////////////////
-namespace parser
+struct DummyConsumer : public zypp::data::ResolvableDataConsumer
+ , private base::NonCopyable
{
- namespace consume
+ std::string idString( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
{
- struct Repomd
- {
- struct Data
- {
- Depositorystd::string _type;
- Depository<CheckSum> _checksum;
- Depository<Date> _timestamp;
- Depository<CheckSum> _openChecksum;
- };
-
- Depository<Data> _data;
- };
+ 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;
-
-}
-
-namespace data
-{
- struct Repomd
- {
- struct Data
- {
- std::string _type;
- CheckSum _checksum;
- Date _timestamp;
- CheckSum _openChecksum;
- };
-
- std::map _data;
- };
-}
-
-///////////////////////////////////////////////////////////////////
-
-
-
-struct Element;
-std::ostream & operator<<( std::ostream & str, const Element & obj );
-
-struct Element : private base::NonCopyable
-{
- Element( xml::Reader & reader_r )
- : _reader( reader_r )
- , _name( _reader->name().asString() )
- , _depth( _reader->depth() )
- {
- MIL << *this << endl;
- //return;
- while( nextElement() )
- {
- Element el( _reader );
- }
- }
-
- ~Element()
+ bool hasEntry( const std::string & id_r )
{
- while( nextElement() )
- { ; }
- DBG << *this << endl;
+ return _idMap.find( id_r ) != _idMap.end();
}
- bool atBegin() const
+ data::RecordId newId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
{
- return ( _reader->depth() == _depth
- && _reader->nodeType() == XML_READER_TYPE_ELEMENT
- && _reader->name().c_str() == _name );
+ 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;
}
- bool atEnd() const
+ data::RecordId getId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
{
- return ( _reader->depth() == _depth
- && ( _reader->nodeType() == XML_READER_TYPE_END_ELEMENT
- || ( _reader->nodeType() == XML_READER_TYPE_ELEMENT
- && _reader->isEmptyElement() ) )
- && _reader->name().c_str() == _name );
+ 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;
}
- bool nextElement()
+ std::string lookup( data::RecordId id_r )
{
- while ( ! atEnd() )
- {
- if ( ! _reader.nextNode() )
- return false;
- if ( _reader->nodeType() == XML_READER_TYPE_ELEMENT )
- return true;
- WAR << *_reader << endl;
- }
- return false;
- }
-
-
- xml::Reader & _reader;
- std::string _name;
- int _depth;
-};
-
-std::ostream & operator<<( std::ostream & str, const Element & obj )
-{
- str << ( obj.atBegin() ? 'B' : '_' )
- << ( obj.atEnd() ? 'E' : '_' )
- << obj._depth << ":" << std::string( obj._depth, ' ') << obj._name
- << " {" << *obj._reader << '}';
- return str;
-}
-
-bool dumpEl( xml::Reader & reader_r )
-{
- Element el( reader_r );
- return true;
-}
-
-void parse2( const InputStream & file_r )
-{
- Measure x( file_r.name() );
- try
+ if ( id_r == data::noRecordId )
{
- MIL << file_r << endl;
- xml::Reader r( file_r );
- MIL << *r << endl;
- Element el( r );
- MIL << *r << endl;
+ return "";
}
- catch ( const Exception & )
+
+ if ( _reverseMap.find( id_r ) != _reverseMap.end() )
{
+ return _reverseMap[id_r];
}
-}
-///////////////////////////////////////////////////////////////////
-class BasicParser
-{
- public:
- typedef function Consumer;
- typedef ExplicitMapstd::string,Consumer ConsumerMap;
-
- BasicParser( const InputStream & file_r )
- : _reader( file_r )
- , _cmap( nop )
- {}
- public:
- xml::Reader & reader()
- { return _reader; }
-
- const xml::Reader & reader() const
- { return _reader; }
-
- ConsumerMap & cmap()
- { return _cmap; }
-
- const ConsumerMap & cmap() const
- { return _cmap; }
-
- public:
+ WAR << "Lookup id " << id_r << "failed" << endl;
+ return std::string();
+ }
- bool parse( xml::Reader & reader_r )
+ void logNew( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
+ {
+ std::string shr( lookup( res_r->shareDataWith ) );
+ if ( ! shr.empty() )
{
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- case XML_READER_TYPE_TEXT:
- case XML_READER_TYPE_CDATA:
- case XML_READER_TYPE_END_ELEMENT:
- consume( reader_r );
- default:
- ;
- }
- return true;
+ DBG << " SHR: " << shr << endl;
}
+ //DBG << " SUM: " << res_r->summary << endl;
+ if ( 0&&kind_r == ResTraits<Package>::kind )
+ {
+ data::Package_Ptr p = dynamic_pointer_castdata::Package(res_r);
+ DBG << " PKG: " << p << endl;
+ DBG << " LOC: " << p->repositoryLocation << endl;
+ }
+ static unsigned n = 20;
+ if ( 0&&! --n )
+ throw;
+ }
public:
- void consume( xml::Reader & reader_r, const std::string & key_r )
- { _cmap[key_r]( reader_r ); }
-
- void consume( xml::Reader & reader_r )
- { consume( reader_r, reader_r->name().asString() ); }
-
- void consume()
- { consume( _reader ); }
-
- public:
- static void nop( xml::Reader & reader_r )
- { ; }
-
- static void log( xml::Reader & reader_r )
- { DBG << "NOP " << *reader_r << endl; }
-
-
- protected:
- xml::Reader _reader;
- ConsumerMap _cmap;
-};
-
-///////////////////////////////////////////////////////////////////
-struct RepomdParser : private BasicParser
-{
- RepomdParser( const InputStream & file_r )
- : BasicParser( file_r )
+ virtual data::RecordId consumePackage( const data::RecordId & repository_id, const data::Package_Ptr & res_r )
{
- reader().foreachNode( ref(*this) );
+ return newId( res_r, ResTraits<Package>::kind );
}
- bool operator()( xml::Reader & reader_r )
+ virtual data::RecordId consumeSourcePackage( const data::RecordId & repository_id, const data::SrcPackage_Ptr & res_r )
{
- return parse( reader_r );
+ return newId( res_r, ResTraits<SrcPackage>::kind );
}
- // READER goes here!
-};
-
-///////////////////////////////////////////////////////////////////
-struct Consume
-{
- struct Entry
+ virtual data::RecordId consumeProduct ( const data::RecordId & repository_id, const data::Product_Ptr & res_r )
{
- Pathname _location;
- CheckSum _checksum;
- //unused: Date _timestamp;
- //unused: CheckSum _openChecksum;
- };
-
- typedef void (Consume::*Consumer)( xml::Reader & reader_r );
+ return newId( res_r, ResTraits<Product>::kind );
+ }
- Consume( const InputStream & file_r )
- : _reader( file_r )
- , _consume( &Consume::nop )
- , _centry( NULL )
+ virtual data::RecordId consumePatch ( const data::RecordId & repository_id, const data::Patch_Ptr & res_r )
{
- _consume.set( "data", &Consume::data );
- _reader.foreachNode( ref(*this) );
+ return newId( res_r, ResTraits<Patch>::kind );
}
- bool operator()( xml::Reader & reader_r )
+ virtual data::RecordId consumePackageAtom ( const data::RecordId & repository_id, const data::PackageAtom_Ptr & res_r )
{
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- (this->*_consume[reader_r->name().asString()])( reader_r );
- //data( reader_r );
- break;
- default:
- WAR << *_reader << endl;
- break;
- }
- return true;
+ return newId( res_r, ResTraits<Atom>::kind );
}
- void nop( xml::Reader & reader_r )
- { ; }
-
- void log( xml::Reader & reader_r )
- { DBG << "NOP " << *_reader << endl; }
-
- void data( xml::Reader & reader_r )
+ virtual data::RecordId consumeMessage ( const data::RecordId & repository_id, const data::Message_Ptr & res_r )
{
- MIL << *_reader << endl;
- _result[reader_r->name().asString()] = Entry();
+ return newId( res_r, ResTraits<Message>::kind );
}
-
-
- xml::Reader _reader;
- ExplicitMapstd::string,Consumer _consume;
- std::mapstd::string,Entry _result;
- Entry * _centry;
-};
-
-std::ostream & operator<<( std::ostream & str, const Consume & obj )
-{
- return str;
-}
-
-std::ostream & operator<<( std::ostream & str, const Consume::Entry & obj )
-{
- return str << "Entry";
-}
-
-void parse( const InputStream & file_r )
-{
- Measure x( file_r.name() );
- try
- {
- MIL << file_r << endl;
- RepomdParser a( file_r );
- //WAR << a._result << endl;
- }
- catch ( const Exception & )
- {
- }
-}
-
-struct Test
-{
- struct Mix
+ virtual data::RecordId consumeScript ( const data::RecordId & repository_id, const data::Script_Ptr & res_r )
{
- Mix()
- : a( 0 )
- {}
-
- void seta( int v )
- { a = v; }
-
- void setb( const string & v )
- { b = v; }
-
- int a;
- string b;
- };
-
- Test()
- : a( 0 )
- {}
-
- int a;
- string b;
- Mix c;
-};
-
-std::ostream & operator<<( std::ostream & str, const Test & obj )
-{
- return str << "Test(" << obj.a << '|' << obj.b
- << '|' << obj.c.a << '|' << obj.c.b << ')';
-}
-
-struct Transform
-{
- Transform()
- : outfile( "susedu.xml", std::ios_base::out )
- {}
-
- static const bool indented = !false;
- static const bool shorttags = !true;
- std::fstream outfile;
-
- bool operator()( xml::Reader & reader_r )
- {
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- process( reader_r, true );
- break;
- case XML_READER_TYPE_END_ELEMENT:
- process( reader_r, false );
- break;
- default:
- //WAR << *reader_r << endl;
- break;
- }
- return true;
- }
-
- struct File
- {
- std::string name;
- std::string type;
-
- bool operator<( const File & rhs ) const
- { return( name < rhs.name ); }
- };
-
- struct Package
- {
- std::string pkgid;
- std::string name;
- std::string epoch;
- std::string ver;
- std::string rel;
- std::string arch;
- std::set<File> files;
- };
-
- shared_ptr<Package> pkg;
-
- void process( xml::Reader & reader_r, bool open_r )
- {
- if ( reader_r->name() == "file" )
- {
- if ( open_r )
- addFile( reader_r );
- }
- else if ( reader_r->name() == "version" )
- {
- if ( open_r )
- addVersion( reader_r );
- }
- else if ( reader_r->name() == "package" )
- {
- if ( open_r )
- startPackage( reader_r );
- else
- endPackage();
- }
- else if ( reader_r->name() == "filelists" )
- {
- DBG << *reader_r << endl;
- if ( open_r )
- {
- DBG << outfile << endl;
- outfile << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
- outfile << "<susedu>" << endl;
- }
- else
- {
- outfile << "</susedu>" << endl;
- outfile.close();
- }
- }
- else
- {
- throw;
- }
- }
-
- void startPackage( xml::Reader & reader_r )
- {
- endPackage();
- pkg.reset( new Package );
- pkg->pkgid = reader_r->getAttribute( "pkgid" ).asString();
- pkg->name = reader_r->getAttribute( "name" ).asString();
- pkg->arch = reader_r->getAttribute( "arch" ).asString();
- }
-
- void addVersion( xml::Reader & reader_r )
- {
- pkg->epoch = reader_r->getAttribute( "epoch" ).asString();
- pkg->ver = reader_r->getAttribute( "ver" ).asString();
- pkg->rel = reader_r->getAttribute( "rel" ).asString();
- }
-
- void addFile( xml::Reader & reader_r )
- {
- File f;
- f.type = reader_r->getAttribute( "type" ).asString();
- for( reader_r.nextNode();
- reader_r->nodeType() != XML_READER_TYPE_END_ELEMENT;
- reader_r.nextNode() )
- {
- if ( reader_r->nodeType() == XML_READER_TYPE_TEXT )
- {
- f.name = reader_r->value().asString();
- }
- }
- pkg->files.insert( f );
- }
-
- void endPackage()
- {
- if ( pkg )
- {
- writePackage( outfile );
- pkg.reset();
- }
- }
-
- static std::ostream & putAttr( std::ostream & stream_r,
- const std::string & tag_r,
- const std::string & value_r )
- {
- if ( value_r.empty() || tag_r.empty() )
- return stream_r;
- return stream_r
- << str::form( " %s=\"%s\"", tag_r.c_str(), value_r.c_str() );
- }
-
- void writePackage( std::ostream & stream_r )
- {
- stream_r << " pkgid );
- putAttr( stream_r, "name", pkg->name );
- putAttr( stream_r, "arch", pkg->arch );
- stream_r << ">\n";
-
- stream_r << " epoch );
- putAttr( stream_r, "ver", pkg->ver );
- putAttr( stream_r, "rel", pkg->rel );
- stream_r << "/>\n";
-
- writePackageFiles2( stream_r );
-
- stream_r << " </package>\n";
- }
-
- void writePackageFiles( std::ostream & stream_r )
- {
- for ( std::set<File>::const_iterator it = pkg->files.begin();
- it != pkg->files.end(); ++it )
- {
- stream_r << " type );
- stream_r << ">" << it->name << "</file>\n";
- }
- }
-
- struct Fnode
- {
- Fnode( const std::string & name_r )
- : name( name_r )
- , entry( NULL )
- {}
-
- std::string name;
- mutable const File * entry;
- mutable std::set<Fnode> children;
+ return newId( res_r, ResTraits<Script>::kind );
+ }
- const Fnode * add( const std::string & sub_r ) const
- {
- std::set<Fnode>::iterator i = children.find( sub_r );
- if ( i != children.end() )
- return &(*i);
- return &(*(children.insert( Fnode( sub_r ) ).first));
- }
+ virtual data::RecordId consumePattern ( const data::RecordId & repository_id, const data::Pattern_Ptr & res_r )
+ {
+ return newId( res_r, ResTraits<Pattern>::kind );
+ }
- void dump( std::ostream & stream_r, const std::string & pname, unsigned level ) const
- {
- std::string tname;
- if ( pname.empty() )
- {
- tname = name;
- }
- else if ( pname == "/" )
- {
- tname = pname+name;
- }
- else
- {
- tname = pname+"/"+name;
- }
-
- if ( children.size() == 1 )
- {
- children.begin()->dump( stream_r, tname, (indented?level:0) );
- return;
- }
-
- std::string tag;
- stream_r << std::string( level, ' ' );
-
- if ( entry )
- {
- tag = (shorttags ? "f" : "file");
- stream_r << "<" << tag;
- putAttr( stream_r, (shorttags ? "t" : "type"), entry->type );
- putAttr( stream_r, (shorttags ? "n" : "name"), tname );
- }
- else
- {
- tag = (shorttags ? "b" : "base");
- stream_r << "<" << tag;
- putAttr( stream_r, (shorttags ? "n" : "name"), tname );
- }
-
- if ( children.empty() )
- {
- stream_r << "/>" << (indented?"\n":"");
- }
- else
- {
- stream_r << ">" << (indented?"\n":"");
- for ( std::set<Fnode>::const_iterator it = children.begin();
- it != children.end(); ++it )
- {
- it->dump( stream_r, "", (indented?level+1:0) );
- }
- stream_r << std::string( level, ' ' ) << "" << tag << ">" << (indented?"\n":"");
- }
- }
+ virtual data::RecordId consumeChangelog ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const Changelog & )
+ { return data::RecordId(); }
- bool operator<( const Fnode & rhs ) const
- { return( name < rhs.name ); }
- };
-
- void writePackageFiles2( std::ostream & stream_r )
- {
- Fnode root( "" );
- for ( std::set<File>::const_iterator it = pkg->files.begin();
- it != pkg->files.end(); ++it )
- {
- std::liststd::string words;
- str::split( it->name, std::back_inserter(words), "/" );
-
- const Fnode * c = &root;
- for ( std::liststd::string::const_iterator w = words.begin();
- w != words.end(); ++w )
- {
- c = c->add( *w );
- }
- c->entry = &(*it);
- }
- root.dump( stream_r, "/", (indented?3:0) );
- }
+ virtual data::RecordId consumeFilelist ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const data::Filenames & )
+ { return data::RecordId(); }
+ void updatePackageLang( const data::RecordId & resolvable_id,
+ const data::Packagebase_Ptr & data_r )
+ {
+ SEC << lookup( resolvable_id ) << endl;
+ INT << " " << data_r->summary.text( Locale("en") ) << endl;
+ INT << " " << data_r->summary.locales() << endl;
+ INT << " " << data_r->summary.text() << endl;
+ INT << " " << data_r->summary.locales() << endl;
+ }
};
/******************************************************************
@@ -732,51 +183,11 @@
int main( int argc, char * argv[] )
{
INT << "===[START]==========================================" << endl;
- {
- Measure x;
- Pathname repodata( "/Local/PATCHES/repodata" );
- //repodata = "/Local/FACTORY/repodata";
- xml::Reader reader( repodata/"filelists.xml" );
- Transform t;
- reader.foreachNode( ref(t) );
- }
- INT << "===[END]============================================" << endl << endl;
- return 0;
- int s;
- Pathname repodata( "/Local/PATCHES/repodata" );
- //repodata = "/Local/FACTORY/repodata";
- InputStream x ( "/Local/PATCHES/repodata" );
- parse2( repodata/"repomd.xml" );
- //parse2( repodata/"primary.xml" );
+ DummyConsumer dummy;
+ RepoParser parser( data::RecordId(), dummy );
- INT << "===[END]============================================" << endl << endl;
- return 0;
- {
- Measure x;
- for ( int i = 1; i; --i )
- {
- parse( repodata/"repomd.xml" );
- parse( repodata/"primary.xml" );
- parse( repodata/"filelists.xml" );
- parse( repodata/"other.xml" );
- }
- }
- ERR << "done..." << endl;
- cin >> s;
- return 0;
- {
- Measure x;
- for ( int i = 20; i; --i )
- {
- parse( (repodata/"repomd.xml").asString() );
- parse( repodata/"primary.xml" );
- parse( repodata/"filelists.xml" );
- parse( repodata/"other.xml" );
- }
- }
- ERR << "done..." << endl;
- cin >> s;
+ parser.parse( "REPO" );
INT << "===[END]============================================" << endl << endl;
return 0;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org