Author: dmacvicar Date: Tue Jun 12 23:29:47 2007 New Revision: 5738 URL: http://svn.opensuse.org/viewcvs/zypp?rev=5738&view=rev Log: simple refresh implementation. Modified: trunk/zypper/src/zypper-sources.cc Modified: trunk/zypper/src/zypper-sources.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-sources.cc?rev=5738&r1=5737&r2=5738&view=diff ============================================================================== --- trunk/zypper/src/zypper-sources.cc (original) +++ trunk/zypper/src/zypper-sources.cc Tue Jun 12 23:29:47 2007 @@ -223,7 +223,7 @@ tr << repo.alias(); std::set<Url> urls; - urls = repo.urls(); + urls = repo.baseUrls(); for ( RepoInfo::urls_const_iterator uit = urls.begin(); uit != urls.end(); ++uit ) @@ -547,46 +547,31 @@ void refresh_sources() { -#ifdef LIBZYPP_1xx - cerr << _("Sorry, not implemented yet for libzypp-1.x.x") << endl; -#else - zypp::storage::PersistentStorage store; - std::list<SourceInfo> sources; - - try - { - store.init( gSettings.root_dir ); - sources = store.storedSources(); - } - catch ( const Exception &e ) - { - cerr << _("Error reading system sources: ") << e.msg() << std::endl; - exit(-1); - } + RepoManager manager; + gData.repos = manager.knownRepositories(); - for(std::list<SourceInfo>::const_iterator it = sources.begin(); - it != sources.end() ; ++it) + for (std::list<RepoInfo>::iterator it = gData.repos.begin(); + it != gData.repos.end(); ++it) { + RepoInfo repo(*it); try { - cout << _("Refreshing ") << it->alias() << endl << - "URI: " << it->url() << endl; - Source_Ref src = SourceFactory().createFrom( - it->type(), it->url(), it->path(), it->alias(), it->cacheDir(), - false, // base source - true); // autorefresh -// src.refresh(); + cout << _("Refreshing ") << it->alias() << endl; + //<< "URI: " << it->url() << endl; + + manager.refreshMetadata(repo); + if ( manager.isCached(repo ) ) + manager.cleanCache(repo); + manager.buildCache(repo); cout << _("DONE") << endl << endl; } - catch ( const zypp::Exception & ex ) + catch ( const Exception &e ) { - cerr << _("Error while refreshing the source: ") << ex.asString(); - // continuing with next source, however + cerr << _("Error reading system sources: ") << e.msg() << std::endl; + exit(-1); } } - cout << _("All system sources have been refreshed.") << endl; -#endif } MediaWrapper::MediaWrapper (const string& filename_or_url) { -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org