Author: dmacvicar Date: Wed Jan 23 18:33:02 2008 New Revision: 8351 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8351&view=rev Log: - update test Modified: branches/tmp/ma/jump_sat/libzypp/tests/zypp/RepoManager_test.cc branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc Modified: branches/tmp/ma/jump_sat/libzypp/tests/zypp/RepoManager_test.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/zypp/RepoManager_test.cc?rev=8351&r1=8350&r2=8351&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/tests/zypp/RepoManager_test.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/tests/zypp/RepoManager_test.cc Wed Jan 23 18:33:02 2008 @@ -90,8 +90,8 @@ RepoInfo repo; repo.setAlias("foo"); - //Url repourl("dir:" + string(TESTS_SRC_DIR) + "/repo/yum/data/10.2-updates-subset"); - Url repourl("dir:/mounts/dist/install/stable-x86/suse"); + Url repourl("dir:" + string(TESTS_SRC_DIR) + "/repo/yum/data/10.2-updates-subset"); + //Url repourl("dir:/mounts/dist/install/stable-x86/suse"); //BOOST_CHECK_MESSAGE(0, repourl.asString()); repo.setBaseUrl(repourl); @@ -103,36 +103,45 @@ keyring_callbacks.answerAcceptVerFailed(true); keyring_callbacks.answerAcceptUnknownKey(true); + // we have no metadata yet so this should throw + BOOST_CHECK_THROW( manager.buildCache(repo), + RepoMetadataException ); + + // now refresh the metadata manager.refreshMetadata(repo); BOOST_CHECK_MESSAGE( ! manager.isCached(repo), "Repo is not yet cached" ); - manager.buildCache(repo); - - // we have no metadata yet so this should throw - //BOOST_CHECK_THROW( manager.buildCache(repo), - // RepoMetadataException ); - - return; - - Repository repository; // it is not cached, this should throw BOOST_CHECK_THROW( manager.createFromCache(repo), RepoNotCachedException ); - MIL << "repo " << repo.alias() << " not cached yet. Caching..." << endl; + // now cache should build normally manager.buildCache(repo); - // the solv file should exists now - Pathname solvfile = (opts.repoCachePath + repo.alias()).extend(".solv"); - BOOST_CHECK_MESSAGE( !PathInfo(solvfile).isExist(), "Solv file is created after caching"); + // the solv file should exists now + Pathname base = (opts.repoCachePath + repo.alias()); + Pathname solvfile = base.extend(".solv"); + Pathname cookiefile = base.extend(".cookie"); + BOOST_CHECK_MESSAGE( PathInfo(solvfile).isExist(), "Solv file is created after caching: " + solvfile.asString()); + BOOST_CHECK_MESSAGE( PathInfo(cookiefile).isExist(), "Cookie file is created after caching: " + cookiefile.asString()); - repository = manager.createFromCache(repo); - BOOST_CHECK_MESSAGE( manager.isCached(repo), - "Repo is cached" ); + "Repo is cached now" ); + + MIL << "Repo already in cache, clean cache"<< endl; + manager.cleanCache(repo); + + BOOST_CHECK_MESSAGE( !manager.isCached(repo), + "Repo cache was just deleted, should not be cached now" ); + + return; + Repository repository; + repository = manager.createFromCache(repo); + + ResStore store = repository.resolvables(); MIL << store.size() << " resolvables" << endl; Modified: branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc?rev=8351&r1=8350&r2=8351&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc Wed Jan 23 18:33:02 2008 @@ -31,6 +31,7 @@ //#include "zypp/repo/cached/RepoImpl.h" #include "zypp/media/MediaManager.h" #include "zypp/MediaSetAccess.h" +#include "zypp/ExternalProgram.h" #include "zypp/parser/RepoFileReader.h" #include "zypp/repo/yum/Downloader.h" @@ -41,6 +42,7 @@ #include "zypp/ZYppCallbacks.h" +#include "sat/Pool.h" #include "satsolver/pool.h" #include "satsolver/repo.h" #include "satsolver/repo_solv.h" @@ -666,7 +668,7 @@ assert_alias(info); Pathname rawpath = rawcache_path_for_repoinfo(_pimpl->options, info); - Pathname base = _pimpl->options.repoCachePath + Pathname(info.alias()); + Pathname base = _pimpl->options.repoCachePath + info.alias(); Pathname solvfile = base.extend(".solv"); //cache::SolvStore store(_pimpl->options.repoCachePath); @@ -732,20 +734,35 @@ break; } +<<<<<<< HEAD:zypp/RepoManager.cc +======= + MIL << "repo type is " << repokind << endl; + +>>>>>>> by now the repomanager returns an invalid repo +but loads the solv file in the global pool +(should this be automatic?):zypp/RepoManager.cc switch ( repokind.toEnum() ) { case RepoType::RPMMD_e : case RepoType::YAST2_e : { - string cmd = "repo2solv.sh \""; - cmd += rawpath.asString() + "\" > " + solvfile.asString(); - int ret = system (cmd.c_str()); - if (WIFEXITED (ret) && WEXITSTATUS (ret) != 0) - ZYPP_THROW(RepoUnknownTypeException()); +// string cmd = "repo2solv.sh \""; +// cmd += rawpath.asString() + "\" > " + solvfile.asString(); +// int ret = system (cmd.c_str()); +// if (WIFEXITED (ret) && WEXITSTATUS (ret) != 0) +// ZYPP_THROW(RepoUnknownTypeException()); + MIL << "Executing solv converter" << endl; + string cmd( str::form( "/usr/bin/repo2solv.sh \"%s\" > %s", rawpath.asString().c_str(), solvfile.asString().c_str() ) ); + ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout ); + for ( string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() ) { + MIL << " " << output; + } + int ret = prog.close(); } break; default: + ZYPP_THROW(Exception("Unhandled repostory type")); break; } #if 0 @@ -863,9 +880,8 @@ RepoStatus RepoManager::cacheStatus( const RepoInfo &info ) const { - Pathname name = _pimpl->options.repoCachePath; RepoStatus status; - Pathname base = _pimpl->options.repoCachePath + Pathname(info.alias()); + Pathname base = _pimpl->options.repoCachePath + info.alias(); Pathname solvfile = base.extend(".solv"); Pathname cookiefile = base.extend(".cookie"); @@ -918,17 +934,30 @@ MIL << "Repository " << info.alias() << " is cached" << endl; - //sat::Pool satpool( sat::Pool::instance() ); + sat::Pool satpool( sat::Pool::instance() ); +<<<<<<< HEAD:zypp/RepoManager.cc //Pathname name = _pimpl->options.repoCachePath + Pathname(info.alias()).extend(".solv"); +======= + Pathname solvfile = (_pimpl->options.repoCachePath + info.alias()).extend(".solv"); + +>>>>>>> by now the repomanager returns an invalid repo +but loads the solv file in the global pool +(should this be automatic?):zypp/RepoManager.cc try { - //satpool.addRepoSolv(name); + satpool.addRepoSolv(solvfile, info.alias()); } catch ( const Exception &e ) { +<<<<<<< HEAD:zypp/RepoManager.cc +======= + ZYPP_RETHROW(e); +>>>>>>> by now the repomanager returns an invalid repo +but loads the solv file in the global pool +(should this be automatic?):zypp/RepoManager.cc } CombinedProgressData subprogrcv(progress); @@ -1183,7 +1212,8 @@ CombinedProgressData subprogrcv(progress, 70); CombinedProgressData cleansubprogrcv(progress, 30); // now delete it from cache - cleanCache( todelete, subprogrcv); + if ( isCached(todelete) ) + cleanCache( todelete, subprogrcv); // now delete metadata (#301037) cleanMetadata( todelete, cleansubprogrcv); MIL << todelete.alias() << " sucessfully deleted." << endl; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org