backup
authorMichael Andres <ma@suse.de>
Fri, 20 Jul 2007 14:01:56 +0000 (14:01 +0000)
committerMichael Andres <ma@suse.de>
Fri, 20 Jul 2007 14:01:56 +0000 (14:01 +0000)
devel/devel.ma/Main.cc
devel/devel.ma/Parse.cc
devel/devel.ma/Tools.h

index bec223c..cabaa6c 100644 (file)
@@ -4,6 +4,7 @@
 #include "zypp/base/LogTools.h"
 #include "zypp/base/InputStream.h"
 
+#include "zypp/TmpPath.h"
 #include "zypp/RepoManager.h"
 
 using std::endl;
@@ -13,8 +14,8 @@ using namespace zypp;
 
 RepoManager makeRepoManager( const Pathname & mgrdir_r )
 {
-  RepoManagerOptions mgropt;
 
+  RepoManagerOptions mgropt;
   mgropt.repoCachePath    = mgrdir_r/"cache";
   mgropt.repoRawCachePath = mgrdir_r/"raw_cache";
   mgropt.knownReposPath   = mgrdir_r/"repos";
@@ -31,7 +32,7 @@ int main( int argc, char * argv[] )
 {
   INT << "===[START]==========================================" << endl;
 
-  RepoManager repoManager( makeRepoManager( "/tmp/myrepos" ) );
+  RepoManager repoManager( makeRepoManager( "/ROOT" ) );
   RepoInfoList repos = repoManager.knownRepositories();
   SEC << repos << endl;
 
index 7b3f3b6..5b4cdbb 100644 (file)
@@ -259,7 +259,7 @@ int main( int argc, char * argv[] )
   //zypp::base::LogControl::instance().logfile( "log.restrict" );
   INT << "===[START]==========================================" << endl;
 
-  RepoManager  repoManager;
+  RepoManager repoManager( makeRepoManager( "/ROOT" ) );
   RepoInfoList repos = repoManager.knownRepositories();
   SEC << repos << endl;
 
@@ -274,12 +274,12 @@ int main( int argc, char * argv[] )
        .addBaseUrl( Url("ftp://dist.suse.de/install/stable-x86/") );
 
     repoManager.addRepository( nrepo );
-    repos = repoManager.knownRepositories();
     SEC << "refreshMetadat" << endl;
     repoManager.refreshMetadata( nrepo );
     SEC << "buildCache" << endl;
     repoManager.buildCache( nrepo );
     SEC << "------" << endl;
+    repos = repoManager.knownRepositories();
   }
 
   ResPool pool( getZYpp()->pool() );
@@ -301,9 +301,12 @@ int main( int argc, char * argv[] )
       SEC << "buildCache" << endl;
       repoManager.buildCache( nrepo );
     }
+
     SEC << nrepo << endl;
+
     Repository nrep( repoManager.createFromCache( nrepo ) );
     const zypp::ResStore & store( nrep.resolvables() );
+
     dumpPoolStats( SEC << "Store: " << endl,
                   store.begin(), store.end() ) << endl;
     getZYpp()->addResolvables( store );
index c2db5f9..206f729 100644 (file)
@@ -18,6 +18,7 @@
 #include <zypp/pool/PoolStats.h>
 
 #include <zypp/Repository.h>
+#include <zypp/RepoManager.h>
 
 using namespace zypp;
 using zypp::debug::Measure;
@@ -90,6 +91,20 @@ template<class _Container>
   }
 
 ///////////////////////////////////////////////////////////////////
+
+inline RepoManager makeRepoManager( const Pathname & mgrdir_r )
+{
+
+  RepoManagerOptions mgropt;
+  mgropt.repoCachePath    = mgrdir_r/"cache";
+  mgropt.repoRawCachePath = mgrdir_r/"raw_cache";
+  mgropt.knownReposPath   = mgrdir_r/"repos";
+
+  return RepoManager( mgropt );
+}
+
+///////////////////////////////////////////////////////////////////
+
 inline Repository createSource( const Url & url_r, const std::string & alias_r = std::string() )
 {
   Repository ret;