#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::functor;
}
-#include "zypp/ProgressData.h"
-#include "zypp2/cache/CacheStore.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- namespace parser
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-#if 0
- class RepoParser
- {
- public:
- RepoParser( const Pathname & reporoot_r, data::RecordId catalogId_r, const Pathname & dbdir_r )
- : _reporoot( reporoot_r )
- , _catalogId( catalogId_r )
- , _store( store_r );
- {
- if ( 1 )
- {
- std::string file( "content" );
- Measure x( file );
-
- ContentFileReader tp;
-
-
- }
-
-
- if ( 1 )
- {
- std::string file("packages");
- Measure x( file );
-
- PackagesFileReader tp;
- tp.setPkgConsumer ( bind( &RepoParser::consumePkg, this, _1 ) );
- tp.setSrcPkgConsumer( bind( &RepoParser::consumeSrcPkg , this, _1 ) );
- tp.parse(repodescr()/file );
- }
- }
-
-
- public:
- const Pathname & reporoot() const
- { return _reporoot; }
-
- Pathname repodescr() const
- { return _reporoot/"suse/setup/descr"; }
-
- Pathname repodata() const
- { return _reporoot/"suse"; }
-
- private:
- void consumePkg( const data::Package_Ptr & pkg_r )
- {
- MIL << "[Pkg]" << pkg_r << endl;
- }
-
- void consumeSrcPkg( const data::SrcPackage_Ptr & pkg_r )
- {
- //DBG << "[Src]" << pkg_r << endl;
- }
-
- void consumePat( const data::Pattern_Ptr & pat_r )
- {
- MIL << "[Pat]" << pat_r << endl;
- }
- public:
- Pathname _reporoot;
- data::RecordId _catalogId;
- cache::CacheStore _store;
-
- };
-
-#endif
-
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace parser
- ///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
using namespace zypp::parser::susetags;
-#include "zypp2/cache/CacheStore.h"
+#include "zypp/cache/CacheStore.h"
void consumeIndex( const parser::susetags::RepoIndex_Ptr & index_r )
{
tp.setConsumer( consumePat );
tp.parse( p );
}
+
/******************************************************************
**
** FUNCTION NAME : main
//zypp::base::LogControl::instance().logfile( "log.restrict" );
INT << "===[START]==========================================" << endl;
- Pathname p( "lmd/content" );
+ Pathname dbdir( "store" );
+ Pathname reporoot( "lmd" );
- Measure x( p.basename() );
+ cache::CacheStore store( dbdir );
+ data::RecordId repositoryId = store.lookupOrAppendRepository( Url("dir:///"), "/" );
+ {
+ Measure x( "XXXXXXXXXXXXX" );
+
+ parser::susetags::RepoParser repo( repositoryId, store );
+ repo.parse( reporoot );
+
+ store.commit();
+ }
+
+
+#if 0
ContentFileReader tp;
tp.setProductConsumer( consumeProd );
tp.setRepoIndexConsumer( consumeIndex );
tp.parse( p );
-#if 0
//try
{
//Pathname dbdir( "/Local/ma/zypp-TRUNK/BUILD/libzypp/devel/devel.ma/store" );
Pathname metadir( "lmd" );
cache::CacheStore store( dbdir );
- data::RecordId catalogId = store.lookupOrAppendCatalog( Url("http://www.google.com"), "/" );
+ data::RecordId repositoryId = store.lookupOrAppendRepository( Url("http://www.google.com"), "/" );
- RepoParser( metadir, catalogId, store );
+ RepoParser( metadir, repositoryId, store );
}
Pathname dbfile( "data.db" );
cache::CacheStore store(getenv("PWD"));
- data::RecordId catalog_id = store.lookupOrAppendCatalog( Url("http://www.google.com"), "/");
+ data::RecordId repository_id = store.lookupOrAppendRepository( Url("http://www.google.com"), "/");
- PackagesParser parser( catalog_id, store);
+ PackagesParser parser( repository_id, store);
Measure m;
parser.start(argv[1], &progress_function);
m.elapsed();