backup
authorMichael Andres <ma@suse.de>
Wed, 9 Jul 2008 16:07:35 +0000 (16:07 +0000)
committerMichael Andres <ma@suse.de>
Wed, 9 Jul 2008 16:07:35 +0000 (16:07 +0000)
devel/devel.ma/Main.cc
devel/devel.ma/Tools.h

index 2457e19..df98807 100644 (file)
@@ -1,4 +1,4 @@
-#include <iostream>
+#include "Tools.h"
 
 #include "zypp/base/Easy.h"
 #include "zypp/base/LogTools.h"
@@ -8,7 +8,11 @@
 #include "zypp/base/PtrTypes.h"
 
 #include "zypp/TmpPath.h"
+
 #include "zypp/RepoManager.h"
+#include "zypp/RepoInfo.h"
+
+#include "zypp/ResPoolProxy.h"
 
 using std::endl;
 using namespace zypp;
@@ -19,6 +23,42 @@ static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/R
 
 ///////////////////////////////////////////////////////////////////
 
+bool solve()
+{
+  bool rres = false;
+  {
+    //zypp::base::LogControl::TmpLineWriter shutUp;
+    rres = getZYpp()->resolver()->resolvePool();
+  }
+  if ( ! rres )
+  {
+    ERR << "resolve " << rres << endl;
+    return false;
+  }
+  MIL << "resolve " << rres << endl;
+  return true;
+}
+
+void mksrc( const std::string & url, const std::string & alias )
+{
+  RepoManager repoManager( makeRepoManager( sysRoot ) );
+
+  RepoInfo nrepo;
+  nrepo
+      .setAlias( alias )
+      .setName( alias )
+      .setEnabled( true )
+      .setAutorefresh( false )
+      .addBaseUrl( Url(url) );
+
+  if ( ! repoManager.isCached( nrepo ) )
+  {
+    repoManager.buildCache( nrepo );
+  }
+
+  repoManager.loadFromCache( nrepo );
+}
+
 /******************************************************************
 **
 **      FUNCTION NAME : main
@@ -28,21 +68,29 @@ int main( int argc, char * argv[] )
 {
   INT << "===[START]==========================================" << endl;
 
-  //TmpDir tmp_dir;
-  //KeyRing keyring( tmp_dir.path() );
+  ResPool   pool( ResPool::instance() );
+  sat::Pool satpool( sat::Pool::instance() );
+
+  mksrc( "file:///schnell/CD-ARCHIVE/SLES10/SLE-10-SP1/SLES-10-SP1-GM/ia64/DVD1", "SLE" );
+  mksrc( "file:///mounts/dist/install/SLP/SLES-10-SP2-AS-LATEST/i386/CD1", "factorytest" );
+
+  USR << "pool: " << pool << endl;
 
+  getSel<Product>( "SUSE_SLES_SP1" )->setStatus( ui::S_Install );
+  //getSel<Pattern>( "basesystem" )->setStatus( ui::S_Install );
+  //getSel<Pattern>( "slesas-ofed-base" )->setStatus( ui::S_Install );
+
+  if ( 1 )
   {
-    Measure x( "INIT TARGET" );
-    {
-      {
-        //zypp::base::LogControl::TmpLineWriter shutUp;
-        getZYpp()->initializeTarget( sysRoot );
-      }
-      //getZYpp()->target()->load();
-    }
+    vdumpPoolStats( USR << "Transacting:"<< endl,
+                    make_filter_begin<resfilter::ByTransact>(pool),
+                    make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+    solve();
+    vdumpPoolStats( USR << "Transacting:"<< endl,
+                    make_filter_begin<resfilter::ByTransact>(pool),
+                    make_filter_end<resfilter::ByTransact>(pool) ) << endl;
   }
 
-
   INT << "===[END]============================================" << endl << endl;
   return 0;
 }
index 1683fee..a20d3e4 100644 (file)
@@ -23,6 +23,7 @@
 #include "zypp/ZYppFactory.h"
 #include "zypp/ResPool.h"
 #include "zypp/ResPoolProxy.h"
+#include "zypp/ui/Selectable.h"
 #include <zypp/Repository.h>
 #include <zypp/RepoManager.h>