Author: mlandres
Date: Wed Apr 11 18:41:40 2007
New Revision: 5343
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5343&view=rev
Log: (empty)
Modified:
trunk/libzypp/devel/devel.ma/CMakeLists.txt
trunk/libzypp/devel/devel.ma/Main.cc
trunk/libzypp/devel/devel.ma/Tools.h
Modified: trunk/libzypp/devel/devel.ma/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/CMakeLists.txt?rev=5343&r1=5342&r2=5343&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/CMakeLists.txt (original)
+++ trunk/libzypp/devel/devel.ma/CMakeLists.txt Wed Apr 11 18:41:40 2007
@@ -29,7 +29,7 @@
## ############################################################
-FOREACH( loop_var ScanSource Iorder Parse Xml )
+FOREACH( loop_var ScanSource Iorder Parse Xml Main)
ADD_EXECUTABLE( ${loop_var}
${loop_var}.cc
)
Modified: trunk/libzypp/devel/devel.ma/Main.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Main.cc?rev=5343&r1=5342&r2=5343&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Main.cc (original)
+++ trunk/libzypp/devel/devel.ma/Main.cc Wed Apr 11 18:41:40 2007
@@ -1,237 +1,47 @@
#include "Tools.h"
-#include
-#include
-#include
-
-#include <iostream>
-#include <fstream>
-#include <list>
-#include <map>
-#include <set>
-
-#include
-
-#include
-#include
-
-#include "zypp/parser/xml/Reader.h"
-
-using namespace std;
-using namespace zypp;
+#include "FakePool.h"
#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;
- }
-
-///////////////////////////////////////////////////////////////////
-
-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 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/ZYppFactory.h"
+#include "zypp/ResPoolProxy.h"
+#include
+#include
+
+#include "zypp/ZYppCallbacks.h"
+#include "zypp/NVRAD.h"
+#include "zypp/ResPool.h"
+#include "zypp/ResFilters.h"
+#include "zypp/CapFilters.h"
+#include "zypp/Package.h"
+#include "zypp/Pattern.h"
+#include "zypp/Language.h"
+#include "zypp/PackageKeyword.h"
+#include "zypp/NameKindProxy.h"
+#include "zypp/pool/GetResolvablesToInsDel.h"
-template<class _OutputIterator>
- struct DumpDeps
- {
- DumpDeps( _OutputIterator result_r )
- : _result( result_r )
- {}
-
- bool operator()( xml::Reader & reader_r )
- {
- if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT
- && reader_r->prefix() == "rpm"
- && reader_r->localName() == "entry" )
- {
- string n( reader_r->getAttribute( "name" ).asString() );
- Rel op( reader_r->getAttribute( "flags" ).asString() );
- if ( op != Rel::ANY )
- {
- n += " ";
- n += op.asString();
- n += " ";
- n += reader_r->getAttribute( "ver" ).asString();
- n += "-";
- n += reader_r->getAttribute( "rel" ).asString();
- }
- *_result = n;
- ++_result;
- }
- return true;
- }
-
- _OutputIterator _result;
- };
-
-template<class _OutputIterator>
- DumpDeps<_OutputIterator> dumpDeps( _OutputIterator result_r )
- { return DumpDeps<_OutputIterator>( result_r ); }
+using namespace std;
+using namespace zypp;
///////////////////////////////////////////////////////////////////
-void fillSet( const std::liststd::string & list_r )
-{
- Measure m( "Set " );
- std::setstd::string s( list_r.begin(), list_r.end() );
- MIL << s.size() << endl;
- m.stop();
-}
-
-void fillHashSet( const std::liststd::string & list_r )
+template<class _Iterator>
+ void addPool( _Iterator begin_r, _Iterator end_r )
{
- Measure m( "HashSet " );
- hash_setstd::string s( list_r.begin(), list_r.end() );
- MIL << s.size() << endl;
- m.stop();
+ using zypp::debug::DataCollect;
+ DataCollect dataCollect;
+ dataCollect.collect( begin_r, end_r );
+ getZYpp()->addResolvables( dataCollect.installed(), true );
+ getZYpp()->addResolvables( dataCollect.available() );
+ vdumpPoolStats( USR << "Pool:" << endl,
+ getZYpp()->pool().begin(),
+ getZYpp()->pool().end() ) << endl;
}
-void fillMap( const std::liststd::string & list_r )
-{
- Measure m( "Map " );
- std::mapstd::string,std::string s;
- for ( std::liststd::string::const_iterator it = list_r.begin(); it != list_r.end(); ++it )
- {
- s[*it] = *it;
- }
- MIL << s.size() << endl;
- m.stop();
-}
-
-void fillHashMap( const std::liststd::string & list_r )
-{
- Measure m( "HashMap " );
- hash_mapstd::string,std::string s;
- for ( std::liststd::string::const_iterator it = list_r.begin(); it != list_r.end(); ++it )
- {
- s[*it] = *it;
- }
- MIL << s.size() << endl;
- m.stop();
-}
-
-void lfillStd( const std::liststd::string & list_r )
-{
- Measure x( "lfillStd " );
- std::setstd::string s;
- std::mapstd::string,std::string m;
-
- for ( std::liststd::string::const_iterator it = list_r.begin(); it != list_r.end(); ++it )
- {
- if ( m[*it].empty() )
- {
- m[*it] = *it;
- s.insert( *it );
- }
- }
- MIL << m.size() << " " << s.size() << endl;
- x.stop();
-}
-
-void parseCaps( const std::liststd::string & list_r )
-{
- Measure x( "parseCaps" );
- for ( std::liststd::string::const_iterator it = list_r.begin(); it != list_r.end(); ++it )
- {
- CapFactory().parse( ResTraits<Package>::kind, *it );
- }
- x.stop();
-}
-
-void parseCapsAndInsert( const std::liststd::string & list_r )
-{
- Measure x( "parseCapsAndInsert" );
- CapSet s;
- for ( std::liststd::string::const_iterator it = list_r.begin(); it != list_r.end(); ++it )
- {
- s.insert( CapFactory().parse( ResTraits<Package>::kind, *it ) );
- }
- x.stop();
-}
-
-
/******************************************************************
**
** FUNCTION NAME : main
@@ -240,30 +50,31 @@
int main( int argc, char * argv[] )
{
INT << "===[START]==========================================" << endl;
- --argc;
- ++argv;
- Pathname repodata;
- if ( argc )
- {
- repodata = *argv;
- }
- else
- {
- repodata = "/Local/FACTORY/repodata";
- repodata /= "primary.xml";
- }
-
- std::liststd::string depstrings;
-
- Measure m( "Parse" );
- xml::Reader reader( repodata );
- reader.foreachNodeOrAttribute( dumpDeps( std::back_inserter(depstrings) ) );
- m.stop();
-
- MIL << "raw depstrings " << depstrings.size() << endl;
- parseCaps( depstrings );
- parseCapsAndInsert( depstrings );
+ const char * data[] = {
+ "@ package",
+ "@ installed",
+ "@ available",
+ "- glibc 2.3.4 31 i686",
+ "- glibc 2.3.5 28 i586",
+ "- glibc-locale 2.3.5 28 i686",
+ "@ requires",
+ "glibc == 2.3.5",
+ "@ fin"
+ };
+ addPool( data, data + ( sizeof(data) / sizeof(const char *) ) );
+
+ ResPool pool( getZYpp()->pool() );
+
+ vdumpPoolStats( USR << "Pool:" << endl,
+ getZYpp()->pool().begin(),
+ getZYpp()->pool().end() ) << endl;
+
+ // solve();
+
+ vdumpPoolStats( USR << "Pool:" << endl,
+ getZYpp()->pool().begin(),
+ getZYpp()->pool().end() ) << endl;
INT << "===[END]============================================" << endl << endl;
return 0;
Modified: trunk/libzypp/devel/devel.ma/Tools.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Tools.h?rev=5343&r1=5342&r2=5343&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Tools.h (original)
+++ trunk/libzypp/devel/devel.ma/Tools.h Wed Apr 11 18:41:40 2007
@@ -2,6 +2,10 @@
#define Tools_h
#include <iostream>
+#include <fstream>
+#include <list>
+#include <map>
+#include <set>
#include "Printing.h"
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org