[zypp-commit] r10405 - in /trunk/libzypp: libzypp.spec.cmake zypp/RepoManager.cc zypp/RepoManager.h zypp/Service.cc
Author: jreidinger Date: Thu Jun 19 16:16:11 2008 New Revision: 10405 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10405&view=rev Log: add mkdir for services and modifyServices, which is used during refresh Modified: trunk/libzypp/libzypp.spec.cmake trunk/libzypp/zypp/RepoManager.cc trunk/libzypp/zypp/RepoManager.h trunk/libzypp/zypp/Service.cc Modified: trunk/libzypp/libzypp.spec.cmake URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/libzypp.spec.cmake?rev=10405&r1=10404&r2=10405&view=diff ============================================================================== --- trunk/libzypp/libzypp.spec.cmake (original) +++ trunk/libzypp/libzypp.spec.cmake Thu Jun 19 16:16:11 2008 @@ -115,6 +115,7 @@ make -C doc/autodoc install DESTDIR=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/etc/zypp/repos.d mkdir -p $RPM_BUILD_ROOT/etc/zypp/products.d +mkdir -p $RPM_BUILD_ROOT/etc/zypp/services.d %if 0%{?suse_version} %suse_update_desktop_file -G "" -C "" package-manager Modified: trunk/libzypp/zypp/RepoManager.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=10405&r1=10404&r2=10405&view=diff ============================================================================== --- trunk/libzypp/zypp/RepoManager.cc (original) +++ trunk/libzypp/zypp/RepoManager.cc Thu Jun 19 16:16:11 2008 @@ -1454,6 +1454,37 @@ } } + void RepoManager::modifyService(const Service& service) const + { + MIL << "Going to modify service " << service.name() << endl; + + Pathname location = service.location(); + if( location.empty() ) + { + ZYPP_THROW(RepoException("Can't figure where the service is stored")); + } + + ServiceSet tmpSet; + Impl::ServiceCollector collector(tmpSet); + + parser::ServiceFileReader reader( location, + bind(&Impl::ServiceCollector::collect,collector,_1) ); + + filesystem::assert_dir(location.dirname()); + + std::ofstream file(location.c_str()); + + for_(it, tmpSet.begin(), tmpSet.end()) + { + if( *it != service ) + it->dumpServiceOn(file); + } + + service.dumpServiceOn(file); + + file.close(); + } + void RepoManager::Impl::knownServices() { ServiceCollector collector(services); Modified: trunk/libzypp/zypp/RepoManager.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.h?rev=10405&r1=10404&r2=10405&view=diff ============================================================================== --- trunk/libzypp/zypp/RepoManager.h (original) +++ trunk/libzypp/zypp/RepoManager.h Thu Jun 19 16:16:11 2008 @@ -446,6 +446,12 @@ void refreshServices(); + /** + * modify service, except name change + * ( you need remove and add if you want change name ) + */ + void modifyService(const Service& service) const; + protected: RepoStatus rawMetadataStatus( const RepoInfo &info ); void setCacheStatus( const RepoInfo &info, const RepoStatus &status ); Modified: trunk/libzypp/zypp/Service.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Service.cc?rev=10405&r1=10404&r2=10405&view=diff ============================================================================== --- trunk/libzypp/zypp/Service.cc (original) +++ trunk/libzypp/zypp/Service.cc Thu Jun 19 16:16:11 2008 @@ -80,6 +80,9 @@ RepoInfoCollector collector; parser::RepoindexFileReader reader( path, bind( &RepoInfoCollector::collect, &collector, _1 ) ); + mediamanager.close( mid ); + + bool ret = false; // set base url for all collected repositories for_( it, collector.repos.begin(), collector.repos.end()) @@ -105,7 +108,10 @@ } if( !found ) + { + ret = true; repomanager.removeRepository( repomanager.getRepositoryInfo( *it ) ); + } } //find new to add @@ -121,17 +127,22 @@ } if (!found) + { + ret = true; repomanager.addRepository( *it ); + } } //update internal alias storage - _pimpl->repos.clear(); - for_( it, collector.repos.begin(), collector.repos.end() ) + if (ret) { - _pimpl->repos.push_back(it->alias()); + _pimpl->repos.clear(); + for_( it, collector.repos.begin(), collector.repos.end() ) + { + _pimpl->repos.push_back(it->alias()); + } + repomanager.modifyService(*this); } - - mediamanager.close( mid ); } Pathname Service::location() const -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
jreidinger@svn.opensuse.org