Mailinglist Archive: zypp-commit (266 mails)

< Previous Next >
[zypp-commit] r11606 - in /trunk/libzypp: devel/devel.ma/NewPool.cc devel/devel.ma/Test.cc devel/devel.ma/ToolScanRepos.cc tests/lib/TestSetup.h
  • From: mlandres@xxxxxxxxxxxxxxxx
  • Date: Thu, 06 Nov 2008 17:30:28 -0000
  • Message-id: <20081106173028.4163933920@xxxxxxxxxxxxxxxx>
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 <boost/call_traits.hpp>
-
-#include <iostream>
-#include <fstream>
-#include <map>
-
-#include <zypp/base/LogControl.h>
-#include <zypp/base/LogTools.h>
-#include "zypp/base/Exception.h"
-#include "zypp/base/InputStream.h"
-#include "zypp/base/DefaultIntegral.h"
-#include <zypp/base/Function.h>
-#include <zypp/base/Iterator.h>
-
-#include <zypp/Pathname.h>
-#include <zypp/Edition.h>
-#include <zypp/CheckSum.h>
-#include <zypp/Date.h>
-
-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@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages