[zypp-commit] r6367 - in /trunk/libzypp/devel/devel.aschnell: parse1.cc parse2.cc
Author: aschnell Date: Wed Aug 1 15:53:27 2007 New Revision: 6367 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6367&view=rev Log: - added test program Added: trunk/libzypp/devel/devel.aschnell/parse2.cc Modified: trunk/libzypp/devel/devel.aschnell/parse1.cc Modified: trunk/libzypp/devel/devel.aschnell/parse1.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.aschnell/parse1.cc?rev=6367&r1=6366&r2=6367&view=diff ============================================================================== --- trunk/libzypp/devel/devel.aschnell/parse1.cc (original) +++ trunk/libzypp/devel/devel.aschnell/parse1.cc Wed Aug 1 15:53:27 2007 @@ -29,8 +29,6 @@ int main (int argc, char* argv[]) { - MIL << "===[START]==========================================" << endl; - TmpDir tmpCachePath; TmpDir tmpRawCachePath; TmpDir tmpKnownReposPath; @@ -44,12 +42,12 @@ RepoInfo nrepo; nrepo.setAlias( "factorytest" ) - .setName( "Test Repo for factory." ) + .setName( "Test Repo for Factory." ) .setEnabled( true ) .setAutorefresh( false ) - .addBaseUrl(Url("ftp://dist.suse.de/install/stable-x86/")); + // .addBaseUrl(Url("ftp://dist.suse.de/install/stable-x86/")); // .addBaseUrl(Url("http://software.opensuse.org/download/home:/Arvin42/openSUSE_Factory/")); - // .addBaseUrl(Url("file:///ARVIN/zypp/trunk/repotools/")); + .addBaseUrl(Url("file:///ARVIN/zypp/trunk/repotools/")); repoManager.addRepository( nrepo ); @@ -94,7 +92,5 @@ USR << " Requires: " << itCap->asString() << std::endl; } - INT << "===[END]============================================" << endl; - return 0; } Added: trunk/libzypp/devel/devel.aschnell/parse2.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.aschnell/parse2.cc?rev=6367&view=auto ============================================================================== --- trunk/libzypp/devel/devel.aschnell/parse2.cc (added) +++ trunk/libzypp/devel/devel.aschnell/parse2.cc Wed Aug 1 15:53:27 2007 @@ -0,0 +1,100 @@ + +// g++ parse2.cc -o parse2 -O2 -Wall -lzypp + + +#include "zypp/base/Logger.h" +#include "zypp/base/PtrTypes.h" +#include "zypp/base/Exception.h" +#include "zypp/ZYppFactory.h" +#include "zypp/ZYppCallbacks.h" +#include "zypp/ResPoolProxy.h" +#include "zypp/ResPool.h" +#include "zypp/ResPoolManager.h" +#include "zypp/ResFilters.h" +#include "zypp/CapFilters.h" +#include "zypp/Package.h" +#include "zypp/Pattern.h" +#include "zypp/Language.h" +#include "zypp/PackageKeyword.h" +#include "zypp/NameKindProxy.h" +#include "zypp/RepoManager.h" +#include "zypp/RepoInfo.h" +#include "zypp/TmpPath.h" + + +using namespace std; +using namespace zypp; +using namespace zypp::filesystem; + + +int +main (int argc, char* argv[]) +{ + TmpDir tmpCachePath; + TmpDir tmpRawCachePath; + TmpDir tmpKnownReposPath; + + RepoManagerOptions opts; + opts.repoCachePath = tmpCachePath.path(); + opts.repoRawCachePath = tmpRawCachePath.path(); + opts.knownReposPath = tmpKnownReposPath.path(); + + RepoManager repoManager (opts); + + RepoInfo nrepo; + nrepo.setAlias( "factorytest" ) + .setName( "Test Repo for Factory." ) + .setEnabled( true ) + .setAutorefresh( false ) + // .addBaseUrl(Url("ftp://dist.suse.de/install/stable-x86/")); + // .addBaseUrl(Url("http://software.opensuse.org/download/home:/Arvin42/openSUSE_Factory/")); + .addBaseUrl(Url("file:///ARVIN/zypp/trunk/repotools/")); + + repoManager.addRepository( nrepo ); + + ResPoolManager resPoolManager; + + RepoInfoList repos = repoManager.knownRepositories(); + for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); it++ ) + { + RepoInfo& nrepo( *it ); + + SEC << "refreshMetadata" << endl; + repoManager.refreshMetadata( nrepo ); + SEC << "buildCache" << endl; + repoManager.buildCache( nrepo ); + + // here SQLite is upto-date + + SEC << nrepo << endl; + Repository nrep = repoManager.createFromCache( nrepo ); + + const ResStore& resolvables = nrep.resolvables(); + for (ResStore::const_iterator it = resolvables.begin(); it != resolvables.end(); it++) + resPoolManager.insert(*it); + } + + ResPool pool(resPoolManager.accessor()); + + USR << "pool: " << pool << endl; + + for (ResPool::const_iterator itRes = pool.begin(); itRes != pool.end(); itRes++) + { + USR << (*itRes)->name() << ' ' + << (*itRes)->kind() << ' ' + << (*itRes)->arch() << ' ' + << (*itRes)->edition() << endl; + + CapSet caps; + + caps = (*itRes)->dep(Dep::PROVIDES); + for (CapSet::const_iterator itCap = caps.begin(); itCap != caps.end(); itCap++) + USR << " Provides: " << itCap->asString() << std::endl; + + caps = (*itRes)->dep(Dep::REQUIRES); + for (CapSet::const_iterator itCap = caps.begin(); itCap != caps.end(); itCap++) + USR << " Requires: " << itCap->asString() << std::endl; + } + + return 0; +} -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
aschnell@svn.opensuse.org