From: Jan Kupec Date: Thu, 11 Sep 2008 23:22:27 +0000 (+0000) Subject: - service probing on refresh enabled X-Git-Tag: BASE-SuSE-Code-11-Branch~423 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4748d90e3d1190e2289c3c10a38e33f9fd33d21;p=platform%2Fupstream%2Flibzypp.git - service probing on refresh enabled - some cleanup --- diff --git a/zypp/RepoInfo.h b/zypp/RepoInfo.h index f158a01..f22eb8e 100644 --- a/zypp/RepoInfo.h +++ b/zypp/RepoInfo.h @@ -68,7 +68,7 @@ namespace zypp public: RepoInfo(); - ~RepoInfo(); + virtual ~RepoInfo(); /** * Repository priority for solver. diff --git a/zypp/RepoManager.cc b/zypp/RepoManager.cc index c1a1718..208dc11 100644 --- a/zypp/RepoManager.cc +++ b/zypp/RepoManager.cc @@ -1470,22 +1470,26 @@ namespace zypp void RepoManager::refreshServices() { - // cannot user for_, because it uses const version - for (ServiceConstIterator it = _pimpl->services.begin(); - it != _pimpl->services.end(); ++it) + // copy the set of services since refreshService + // can eventually invalidate the iterator + ServiceSet services; + services.insert(serviceBegin(), serviceEnd()); + for_(it, services.begin(), services.end()) { if ( !it->enabled() ) continue; - MIL << "refresh: " << it->alias() << " with url: "<< it->url().asString() << endl; refreshService(*it); } } void RepoManager::refreshService( const ServiceInfo & service ) { + MIL << "going to refresh service '" << service.alias() + << "', url: "<< service.url().asString() << endl; + //! \todo add callbacks for apps (start, end, repo removed, repo added, repo changed) -/* + repo::ServiceType type = service.type(); // if the type is unknown, try probing. if ( type == repo::ServiceType::NONE ) @@ -1504,13 +1508,13 @@ namespace zypp { ServiceInfo modifiedservice = service; modifiedservice.setType(type); - modifyService(service.alias(), modifiedservice); // FIXME this causes a segfault, whe the same code from repos doesn't? + modifyService(service.alias(), modifiedservice); break; } } } } -*/ + // download the repo index file media::MediaManager mediamanager; //if (service.url().empty()) diff --git a/zypp/ServiceInfo.cc b/zypp/ServiceInfo.cc index acd0f7a..f30d2b3 100644 --- a/zypp/ServiceInfo.cc +++ b/zypp/ServiceInfo.cc @@ -55,9 +55,19 @@ namespace zypp CatalogsToDisable catalogsToDisable; public: - Impl() : repo::RepoInfoBase::Impl() {} - - Impl(const Url & url_) : url(url_) {} + Impl() + : repo::RepoInfoBase::Impl() + , type(repo::ServiceType::NONE_e) + {} + + Impl(const Url & url_) + : repo::RepoInfoBase::Impl() + , url(url_) + , type(repo::ServiceType::NONE_e) + {} + + ~Impl() + {} void setProbedType( const repo::ServiceType & t ) const { @@ -97,6 +107,9 @@ namespace zypp : repo::RepoInfoBase(alias), _pimpl( new Impl(url) ) {} + ServiceInfo::~ServiceInfo() + {} + Url ServiceInfo::url() const { return _pimpl->url; } void ServiceInfo::setUrl( const Url& url ) { _pimpl->url = url; } diff --git a/zypp/ServiceInfo.h b/zypp/ServiceInfo.h index ebf825b..a366b7f 100644 --- a/zypp/ServiceInfo.h +++ b/zypp/ServiceInfo.h @@ -51,6 +51,8 @@ namespace zypp */ ServiceInfo( const std::string & alias, const Url& url ); + virtual ~ServiceInfo(); + public: /** Represents an empty service. */ static const ServiceInfo noService;