57 using namespace zypp::repo;
59 #define OPT_PROGRESS const ProgressData::ReceiverFnc & = ProgressData::ReceiverFnc()
74 MediaMounter(
const Url & url_r )
76 media::MediaManager mediamanager;
77 _mid = mediamanager.open( url_r );
78 mediamanager.attach(
_mid );
84 media::MediaManager mediamanager;
85 mediamanager.release(
_mid );
86 mediamanager.close(
_mid );
93 Pathname getPathName(
const Pathname & path_r = Pathname() )
const
95 media::MediaManager mediamanager;
96 return mediamanager.localPath(
_mid, path_r );
105 template <
class Iterator>
106 inline bool foundAliasIn(
const std::string & alias_r, Iterator begin_r, Iterator end_r )
108 for_( it, begin_r, end_r )
109 if ( it->alias() == alias_r )
114 template <
class Container>
115 inline bool foundAliasIn(
const std::string & alias_r,
const Container & cont_r )
116 {
return foundAliasIn( alias_r, cont_r.begin(), cont_r.end() ); }
119 template <
class Iterator>
120 inline Iterator findAlias(
const std::string & alias_r, Iterator begin_r, Iterator end_r )
122 for_( it, begin_r, end_r )
123 if ( it->alias() == alias_r )
128 template <class Container>
129 inline typename Container::iterator findAlias( const std::
string & alias_r, Container & cont_r )
130 {
return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
132 template <
class Container>
133 inline typename Container::const_iterator findAlias(
const std::string & alias_r,
const Container & cont_r )
134 {
return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
138 inline std::string filenameFromAlias(
const std::string & alias_r,
const std::string & stem_r )
140 std::string filename( alias_r );
144 filename = Pathname(filename).extend(
"."+stem_r).asString();
145 MIL <<
"generating filename for " << stem_r <<
" [" << alias_r <<
"] : '" << filename <<
"'" << endl;
169 RepoCollector(
const std::string & targetDistro_)
173 bool collect(
const RepoInfo &repo )
177 && !repo.targetDistribution().empty()
182 <<
"' distribution (current distro is '"
183 << repo.targetDistribution() <<
"')." << endl;
188 repos.push_back(repo);
202 std::list<RepoInfo> repositories_in_file(
const Pathname & file )
204 MIL <<
"repo file: " << file << endl;
205 RepoCollector collector;
206 parser::RepoFileReader parser( file, bind( &RepoCollector::collect, &collector, _1 ) );
207 return collector.repos;
220 std::list<RepoInfo> repositories_in_dir(
const Pathname &dir )
222 MIL <<
"directory " << dir << endl;
223 std::list<RepoInfo>
repos;
224 std::list<Pathname> entries;
231 str::regex allowedRepoExt(
"^\\.repo(_[0-9]+)?$");
232 for ( std::list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
236 std::list<RepoInfo> tmp = repositories_in_file( *it );
237 repos.insert( repos.end(), tmp.begin(), tmp.end() );
248 inline void assert_alias(
const RepoInfo & info )
250 if ( info.alias().empty() )
254 if ( info.alias()[0] ==
'.')
256 info,
_(
"Repository alias cannot start with dot.")));
259 inline void assert_alias(
const ServiceInfo & info )
261 if ( info.alias().empty() )
265 if ( info.alias()[0] ==
'.')
267 info,
_(
"Service alias cannot start with dot.")));
272 inline void assert_urls(
const RepoInfo & info )
274 if ( info.baseUrlsEmpty() )
278 inline void assert_url(
const ServiceInfo & info )
280 if ( ! info.url().isValid() )
290 inline Pathname rawcache_path_for_repoinfo(
const RepoManagerOptions &opt,
const RepoInfo &info )
293 return opt.repoRawCachePath / info.escaped_alias();
304 inline Pathname rawproductdata_path_for_repoinfo(
const RepoManagerOptions &opt,
const RepoInfo &info )
307 return opt.repoRawCachePath / info.escaped_alias() / info.path();
313 inline Pathname packagescache_path_for_repoinfo(
const RepoManagerOptions &opt,
const RepoInfo &info )
316 return opt.repoPackagesCachePath / info.escaped_alias();
322 inline Pathname solv_path_for_repoinfo(
const RepoManagerOptions &opt,
const RepoInfo &info)
325 return opt.repoSolvCachePath / info.escaped_alias();
331 class ServiceCollector
334 typedef std::set<ServiceInfo> ServiceSet;
336 ServiceCollector( ServiceSet & services_r )
340 bool operator()(
const ServiceInfo & service_r )
const
364 DBG <<
"reading repo file " << repo_file <<
", local path: " << local << endl;
366 return repositories_in_file(local);
377 repoCachePath = Pathname::assertprefix( root_r,
ZConfig::instance().repoCachePath() );
378 repoRawCachePath = Pathname::assertprefix( root_r,
ZConfig::instance().repoMetadataPath() );
379 repoSolvCachePath = Pathname::assertprefix( root_r,
ZConfig::instance().repoSolvfilesPath() );
380 repoPackagesCachePath = Pathname::assertprefix( root_r,
ZConfig::instance().repoPackagesPath() );
381 knownReposPath = Pathname::assertprefix( root_r,
ZConfig::instance().knownReposPath() );
382 knownServicesPath = Pathname::assertprefix( root_r,
ZConfig::instance().knownServicesPath() );
383 pluginsPath = Pathname::assertprefix( root_r,
ZConfig::instance().pluginsPath() );
414 init_knownServices();
415 init_knownRepositories();
424 bool hasRepo(
const std::string & alias )
const
425 {
return foundAliasIn( alias, _repos ); }
427 RepoInfo getRepo(
const std::string & alias )
const
434 Pathname metadataPath(
const RepoInfo & info )
const
435 {
return rawcache_path_for_repoinfo( _options, info ); }
437 Pathname packagesPath(
const RepoInfo & info )
const
438 {
return packagescache_path_for_repoinfo( _options, info ); }
459 {
return PathInfo(solv_path_for_repoinfo( _options, info ) /
"solv").isExist(); }
483 bool hasService(
const std::string & alias )
const
484 {
return foundAliasIn( alias,
_services ); }
494 void addService(
const std::string & alias,
const Url & url )
497 void removeService(
const std::string & alias );
501 void refreshServices();
503 void refreshService(
const std::string & alias );
507 void modifyService(
const std::string & oldAlias,
const ServiceInfo & newService );
514 Pathname generateNonExistingName(
const Pathname & dir,
const std::string & basefilename )
const;
516 std::string generateFilename(
const RepoInfo & info )
const
517 {
return filenameFromAlias( info.
alias(),
"repo" ); }
520 {
return filenameFromAlias( info.
alias(),
"service" ); }
524 Pathname base = solv_path_for_repoinfo( _options, info );
529 void touchIndexFile(
const RepoInfo & info );
531 template<
typename OutputIterator>
532 void getRepositoriesInService(
const std::string & alias, OutputIterator out )
const
535 std::copy( boost::make_filter_iterator( filter, _repos.begin(), _repos.end() ),
536 boost::make_filter_iterator( filter, _repos.end(), _repos.end() ),
541 void init_knownServices();
542 void init_knownRepositories();
550 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
553 {
return new Impl( *
this ); }
559 {
return str <<
"RepoManager::Impl"; }
566 Pathname servfile = generateNonExistingName( _options.knownServicesPath,
567 generateFilename( service ) );
570 MIL <<
"saving service in " << servfile << endl;
572 std::ofstream file( servfile.c_str() );
579 MIL <<
"done" << endl;
598 const std::string & basefilename )
const
600 std::string final_filename = basefilename;
602 while ( PathInfo(dir + final_filename).isExist() )
607 return dir + Pathname(final_filename);
614 Pathname dir = _options.knownServicesPath;
615 std::list<Pathname> entries;
616 if (PathInfo(dir).isExist())
625 for_(it, entries.begin(), entries.end() )
636 MIL <<
"start construct known repos" << endl;
638 if ( PathInfo(_options.knownReposPath).isExist() )
640 RepoInfoList repol = repositories_in_dir(_options.knownReposPath);
641 std::list<string> repo_esc_aliases;
642 std::list<string> entries;
643 for ( RepoInfoList::iterator it = repol.begin();
648 Pathname metadata_path = rawcache_path_for_repoinfo(_options, (*it));
649 (*it).setMetadataPath(metadata_path);
652 Pathname packages_path = packagescache_path_for_repoinfo(_options, (*it));
653 (*it).setPackagesPath(packages_path);
656 repo_esc_aliases.push_back(it->escaped_alias());
662 std::set<string> oldfiles;
663 repo_esc_aliases.sort();
665 set_difference(entries.begin(), entries.end(), repo_esc_aliases.begin(), repo_esc_aliases.end(), std::inserter(oldfiles, oldfiles.end()));
666 for_(it, oldfiles.begin(), oldfiles.end())
673 MIL <<
"end construct known repos" << endl;
680 Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info );
681 Pathname productdatapath = rawproductdata_path_for_repoinfo( _options, info );
685 switch ( repokind.
toEnum() )
689 repokind = probe( productdatapath.asUrl() );
695 switch ( repokind.
toEnum() )
699 status =
RepoStatus( productdatapath +
"/repodata/repomd.xml");
705 status =
RepoStatus( productdatapath +
"/content") && (
RepoStatus( mediarootpath +
"/media.1/media"));
711 if ( PathInfo(Pathname(productdatapath +
"/cookie")).isExist() )
712 status =
RepoStatus( productdatapath +
"/cookie");
728 Pathname productdatapath = rawproductdata_path_for_repoinfo( _options, info );
733 repokind = probe( productdatapath.asUrl() );
739 switch ( repokind.
toEnum() )
742 p = Pathname(productdatapath +
"/repodata/repomd.xml");
746 p = Pathname(productdatapath +
"/content");
750 p = Pathname(productdatapath +
"/cookie");
772 MIL <<
"Going to try to check whether refresh is needed for " << url << endl;
775 Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info );
777 oldstatus = metadataStatus(info);
779 if ( oldstatus.
empty() )
781 MIL <<
"No cached metadata, going to refresh" << endl;
782 return REFRESH_NEEDED;
787 if ( scheme ==
"cd" || scheme ==
"dvd" )
789 MIL <<
"never refresh CD/DVD" << endl;
790 return REPO_UP_TO_DATE;
795 if (policy != RefreshForced && policy != RefreshIfNeededIgnoreDelay)
798 double diff = difftime(
804 DBG <<
"last refresh = " << diff <<
" minutes ago" << endl;
810 WAR <<
"Repository '" << info.
alias() <<
"' was refreshed in the future!" << endl;
814 MIL <<
"Repository '" << info.
alias()
815 <<
"' has been refreshed less than repo.refresh.delay ("
817 <<
") minutes ago. Advising to skip refresh" << endl;
818 return REPO_CHECK_DELAYED;
828 switch ( repokind.
toEnum() )
832 repokind = probe( url, info.
path() );
842 shared_ptr<repo::Downloader> downloader_ptr;
849 RepoStatus newstatus = downloader_ptr->status(media);
850 bool refresh =
false;
853 MIL <<
"repo has not changed" << endl;
854 if ( policy == RefreshForced )
856 MIL <<
"refresh set to forced" << endl;
862 MIL <<
"repo has changed, going to refresh" << endl;
867 touchIndexFile(info);
869 return refresh ? REFRESH_NEEDED : REPO_UP_TO_DATE;
873 MediaMounter media( url );
875 bool refresh =
false;
878 MIL <<
"repo has not changed" << endl;
879 if ( policy == RefreshForced )
881 MIL <<
"refresh set to forced" << endl;
887 MIL <<
"repo has changed, going to refresh" << endl;
892 touchIndexFile(info);
894 return refresh ? REFRESH_NEEDED : REPO_UP_TO_DATE;
904 ERR <<
"refresh check failed for " << url << endl;
908 return REFRESH_NEEDED;
919 "Valid metadata not found at specified URLs",
931 if (checkIfToRefreshMetadata(info, url, policy)!=REFRESH_NEEDED)
934 MIL <<
"Going to refresh metadata from " << url << endl;
939 switch ( repokind.
toEnum() )
943 repokind = probe( *it, info.
path() );
950 for_( it, repoBegin(), repoEnd() )
952 if ( info.
alias() == (*it).alias() )
955 modifiedrepo.
setType( repokind );
956 modifyRepository( info.
alias(), modifiedrepo );
966 Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info );
977 Exception ex(
_(
"Can't create metadata cache directory."));
985 shared_ptr<repo::Downloader> downloader_ptr;
987 MIL <<
"Creating downloader for [ " << info.
alias() <<
" ]" << endl;
1000 for_( it, repoBegin(), repoEnd() )
1002 Pathname cachepath(rawcache_path_for_repoinfo( _options, *it ));
1003 if ( PathInfo(cachepath).isExist() )
1004 downloader_ptr->addCachePath(cachepath);
1007 downloader_ptr->download( media, tmpdir.
path() );
1011 MediaMounter media( url );
1014 Pathname productpath( tmpdir.
path() / info.
path() );
1016 std::ofstream file( (productpath/
"cookie").c_str() );
1023 if ( ! info.
path().empty() && info.
path() !=
"/" )
1024 file <<
" (" << info.
path() <<
")";
1026 file << newstatus.
checksum() << endl;
1045 ERR <<
"Trying another url..." << endl;
1054 ERR <<
"No more urls..." << endl;
1063 progress.
sendTo(progressfnc);
1073 progress.
sendTo(progressfnc);
1083 Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info );
1084 Pathname productdatapath = rawproductdata_path_for_repoinfo( _options, info );
1091 RepoStatus raw_metadata_status = metadataStatus(info);
1092 if ( raw_metadata_status.
empty() )
1097 refreshMetadata(info, RefreshIfNeeded, progressrcv );
1098 raw_metadata_status = metadataStatus(info);
1101 bool needs_cleaning =
false;
1102 if ( isCached( info ) )
1104 MIL << info.
alias() <<
" is already cached." << endl;
1109 MIL << info.
alias() <<
" cache is up to date with metadata." << endl;
1110 if ( policy == BuildIfNeeded ) {
1114 MIL << info.
alias() <<
" cache rebuild is forced" << endl;
1118 needs_cleaning =
true;
1132 MIL << info.
alias() <<
" building cache..." << info.
type() << endl;
1134 Pathname base = solv_path_for_repoinfo( _options, info);
1142 if( ! PathInfo(base).userMayW() )
1144 Exception ex(
str::form(
_(
"Can't create cache at %s - no writing permissions."), base.c_str()) );
1147 Pathname solvfile = base /
"solv";
1153 switch ( repokind.
toEnum() )
1157 repokind = probe( productdatapath.asUrl() );
1163 MIL <<
"repo type is " << repokind << endl;
1165 switch ( repokind.
toEnum() )
1173 scoped_ptr<MediaMounter> forPlainDirs;
1176 cmd.push_back(
"repo2solv.sh" );
1179 cmd.push_back(
"-o" );
1180 cmd.push_back( solvfile.asString() );
1184 forPlainDirs.reset(
new MediaMounter( *info.
baseUrlsBegin() ) );
1186 cmd.push_back(
"-R" );
1188 cmd.push_back( forPlainDirs->getPathName( info.
path() ).c_str() );
1191 cmd.push_back( productdatapath.asString() );
1194 std::string errdetail;
1197 WAR <<
" " << output;
1198 if ( errdetail.empty() ) {
1202 errdetail += output;
1205 int ret = prog.
close();
1222 setCacheStatus(info, raw_metadata_status);
1223 MIL <<
"Commit cache.." << endl;
1231 MIL <<
"going to probe the repo type at " << url <<
" (" << path <<
")" << endl;
1237 MIL <<
"Probed type NONE (not exists) at " << url <<
" (" << path <<
")" << endl;
1249 bool gotMediaException =
false;
1257 MIL <<
"Probed type RPMMD at " << url <<
" (" << path <<
")" << endl;
1264 DBG <<
"problem checking for repodata/repomd.xml file" << endl;
1266 gotMediaException =
true;
1273 MIL <<
"Probed type YAST2 at " << url <<
" (" << path <<
")" << endl;
1280 DBG <<
"problem checking for content file" << endl;
1282 gotMediaException =
true;
1288 MediaMounter media( url );
1289 if ( PathInfo(media.getPathName()/path).isDir() )
1292 MIL <<
"Probed type RPMPLAINDIR at " << url <<
" (" << path <<
")" << endl;
1306 if (gotMediaException)
1309 MIL <<
"Probed type NONE at " << url <<
" (" << path <<
")" << endl;
1317 MIL <<
"Going to clean up garbage in cache dirs" << endl;
1320 progress.
sendTo(progressrcv);
1323 std::list<Pathname> cachedirs;
1324 cachedirs.push_back(_options.repoRawCachePath);
1325 cachedirs.push_back(_options.repoPackagesCachePath);
1326 cachedirs.push_back(_options.repoSolvCachePath);
1328 for_( dir, cachedirs.begin(), cachedirs.end() )
1330 if ( PathInfo(*dir).isExist() )
1332 std::list<Pathname> entries;
1337 unsigned sdircount = entries.size();
1338 unsigned sdircurrent = 1;
1339 for_( subdir, entries.begin(), entries.end() )
1343 for_( r, repoBegin(), repoEnd() )
1344 if ( subdir->basename() == r->escaped_alias() )
1345 { found =
true;
break; }
1350 progress.
set( progress.
val() + sdircurrent * 100 / sdircount );
1355 progress.
set( progress.
val() + 100 );
1365 progress.
sendTo(progressrcv);
1368 MIL <<
"Removing raw metadata cache for " << info.
alias() << endl;
1379 Pathname solvfile = solv_path_for_repoinfo(_options, info) /
"solv";
1381 if ( ! PathInfo(solvfile).isExist() )
1406 MIL <<
"Try to handle exception by rebuilding the solv-file" << endl;
1407 cleanCache( info, progressrcv );
1408 buildCache( info, BuildIfNeeded, progressrcv );
1426 MIL <<
"Try adding repo " << info << endl;
1429 if ( _repos.find(tosave) != _repos.end() )
1433 if ( _options.probe )
1435 DBG <<
"unknown repository type, probing" << endl;
1453 Pathname repofile = generateNonExistingName(
1454 _options.knownReposPath, generateFilename(tosave));
1456 MIL <<
"Saving repo in " << repofile << endl;
1458 std::ofstream file(repofile.c_str());
1472 RepoInfo & oinfo( const_cast<RepoInfo &>(info) );
1476 _repos.insert(tosave);
1481 bool havePasswords =
false;
1483 if ( urlit->hasCredentialsInAuthority() )
1485 havePasswords =
true;
1489 if ( havePasswords )
1495 if (urlit->hasCredentialsInAuthority())
1503 MIL <<
"done" << endl;
1510 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
1515 for_ ( kit, repoBegin(), repoEnd() )
1517 if ( (*it).alias() == (*kit).alias() )
1519 ERR <<
"To be added repo " << (*it).alias() <<
" conflicts with existing repo " << (*kit).alias() << endl;
1525 std::string filename = Pathname(url.
getPathName()).basename();
1527 if ( filename == Pathname() )
1536 Pathname repofile = generateNonExistingName(_options.knownReposPath, filename);
1538 MIL <<
"Saving " << repos.size() <<
" repo" << ( repos.size() ?
"s" :
"" ) <<
" in " << repofile << endl;
1540 std::ofstream file(repofile.c_str());
1547 for ( std::list<RepoInfo>::iterator it = repos.begin();
1551 MIL <<
"Saving " << (*it).alias() << endl;
1552 it->setFilepath(repofile.asString());
1553 it->dumpAsIniOn(file);
1559 MIL <<
"done" << endl;
1571 MIL <<
"Going to delete repo " << info.
alias() << endl;
1573 for_( it, repoBegin(), repoEnd() )
1578 if ( (!info.
alias().empty()) && ( info.
alias() != (*it).alias() ) )
1593 std::list<RepoInfo> filerepos = repositories_in_file(todelete.
filepath());
1594 if ( (filerepos.size() == 1) && ( filerepos.front().alias() == todelete.
alias() ) )
1602 MIL << todelete.
alias() <<
" sucessfully deleted." << endl;
1614 std::ofstream file(todelete.
filepath().c_str());
1620 for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
1621 fit != filerepos.end();
1624 if ( (*fit).alias() != todelete.
alias() )
1625 (*fit).dumpAsIniOn(file);
1632 if ( isCached(todelete) )
1633 cleanCache( todelete, subprogrcv);
1635 cleanMetadata( todelete, cleansubprogrcv);
1636 _repos.erase(todelete);
1637 MIL << todelete.
alias() <<
" sucessfully deleted." << endl;
1651 RepoInfo toedit = getRepositoryInfo(alias);
1655 if ( alias != newinfo.
alias() && hasRepo( newinfo.
alias() ) )
1667 std::list<RepoInfo> filerepos = repositories_in_file(toedit.
filepath());
1677 std::ofstream file(toedit.
filepath().c_str());
1683 for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
1684 fit != filerepos.end();
1689 if ( (*fit).alias() != toedit.
alias() )
1690 (*fit).dumpAsIniOn(file);
1696 _repos.erase(toedit);
1697 _repos.insert(newinfo);
1699 MIL <<
"repo " << alias <<
" modified" << endl;
1708 if ( it != _repos.end() )
1718 for_( it, repoBegin(), repoEnd() )
1720 for_( urlit, (*it).baseUrlsBegin(), (*it).baseUrlsEnd() )
1722 if ( (*urlit).asString(urlview) == url.
asString(urlview) )
1739 assert_alias( service );
1742 if ( hasService( service.
alias() ) )
1748 saveService( toSave );
1761 MIL <<
"added service " << toSave.
alias() << endl;
1768 MIL <<
"Going to delete repo " << alias << endl;
1770 const ServiceInfo & service = getService( alias );
1772 Pathname location = service.
filepath();
1773 if( location.empty() )
1782 if ( tmpSet.size() == 1 )
1789 MIL << alias <<
" sucessfully deleted." << endl;
1795 std::ofstream file(location.c_str());
1802 for_(it, tmpSet.begin(), tmpSet.end())
1804 if( it->alias() != alias )
1805 it->dumpAsIniOn(file);
1808 MIL << alias <<
" sucessfully deleted from file " << location << endl;
1812 RepoCollector rcollector;
1813 getRepositoriesInService( alias,
1814 boost::make_function_output_iterator( bind( &RepoCollector::collect, &rcollector, _1 ) ) );
1816 for_(rit, rcollector.repos.begin(), rcollector.repos.end())
1817 removeRepository(*rit);
1826 ServiceSet services( serviceBegin(), serviceEnd() );
1827 for_( it, services.begin(), services.end() )
1829 if ( !it->enabled() )
1833 refreshService(*it);
1843 assert_alias( service );
1844 assert_url( service );
1848 bool serviceModified =
false;
1849 MIL <<
"Going to refresh service '" << service.
alias() <<
"', url: "<< service.
url() << endl;
1860 serviceModified =
true;
1865 std::string servicesTargetDistro = _options.servicesTargetDistro;
1866 if ( servicesTargetDistro.empty() )
1870 DBG <<
"ServicesTargetDistro: " << servicesTargetDistro << endl;
1873 RepoCollector collector(servicesTargetDistro);
1885 uglyHack.first =
true;
1886 uglyHack.second = e;
1890 for_( it, collector.repos.begin(), collector.repos.end() )
1895 if ( it->baseUrlsEmpty() )
1896 url = service.
url();
1900 url = *it->baseUrlsBegin();
1905 if ( !it->path().empty() )
1914 it->setAlias(
str::form(
"%s:%s", service.
alias().c_str(), it->alias().c_str() ) );
1917 it->setBaseUrl( url );
1919 it->setService( service.
alias() );
1925 RepoInfoList oldRepos;
1926 getRepositoriesInService( service.
alias(), std::back_inserter( oldRepos ) );
1929 for_( it, oldRepos.begin(), oldRepos.end() )
1931 if ( ! foundAliasIn( it->alias(), collector.repos ) )
1935 DBG <<
"Service removes enabled repo " << it->alias() << endl;
1937 serviceModified =
true;
1941 DBG <<
"Service removes disabled repo " << it->alias() << endl;
1943 removeRepository( *it );
1949 for_( it, collector.repos.begin(), collector.repos.end() )
1959 if ( beEnabled ) it->setEnabled(
true);
1960 if ( beDisabled ) it->setEnabled(
false);
1968 serviceModified =
true;
1971 RepoInfoList::iterator oldRepo( findAlias( it->alias(), oldRepos ) );
1972 if ( oldRepo == oldRepos.end() )
1979 DBG <<
"Service adds repo " << it->alias() <<
" " << (it->enabled()?
"enabled":
"disabled") << endl;
1980 addRepository( *it );
1988 bool oldRepoModified =
false;
1993 if ( ! oldRepo->enabled() )
1995 DBG <<
"Service repo " << it->alias() <<
" gets enabled" << endl;
1996 oldRepo->setEnabled(
true );
1997 oldRepoModified =
true;
2001 DBG <<
"Service repo " << it->alias() <<
" stays enabled" << endl;
2004 else if ( beDisabled )
2006 if ( oldRepo->enabled() )
2008 DBG <<
"Service repo " << it->alias() <<
" gets disabled" << endl;
2009 oldRepo->setEnabled(
false );
2010 oldRepoModified =
true;
2014 DBG <<
"Service repo " << it->alias() <<
" stays disabled" << endl;
2019 DBG <<
"Service repo " << it->alias() <<
" stays " << (oldRepo->enabled()?
"enabled":
"disabled") << endl;
2024 if ( oldRepo->url() != it->url() )
2026 DBG <<
"Service repo " << it->alias() <<
" gets new URL " << it->url() << endl;
2027 oldRepo->setBaseUrl( it->url() );
2028 oldRepoModified =
true;
2032 if ( oldRepoModified )
2034 modifyRepository( oldRepo->alias(), *oldRepo );
2043 serviceModified =
true;
2048 if ( serviceModified )
2051 modifyService( service.
alias(), service );
2054 if ( uglyHack.first )
2056 throw( uglyHack.second );
2064 MIL <<
"Going to modify service " << oldAlias << endl;
2072 MIL <<
"Not modifying plugin service '" << oldAlias <<
"'" << endl;
2076 const ServiceInfo & oldService = getService(oldAlias);
2078 Pathname location = oldService.
filepath();
2079 if( location.empty() )
2089 std::ofstream file(location.c_str());
2090 for_(it, tmpSet.begin(), tmpSet.end())
2092 if( *it != oldAlias )
2093 it->dumpAsIniOn(file);
2103 if( oldAlias != service.
alias()
2107 std::vector<RepoInfo> toModify;
2108 getRepositoriesInService(oldAlias, std::back_inserter(toModify));
2109 for_( it, toModify.begin(), toModify.end() )
2112 it->setEnabled(
false);
2119 it->setService(service.
alias());
2120 modifyRepository(it->alias(), *it);
2164 : _pimpl( new
Impl(opt) )
2196 std::string host( url_r.
getHost() );
2197 if ( ! host.empty() )
2319 {
return str << *obj.
_pimpl; }