backup
authorMichael Andres <ma@suse.de>
Fri, 17 Oct 2008 14:42:22 +0000 (14:42 +0000)
committerMichael Andres <ma@suse.de>
Fri, 17 Oct 2008 14:42:22 +0000 (14:42 +0000)
devel/devel.ma/CMakeLists.txt
devel/devel.ma/ScanSource.cc [deleted file]
devel/devel.ma/ToolScanRepos.cc [new file with mode: 0644]
devel/devel.ma/Tools.h

index ef6db03..b042d7e 100644 (file)
@@ -24,7 +24,7 @@ ADD_CUSTOM_TARGET( ma_test
 
 ## ############################################################
 
-FOREACH( loop_var NewPool DumpSolv ScanSource Iorder Xml Ex Main FakePool AOUT Parse Test Basic Sat)
+FOREACH( loop_var MaTest NewPool DumpSolv Iorder Xml Ex Main FakePool AOUT Parse Test Basic Sat)
    ADD_EXECUTABLE( ${loop_var}
       ${loop_var}.cc
    )
@@ -34,13 +34,12 @@ FOREACH( loop_var NewPool DumpSolv ScanSource Iorder Xml Ex Main FakePool AOUT P
 ENDFOREACH( loop_var )
 
 
-FOREACH( loop_var MaTest )
+FOREACH( loop_var ToolScanRepos )
    ADD_EXECUTABLE( ${loop_var}
       ${loop_var}.cc
    )
    TARGET_LINK_LIBRARIES( ${loop_var}
       zypp
-#${QT_LIBRARIES}
    )
 ENDFOREACH( loop_var )
 
diff --git a/devel/devel.ma/ScanSource.cc b/devel/devel.ma/ScanSource.cc
deleted file mode 100644 (file)
index f168362..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-#include <iostream>
-
-#include <zypp/base/LogControl.h>
-#include <zypp/base/LogTools.h>
-#include <zypp/SourceFactory.h>
-#include <zypp/Source.h>
-#include <zypp/ResStore.h>
-#include <zypp/ResObject.h>
-#include <zypp/pool/PoolStats.h>
-#include <zypp/KeyRing.h>
-#include <zypp/Date.h>
-#include <zypp/SourceManager.h>
-#include <zypp/ManagedFile.h>
-
-using namespace std;
-using namespace zypp;
-
-static bool verbose = false;
-static bool debug   = false;
-
-#define LOG (debug ? USR : cout)
-
-#include <zypp/ManagedFile.h>
-#include "zypp/source/PackageProvider.h"
-
-    static void sourceProvidePackage( const ResObject::Ptr & pi )
-    {
-      // Redirect PackageProvider queries for installed editions
-      // (in case of patch/delta rpm processing) to rpmDb.
-      source::PackageProviderPolicy packageProviderPolicy;
-      //packageProviderPolicy.queryInstalledCB( QueryInstalledEditionHelper() );
-
-      Package::constPtr p = asKind<Package>(pi);
-      if ( p )
-      {
-       source::PackageProvider pkgProvider( p, packageProviderPolicy );
-       SEC << "++++" << endl;
-       ManagedFile r( pkgProvider.providePackage() );
-       SEC << "---" << endl;
-      }
-      SEC << "-" << endl;
-    }
-
-struct KeyRingReceiver : public callback::ReceiveReport<KeyRingReport>
-{
-  KeyRingReceiver()
-  {
-    connect();
-  }
-
-  virtual bool askUserToAcceptUnsignedFile( const std::string & file )
-  {
-    LOG << "===[UnsignedFile " << file << "]" << endl;
-    return true;
-  }
-  virtual bool askUserToAcceptUnknownKey( const std::string &file,
-                                          const std::string &id )
-  {
-    LOG << "===[UnknownKey " << id << "]" << endl;
-    return true;
-  }
-  virtual bool askUserToTrustKey( const PublicKey &key)
-  {
-    LOG << "===[TrustKey" << key << "]" << endl;
-    return true;
-  }
-  virtual bool askUserToImportKey( const PublicKey &key)
-  {
-    LOG << "===[ImportKey " << key << "]" << endl;
-    return true;
-  }
-  virtual bool askUserToAcceptVerificationFailed( const std::string &file,
-                                                  const PublicKey &key )
-  {
-    LOG << "===[VerificationFailed " << file << " " << key << "]" << endl;
-    return true;
-  }
-};
-
-struct ResStoreStats : public pool::PoolStats
-{
-  void operator()( const ResObject::constPtr & obj )
-  {
-    if ( isKind<Product>( obj ) )
-      {
-        LOG << obj << endl;
-      }
-    pool::PoolStats::operator()( obj );
-  }
-};
-
-/******************************************************************
-**
-**      FUNCTION NAME : main
-**      FUNCTION TYPE : int
-*/
-int main( int argc, char * argv[] )
-{
-  //zypp::base::LogControl::instance().logfile( "" );
-  INT << "===[START]==========================================" << endl;
-  --argc;
-  ++argv;
-
-  if ( ! argc )
-    {
-      LOG << "Usage: ScanSource [options] url [[options] url...]" << endl;
-      LOG << "  Display summary of Sources found at 'url'. " << endl;
-      LOG << "  " << endl;
-      LOG << "  " << endl;
-      LOG << "  options:" << endl;
-      LOG << "  +/-l    enable/disable detailed listing of Source content" << endl;
-      LOG << "  +/-d    enable/disable debug output" << endl;
-      return 0;
-    }
-
-  KeyRingReceiver accept;
-
-  for ( ; argc; --argc, ++argv )
-    {
-      if ( *argv == string("+l") )
-        {
-          verbose = true;
-          continue;
-        }
-      if ( *argv == string("-l") )
-        {
-          verbose = false;
-          continue;
-        }
-      if ( *argv == string("+d") )
-        {
-          zypp::base::LogControl::instance().logfile( "-" );
-          debug = true;
-          continue;
-        }
-      if ( *argv == string("-d") )
-        {
-          zypp::base::LogControl::instance().logfile( "" );
-          debug = false;
-          continue;
-        }
-
-      LOG << "====================================================" << endl;
-      LOG << "===Search Source at Url(" << *argv << ")..." << endl;
-      Source_Ref src;
-      try
-        {
-          Url url(*argv);
-          try
-            {
-              src = SourceFactory().createFrom( url, "/", Date::now().asSeconds() );
-            }
-          catch ( const source::SourceUnknownTypeException & )
-            {
-              src = SourceFactory().createFrom( "Plaindir", url, "/", Date::now().asSeconds(), "", false, true );
-            }
-        }
-      catch ( const Exception & except_r )
-        {
-          LOG << "***Failed: " << except_r << endl;
-          continue;
-        }
-      LOG << "type:           " << src.type() << endl;
-      LOG << "numberOfMedia:  " << src.numberOfMedia() << endl;
-      LOG << "alias:          " << src.alias() << endl;
-      LOG << "vendor:         " << src.vendor() << endl;
-      LOG << "unique_id:      " << src.unique_id() << endl;
-      LOG << "baseSource:     " << src.baseSource() << endl;
-      LOG << "autorefresh:    " << src.autorefresh() << endl;
-      LOG << "publicKeys:     " << src.publicKeys() << endl;
-
-      LOG << "===Parse content..." << endl;
-      try
-        {
-          src.resolvables();
-        }
-      catch ( const Exception & except_r )
-        {
-          LOG << "***Failed: " << except_r << endl;
-          continue;
-        }
-      LOG << for_each( src.resolvables().begin(), src.resolvables().end(),
-                       ResStoreStats() ) << endl;
-
-      for_each( src.resolvables().begin(),
-               src.resolvables().end(),
-               sourceProvidePackage );
-
-      if ( verbose )
-        {
-          dumpRange( LOG, src.resolvables().begin(), src.resolvables().end() ) << endl;
-        }
-
-      //SourceManager::sourceManager()->addSource( src );
-      //SourceManager::sourceManager()->store( "/", true );
-    }
-
-  INT << "===[END]============================================" << endl << endl;
-  return 0;
-}
-
diff --git a/devel/devel.ma/ToolScanRepos.cc b/devel/devel.ma/ToolScanRepos.cc
new file mode 100644 (file)
index 0000000..39413fa
--- /dev/null
@@ -0,0 +1,37 @@
+#include "Tools.h"
+
+/******************************************************************
+**
+**      FUNCTION NAME : main
+**      FUNCTION TYPE : int
+*/
+int main( int argc, char * argv[] )
+{
+  INT << "===[START]==========================================" << endl;
+  std::string appname( Pathname::basename( argv[0] ) );
+  --argc;
+  ++argv;
+
+  if ( ! argc )
+  {
+    cerr << "Usage: " << appname << " URL..." << endl;
+    cerr << "  Load repos from URL to test system below /tmp/" << appname << endl;
+    return 0;
+  }
+
+  Pathname mroot( "/tmp/"+appname );
+  filesystem::recursive_rmdir( mroot );
+  filesystem::assert_dir( mroot );
+  TestSetup test( mroot, Arch_x86_64 );
+
+  while ( argc )
+  {
+    test.loadRepo( Url( argv[0] ) );
+    --argc;
+    ++argv;
+  }
+
+  INT << "===[END]============================================" << endl << endl;
+  return 0;
+}
+
index 18515f8..17d734e 100644 (file)
@@ -12,7 +12,7 @@
 #include "FakePool.h"
 
 #define INCLUDE_TESTSETUP_WITHOUT_BOOST
-#include "zypp/../tests/include/TestSetup.h"
+#include "zypp/../tests/lib/TestSetup.h"
 #undef  INCLUDE_TESTSETUP_WITHOUT_BOOST
 
 #include <zypp/base/Easy.h>