Author: mlandres Date: Wed Jul 18 16:12:53 2007 New Revision: 6069 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6069&view=rev Log: Port zypp-query-pool (#292404) Modified: trunk/libzypp/libzypp.spec.cmake trunk/libzypp/tools/CMakeLists.txt trunk/libzypp/tools/registration/zypp-query-pool.cc Modified: trunk/libzypp/libzypp.spec.cmake URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/libzypp.spec.cmake?rev=6069&r1=6068&r2=6069&view=diff ============================================================================== --- trunk/libzypp/libzypp.spec.cmake (original) +++ trunk/libzypp/libzypp.spec.cmake Wed Jul 18 16:12:53 2007 @@ -107,7 +107,7 @@ %files -f zypp.lang %defattr(-,root,root) -#%{prefix}/lib/zypp +%{prefix}/lib/zypp %{prefix}/share/zypp %{_libdir}/libzypp*so.* %{prefix}/share/applications/package-manager.desktop Modified: trunk/libzypp/tools/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tools/CMakeLists.txt?rev=6069&r1=6068&r2=6069&view=diff ============================================================================== --- trunk/libzypp/tools/CMakeLists.txt (original) +++ trunk/libzypp/tools/CMakeLists.txt Wed Jul 18 16:12:53 2007 @@ -1,3 +1,3 @@ -#ADD_SUBDIRECTORY( registration ) +ADD_SUBDIRECTORY( registration ) ADD_SUBDIRECTORY( package-manager ) -ADD_SUBDIRECTORY( cachetools ) \ No newline at end of file +ADD_SUBDIRECTORY( cachetools ) Modified: trunk/libzypp/tools/registration/zypp-query-pool.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tools/registration/zypp-query-pool.cc?rev=6069&r1=6068&r2=6069&view=diff ============================================================================== --- trunk/libzypp/tools/registration/zypp-query-pool.cc (original) +++ trunk/libzypp/tools/registration/zypp-query-pool.cc Wed Jul 18 16:12:53 2007 @@ -33,7 +33,7 @@ bool operator()( PoolItem_Ref item ) { if (_repository.empty() - || _repository == item->source().alias()) + || _repository == item->repository().info().alias()) { cout << (item.status().isInstalled() ? "i" : " "); cout << "|" << item->kind(); @@ -59,18 +59,19 @@ static void -query_pool( ZYpp::Ptr Z, const string & filter, const string & repository) +query_pool( ZYpp::Ptr Z, string filter, const string & repository) { Resolvable::Kind kind; #define FILTER_ALL "all" + if ( filter.empty() ) filter = FILTER_ALL; if (filter == "packages") kind = ResTraitszypp::Package::kind; else if (filter == "patches") kind = ResTraitszypp::Patch::kind; else if (filter == "patterns") kind = ResTraitszypp::Pattern::kind; else if (filter == "selections") kind = ResTraitszypp::Selection::kind; else if (filter == "products") kind = ResTraitszypp::Product::kind; - else if (!filter.empty() && filter != FILTER_ALL) + else if (filter != FILTER_ALL) { std::cerr << "usage: zypp-query-pool [packages|patches|patterns|products] [<alias>]" << endl; exit( 1 ); @@ -80,13 +81,29 @@ MIL << "query_pool kind '" << kind << "', repository '" << repository << "'" << endl; - RepoManager manager; - if (!system) { try { - manager->restore( "/" ); + MIL << "Load enabled repositories..." << endl; + RepoManager repoManager; + RepoInfoList repos = repoManager.knownRepositories(); + for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it ) + { + RepoInfo & repo( *it ); + + if ( ! repo.enabled() ) + continue; + + MIL << "Loading " << repo << endl; + if ( ! repoManager.isCached( repo ) ) + { + MIL << "Must build cache..." << repo << endl; + repoManager.buildCache( repo ); + } + Z->addResolvables( repoManager.createFromCache( repo ).resolvables() ); + } + MIL << "Loaded enabled repositories." << endl; } catch (Exception & excpt_r) { @@ -99,9 +116,11 @@ // add resolvables from the system if ( filter != FILTER_ALL ) { + MIL << "Loading target (" << kind << ")..." << endl; ResStore items; for (ResStore::resfilter_const_iterator it = Z->target()->byKindBegin(kind); it != Z->target()->byKindEnd(kind); ++it) { + SEC << *it << endl; items.insert(*it); } Z->addResolvables( items, true ); @@ -109,25 +128,14 @@ else { // no filter, just add themm all + MIL << "Loading target..." << endl; Z->addResolvables( Z->target()->resolvables(), true ); } + MIL << "Loaded target." << endl; - // add all non-installed (cached sources) resolvables to the pool - // remark: If only the systems resolvables should be shown (repository == "@system") - // then the SourceManager is not initialized (see approx. 20 lines above) - // and the following loop is not run at all. - - for (SourceManager::Source_const_iterator it = manager->Source_begin(); it != manager->Source_end(); ++it) - { - zypp::ResStore store = it->resolvables(); - MIL << "Repository " << it->id() << " contributing " << store.size() << " resolvables" << endl; - Z->addResolvables( store, false ); - } MIL << "Pool has " << Z->pool().size() << " entries" << endl; - - if (filter.empty() - || filter == FILTER_ALL) + if ( filter == FILTER_ALL) { PrintItem printitem( system ? "" : repository ); if (system) -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org