Author: mlandres
Date: Thu Nov 6 18:30:27 2008
New Revision: 11606
URL: http://svn.opensuse.org/viewcvs/zypp?rev=11606&view=rev
Log:
add TestSetup::loadRepos: Load all enabled repos in repos.d to pool.
Modified:
trunk/libzypp/devel/devel.ma/NewPool.cc
trunk/libzypp/devel/devel.ma/Test.cc
trunk/libzypp/devel/devel.ma/ToolScanRepos.cc
trunk/libzypp/tests/lib/TestSetup.h
Modified: trunk/libzypp/devel/devel.ma/NewPool.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/NewPool.cc?rev=11606&r1=11605&r2=11606&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/NewPool.cc (original)
+++ trunk/libzypp/devel/devel.ma/NewPool.cc Thu Nov 6 18:30:27 2008
@@ -501,8 +501,8 @@
getZYpp()->initializeTarget( sysRoot );
}
getZYpp()->target()->load();
- USR << getZYpp()->target()->targetDistribution() << endl;
- USR << getZYpp()->target()->targetDistributionRelease() << endl;
+ USR << "targetDistribution: " << getZYpp()->target()->targetDistribution() << endl;
+ USR << "targetDistributionRelease: " << getZYpp()->target()->targetDistributionRelease() << endl;
dumpRange( USR << "Product ", pool.byKindBegin<Product>(), pool.byKindEnd<Product>() ) << endl;
}
}
Modified: trunk/libzypp/devel/devel.ma/Test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Test.cc?rev=11606&r1=11605&r2=11606&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Test.cc (original)
+++ trunk/libzypp/devel/devel.ma/Test.cc Thu Nov 6 18:30:27 2008
@@ -1,28 +1,4 @@
#include "Tools.h"
-#include "ExplicitMap.h"
-#include
-
-#include <iostream>
-#include <fstream>
-#include <map>
-
-#include
-#include
-#include "zypp/base/Exception.h"
-#include "zypp/base/InputStream.h"
-#include "zypp/base/DefaultIntegral.h"
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-using namespace std;
-using namespace zypp;
-
-///////////////////////////////////////////////////////////////////
/******************************************************************
**
@@ -33,6 +9,13 @@
{
INT << "===[START]==========================================" << endl;
+ // https://bugzilla.novell.com/show_bug.cgi?id=442200
+
+ Pathname mroot( "/tmp/ToolScanRepos" );
+ TestSetup test( mroot, Arch_x86_64 );
+ test.loadRepos();
+
+
INT << "===[END]============================================" << endl << endl;
return 0;
}
Modified: trunk/libzypp/devel/devel.ma/ToolScanRepos.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/ToolScanRepos.cc?rev=11606&r1=11605&r2=11606&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/ToolScanRepos.cc (original)
+++ trunk/libzypp/devel/devel.ma/ToolScanRepos.cc Thu Nov 6 18:30:27 2008
@@ -14,13 +14,22 @@
if ( ! argc )
{
- cerr << "Usage: " << appname << " URL..." << endl;
- cerr << " Load repos from URL to test system below /tmp/" << appname << endl;
+ cerr << "Usage: " << appname << "[OPTIONS] URL..." << endl;
+ cerr << " Load repos from URL to test system below /tmp/" << appname << "." << endl;
+ cerr << " --nc Do not clear an existing test system but reuse it." << endl;
return 0;
}
Pathname mroot( "/tmp/"+appname );
- filesystem::recursive_rmdir( mroot );
+ if ( argc && argv[0] == std::string("--nc") )
+ {
+ --argc;
+ ++argv;
+ }
+ else
+ {
+ filesystem::recursive_rmdir( mroot );
+ }
filesystem::assert_dir( mroot );
TestSetup test( mroot, Arch_x86_64 );
Modified: trunk/libzypp/tests/lib/TestSetup.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/lib/TestSetup.h?rev=11606&r1=11605&r2=11606&view=diff
==============================================================================
--- trunk/libzypp/tests/lib/TestSetup.h (original)
+++ trunk/libzypp/tests/lib/TestSetup.h Thu Nov 6 18:30:27 2008
@@ -84,6 +84,7 @@
void loadRepo( RepoInfo nrepo )
{
RepoManager rmanager( repomanager() );
+ rmanager.addRepository( nrepo );
rmanager.buildCache( nrepo );
rmanager.loadFromCache( nrepo );
}
@@ -112,6 +113,37 @@
satpool().addRepoSolv( path_r, nrepo );
}
+ public:
+ /** Load all enabled repos in repos.d to pool. */
+ void loadRepos()
+ {
+ RepoManager repoManager( repomanager() );
+ RepoInfoList repos = repoManager.knownRepositories();
+ for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
+ {
+ RepoInfo & nrepo( *it );
+ USR << nrepo << endl;
+
+ if ( ! nrepo.enabled() )
+ continue;
+
+ if ( ! repoManager.isCached( nrepo ) || nrepo.type() == repo::RepoType::RPMPLAINDIR )
+ {
+ if ( repoManager.isCached( nrepo ) )
+ {
+ USR << "cleanCache" << endl;
+ repoManager.cleanCache( nrepo );
+ }
+ //USR << "refreshMetadata" << endl;
+ //repoManager.refreshMetadata( nrepo );
+ USR << "buildCache" << endl;
+ repoManager.buildCache( nrepo );
+ }
+ USR << "Create from cache" << endl;
+ repoManager.loadFromCache( nrepo );
+ }
+
+ }
private:
void _ctor( const Pathname & rootdir_r, const Arch & sysarch_r )
{
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org