57 using namespace zypp::repo;
59 #define OPT_PROGRESS const ProgressData::ReceiverFnc & = ProgressData::ReceiverFnc()
88 class UrlCredentialExtractor
91 UrlCredentialExtractor( Pathname & root_r )
95 ~UrlCredentialExtractor()
99 bool collect(
const Url & url_r )
101 bool ret = url_r.hasCredentialsInAuthority();
105 _cmPtr->addUserCred( url_r );
110 template<
class TContainer>
111 bool collect(
const TContainer & urls_r )
112 {
bool ret =
false;
for (
const Url &
url : urls_r ) {
if ( collect(
url ) && !ret ) ret =
true; }
return ret; }
115 bool extract( Url & url_r )
117 bool ret = collect( url_r );
119 url_r.setPassword( std::string() );
123 template<
class TContainer>
124 bool extract( TContainer & urls_r )
125 {
bool ret =
false;
for ( Url &
url : urls_r ) {
if ( extract(
url ) && !ret ) ret =
true; }
return ret; }
129 scoped_ptr<media::CredentialManager>
_cmPtr;
144 MediaMounter(
const Url & url_r )
146 media::MediaManager mediamanager;
147 _mid = mediamanager.open( url_r );
148 mediamanager.attach(
_mid );
154 media::MediaManager mediamanager;
155 mediamanager.release(
_mid );
156 mediamanager.close(
_mid );
163 Pathname getPathName(
const Pathname & path_r = Pathname() )
const
165 media::MediaManager mediamanager;
166 return mediamanager.localPath(
_mid, path_r );
175 template <
class Iterator>
176 inline bool foundAliasIn(
const std::string & alias_r, Iterator begin_r, Iterator end_r )
178 for_( it, begin_r, end_r )
179 if ( it->alias() == alias_r )
184 template <
class Container>
185 inline bool foundAliasIn(
const std::string & alias_r,
const Container & cont_r )
186 {
return foundAliasIn( alias_r, cont_r.begin(), cont_r.end() ); }
189 template <
class Iterator>
190 inline Iterator findAlias(
const std::string & alias_r, Iterator begin_r, Iterator end_r )
192 for_( it, begin_r, end_r )
193 if ( it->alias() == alias_r )
198 template <class Container>
199 inline typename Container::iterator findAlias( const std::
string & alias_r, Container & cont_r )
200 {
return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
202 template <
class Container>
203 inline typename Container::const_iterator findAlias(
const std::string & alias_r,
const Container & cont_r )
204 {
return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
208 inline std::string filenameFromAlias(
const std::string & alias_r,
const std::string & stem_r )
210 std::string filename( alias_r );
214 filename = Pathname(filename).extend(
"."+stem_r).asString();
215 MIL <<
"generating filename for " << stem_r <<
" [" << alias_r <<
"] : '" << filename <<
"'" << endl;
239 RepoCollector(
const std::string & targetDistro_)
243 bool collect(
const RepoInfo &repo )
247 && !repo.targetDistribution().empty()
251 <<
"Skipping repository meant for '" << repo.targetDistribution()
252 <<
"' distribution (current distro is '"
258 repos.push_back(repo);
272 std::list<RepoInfo> repositories_in_file(
const Pathname & file )
274 MIL <<
"repo file: " << file << endl;
275 RepoCollector collector;
276 parser::RepoFileReader parser( file, bind( &RepoCollector::collect, &collector, _1 ) );
277 return std::move(collector.repos);
290 std::list<RepoInfo> repositories_in_dir(
const Pathname &dir )
292 MIL <<
"directory " << dir << endl;
293 std::list<RepoInfo>
repos;
294 bool nonroot( geteuid() != 0 );
295 if ( nonroot && ! PathInfo(dir).userMayRX() )
297 JobReport::warning( str::FormatNAC(
_(
"Cannot read repo directory '%1%': Permission denied")) % dir );
301 std::list<Pathname> entries;
308 str::regex allowedRepoExt(
"^\\.repo(_[0-9]+)?$");
309 for ( std::list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
313 if ( nonroot && ! PathInfo(*it).userMayR() )
315 JobReport::warning( str::FormatNAC(
_(
"Cannot read repo file '%1%': Permission denied")) % *it );
319 const std::list<RepoInfo> & tmp( repositories_in_file( *it ) );
320 repos.insert( repos.end(), tmp.begin(), tmp.end() );
330 inline void assert_alias(
const RepoInfo & info )
332 if ( info.alias().empty() )
336 if ( info.alias()[0] ==
'.')
338 info,
_(
"Repository alias cannot start with dot.")));
341 inline void assert_alias(
const ServiceInfo & info )
343 if ( info.alias().empty() )
347 if ( info.alias()[0] ==
'.')
349 info,
_(
"Service alias cannot start with dot.")));
354 inline void assert_urls(
const RepoInfo & info )
356 if ( info.baseUrlsEmpty() )
360 inline void assert_url(
const ServiceInfo & info )
362 if ( ! info.url().isValid() )
372 inline Pathname rawcache_path_for_repoinfo(
const RepoManagerOptions &opt,
const RepoInfo &info )
375 return opt.repoRawCachePath / info.escaped_alias();
386 inline Pathname rawproductdata_path_for_repoinfo(
const RepoManagerOptions &opt,
const RepoInfo &info )
389 return opt.repoRawCachePath / info.escaped_alias() / info.path();
395 inline Pathname packagescache_path_for_repoinfo(
const RepoManagerOptions &opt,
const RepoInfo &info )
398 return opt.repoPackagesCachePath / info.escaped_alias();
404 inline Pathname solv_path_for_repoinfo(
const RepoManagerOptions &opt,
const RepoInfo &info)
407 return opt.repoSolvCachePath / info.escaped_alias();
413 class ServiceCollector
416 typedef std::set<ServiceInfo> ServiceSet;
418 ServiceCollector( ServiceSet & services_r )
422 bool operator()(
const ServiceInfo & service_r )
const
446 DBG <<
"reading repo file " << repo_file <<
", local path: " << local << endl;
448 return repositories_in_file(local);
459 repoCachePath = Pathname::assertprefix( root_r,
ZConfig::instance().repoCachePath() );
460 repoRawCachePath = Pathname::assertprefix( root_r,
ZConfig::instance().repoMetadataPath() );
461 repoSolvCachePath = Pathname::assertprefix( root_r,
ZConfig::instance().repoSolvfilesPath() );
462 repoPackagesCachePath = Pathname::assertprefix( root_r,
ZConfig::instance().repoPackagesPath() );
463 knownReposPath = Pathname::assertprefix( root_r,
ZConfig::instance().knownReposPath() );
464 knownServicesPath = Pathname::assertprefix( root_r,
ZConfig::instance().knownServicesPath() );
465 pluginsPath = Pathname::assertprefix( root_r,
ZConfig::instance().pluginsPath() );
487 #define OUTS(X) str << " " #X "\t" << obj.X << endl
488 str <<
"RepoManagerOptions (" << obj.
rootDir <<
") {" << endl;
489 OUTS( repoRawCachePath );
490 OUTS( repoSolvCachePath );
491 OUTS( repoPackagesCachePath );
492 OUTS( knownReposPath );
493 OUTS( knownServicesPath );
511 init_knownServices();
512 init_knownRepositories();
518 if ( _reposDirty && geteuid() == 0 && ( _options.rootDir.empty() || _options.rootDir ==
"/" ) )
521 std::list<Pathname> entries;
523 if ( ! entries.empty() )
526 cmd.push_back(
"<" );
527 cmd.push_back(
">" );
528 cmd.push_back(
"PROGRAM" );
529 for (
const auto & rinfo :
repos() )
531 if ( ! rinfo.enabled() )
533 cmd.push_back(
"-R" );
534 cmd.push_back( rinfo.alias() );
535 cmd.push_back(
"-t" );
536 cmd.push_back( rinfo.type().asString() );
537 cmd.push_back(
"-p" );
538 cmd.push_back( rinfo.metadataPath().asString() );
541 for_( it, entries.begin(), entries.end() )
545 if ( pi.isFile() && pi.userMayRX() )
548 cmd[2] = pi.asString();
564 bool hasRepo(
const std::string & alias )
const
565 {
return foundAliasIn( alias,
repos() ); }
575 {
return rawcache_path_for_repoinfo( _options, info ); }
578 {
return packagescache_path_for_repoinfo( _options, info ); }
600 {
return PathInfo(solv_path_for_repoinfo( _options, info ) /
"solv").isExist(); }
625 {
return foundAliasIn( alias,
_services ); }
638 void removeService(
const std::string & alias );
640 { removeService( service.
alias() ); }
646 { refreshService( service.
alias(), options_r ); }
648 void modifyService(
const std::string & oldAlias,
const ServiceInfo & newService );
655 Pathname generateNonExistingName(
const Pathname & dir,
const std::string & basefilename )
const;
658 {
return filenameFromAlias( info.
alias(),
"repo" ); }
661 {
return filenameFromAlias( info.
alias(),
"service" ); }
665 Pathname base = solv_path_for_repoinfo( _options, info );
670 void touchIndexFile(
const RepoInfo & info );
672 template<
typename OutputIterator>
677 boost::make_filter_iterator( filter,
repos().end(),
repos().end() ),
682 void init_knownServices();
683 void init_knownRepositories();
696 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
699 {
return new Impl( *
this ); }
705 {
return str <<
"RepoManager::Impl"; }
712 Pathname servfile = generateNonExistingName( _options.knownServicesPath,
713 generateFilename( service ) );
716 MIL <<
"saving service in " << servfile << endl;
718 std::ofstream file( servfile.c_str() );
725 MIL <<
"done" << endl;
744 const std::string & basefilename )
const
746 std::string final_filename = basefilename;
748 while ( PathInfo(dir + final_filename).isExist() )
753 return dir + Pathname(final_filename);
760 Pathname dir = _options.knownServicesPath;
761 std::list<Pathname> entries;
762 if (PathInfo(dir).isExist())
771 for_(it, entries.begin(), entries.end() )
787 inline void cleanupNonRepoMetadtaFolders(
const Pathname & cachePath_r,
788 const Pathname & defaultCachePath_r,
789 const std::list<std::string> & repoEscAliases_r )
791 if ( cachePath_r != defaultCachePath_r )
794 std::list<std::string> entries;
798 std::set<std::string> oldfiles;
799 set_difference( entries.begin(), entries.end(), repoEscAliases_r.begin(), repoEscAliases_r.end(),
800 std::inserter( oldfiles, oldfiles.end() ) );
801 for (
const std::string & old : oldfiles )
813 MIL <<
"start construct known repos" << endl;
815 if ( PathInfo(_options.knownReposPath).isExist() )
817 std::list<std::string> repoEscAliases;
818 std::list<RepoInfo> orphanedRepos;
819 for (
RepoInfo & repoInfo : repositories_in_dir(_options.knownReposPath) )
822 repoInfo.setMetadataPath( rawcache_path_for_repoinfo(_options, repoInfo) );
824 repoInfo.setPackagesPath( packagescache_path_for_repoinfo(_options, repoInfo) );
826 _reposX.insert( repoInfo );
829 const std::string & serviceAlias( repoInfo.service() );
830 if ( ! ( serviceAlias.empty() || hasService( serviceAlias ) ) )
832 WAR <<
"Schedule orphaned service repo for deletion: " << repoInfo << endl;
833 orphanedRepos.push_back( repoInfo );
837 repoEscAliases.push_back(repoInfo.escaped_alias());
841 if ( ! orphanedRepos.empty() )
843 for (
auto & repoInfo : orphanedRepos )
845 MIL <<
"Delete orphaned service repo " << repoInfo.alias() << endl;
851 % repoInfo.alias() );
853 removeRepository( repoInfo );
867 repoEscAliases.sort();
869 cleanupNonRepoMetadtaFolders( _options.repoRawCachePath, defaultCache.
repoRawCachePath, repoEscAliases );
870 cleanupNonRepoMetadtaFolders( _options.repoSolvCachePath, defaultCache.
repoSolvCachePath, repoEscAliases );
871 cleanupNonRepoMetadtaFolders( _options.repoPackagesCachePath, defaultCache.
repoPackagesCachePath, repoEscAliases );
873 MIL <<
"end construct known repos" << endl;
880 Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info );
881 Pathname productdatapath = rawproductdata_path_for_repoinfo( _options, info );
886 repokind = probeCache( productdatapath );
889 switch ( repokind.
toEnum() )
892 status =
RepoStatus( productdatapath/
"repodata/repomd.xml");
896 status =
RepoStatus( productdatapath/
"content" ) &&
RepoStatus( mediarootpath/
"media.1/media" );
915 Pathname productdatapath = rawproductdata_path_for_repoinfo( _options, info );
920 repokind = probeCache( productdatapath );
926 switch ( repokind.
toEnum() )
929 p = Pathname(productdatapath +
"/repodata/repomd.xml");
933 p = Pathname(productdatapath +
"/content");
937 p = Pathname(productdatapath +
"/cookie");
955 MIL <<
"Going to try to check whether refresh is needed for " << url <<
" (" << info.
type() <<
")" << endl;
958 Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info );
960 RepoStatus oldstatus = metadataStatus( info );
962 if ( oldstatus.
empty() )
964 MIL <<
"No cached metadata, going to refresh" << endl;
965 return REFRESH_NEEDED;
971 MIL <<
"never refresh CD/DVD" << endl;
972 return REPO_UP_TO_DATE;
976 policy = RefreshIfNeededIgnoreDelay;
981 if (policy != RefreshForced && policy != RefreshIfNeededIgnoreDelay)
984 double diff = difftime(
990 DBG <<
"last refresh = " << diff <<
" minutes ago" << endl;
996 WAR <<
"Repository '" << info.
alias() <<
"' was refreshed in the future!" << endl;
1000 MIL <<
"Repository '" << info.
alias()
1001 <<
"' has been refreshed less than repo.refresh.delay ("
1003 <<
") minutes ago. Advising to skip refresh" << endl;
1004 return REPO_CHECK_DELAYED;
1012 repokind = probe( url, info.
path() );
1016 switch ( repokind.
toEnum() )
1033 newstatus =
RepoStatus( MediaMounter(url).getPathName(info.
path()) );
1043 bool refresh =
false;
1044 if ( oldstatus == newstatus )
1046 MIL <<
"repo has not changed" << endl;
1047 if ( policy == RefreshForced )
1049 MIL <<
"refresh set to forced" << endl;
1055 MIL <<
"repo has changed, going to refresh" << endl;
1060 touchIndexFile(info);
1062 return refresh ? REFRESH_NEEDED : REPO_UP_TO_DATE;
1068 ERR <<
"refresh check failed for " << url << endl;
1072 return REFRESH_NEEDED;
1082 RepoException rexception( info,
_PL(
"Valid metadata not found at specified URL",
1083 "Valid metadata not found at specified URLs",
1097 if (checkIfToRefreshMetadata(info, url, policy)!=REFRESH_NEEDED)
1100 MIL <<
"Going to refresh metadata from " << url << endl;
1108 if ( repokind != probed )
1114 for_( it, repoBegin(), repoEnd() )
1116 if ( info.
alias() == (*it).alias() )
1119 modifiedrepo.
setType( repokind );
1120 modifyRepository( info.
alias(), modifiedrepo );
1127 Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info );
1138 Exception ex(
_(
"Can't create metadata cache directory."));
1146 shared_ptr<repo::Downloader> downloader_ptr;
1148 MIL <<
"Creating downloader for [ " << info.
alias() <<
" ]" << endl;
1161 for_( it, repoBegin(), repoEnd() )
1163 Pathname cachepath(rawcache_path_for_repoinfo( _options, *it ));
1164 if ( PathInfo(cachepath).isExist() )
1165 downloader_ptr->addCachePath(cachepath);
1168 downloader_ptr->download( media, tmpdir.
path() );
1172 MediaMounter media( url );
1175 Pathname productpath( tmpdir.
path() / info.
path() );
1195 ERR <<
"Trying another url..." << endl;
1207 ERR <<
"No more urls..." << endl;
1216 progress.
sendTo(progressfnc);
1226 progress.
sendTo(progressfnc);
1236 Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info );
1237 Pathname productdatapath = rawproductdata_path_for_repoinfo( _options, info );
1244 RepoStatus raw_metadata_status = metadataStatus(info);
1245 if ( raw_metadata_status.
empty() )
1250 refreshMetadata(info, RefreshIfNeeded, progressrcv );
1251 raw_metadata_status = metadataStatus(info);
1254 bool needs_cleaning =
false;
1255 if ( isCached( info ) )
1257 MIL << info.
alias() <<
" is already cached." << endl;
1260 if ( cache_status == raw_metadata_status )
1262 MIL << info.
alias() <<
" cache is up to date with metadata." << endl;
1263 if ( policy == BuildIfNeeded ) {
1267 MIL << info.
alias() <<
" cache rebuild is forced" << endl;
1271 needs_cleaning =
true;
1285 MIL << info.
alias() <<
" building cache..." << info.
type() << endl;
1287 Pathname base = solv_path_for_repoinfo( _options, info);
1295 if( ! PathInfo(base).userMayW() )
1297 Exception ex(
str::form(
_(
"Can't create cache at %s - no writing permissions."), base.c_str()) );
1300 Pathname solvfile = base /
"solv";
1306 switch ( repokind.
toEnum() )
1310 repokind = probeCache( productdatapath );
1316 MIL <<
"repo type is " << repokind << endl;
1318 switch ( repokind.
toEnum() )
1326 scoped_ptr<MediaMounter> forPlainDirs;
1329 cmd.push_back( PathInfo(
"/usr/bin/repo2solv" ).isFile() ?
"repo2solv" :
"repo2solv.sh" );
1331 cmd.push_back(
"-o" );
1332 cmd.push_back( solvfile.asString() );
1333 cmd.push_back(
"-X" );
1334 cmd.push_back(
"-A" );
1338 forPlainDirs.reset(
new MediaMounter( info.
url() ) );
1340 cmd.push_back(
"-R" );
1342 cmd.push_back( forPlainDirs->getPathName( info.
path() ).c_str() );
1345 cmd.push_back( productdatapath.asString() );
1348 std::string errdetail;
1351 WAR <<
" " << output;
1352 if ( errdetail.empty() ) {
1356 errdetail += output;
1359 int ret = prog.
close();
1376 setCacheStatus(info, raw_metadata_status);
1377 MIL <<
"Commit cache.." << endl;
1392 MIL <<
"going to probe the repo type at " << url <<
" (" << path <<
")" << endl;
1398 MIL <<
"Probed type NONE (not exists) at " << url <<
" (" << path <<
")" << endl;
1410 bool gotMediaException =
false;
1418 MIL <<
"Probed type RPMMD at " << url <<
" (" << path <<
")" << endl;
1425 DBG <<
"problem checking for repodata/repomd.xml file" << endl;
1427 gotMediaException =
true;
1434 MIL <<
"Probed type YAST2 at " << url <<
" (" << path <<
")" << endl;
1441 DBG <<
"problem checking for content file" << endl;
1443 gotMediaException =
true;
1449 MediaMounter media( url );
1450 if ( PathInfo(media.getPathName()/path).isDir() )
1453 MIL <<
"Probed type RPMPLAINDIR at " << url <<
" (" << path <<
")" << endl;
1467 if (gotMediaException)
1470 MIL <<
"Probed type NONE at " << url <<
" (" << path <<
")" << endl;
1481 MIL <<
"going to probe the cached repo at " << path_r << endl;
1485 if ( PathInfo(path_r/
"/repodata/repomd.xml").isFile() )
1487 else if ( PathInfo(path_r/
"/content").isFile() )
1489 else if ( PathInfo(path_r).isDir() )
1492 MIL <<
"Probed cached type " << ret <<
" at " << path_r << endl;
1500 MIL <<
"Going to clean up garbage in cache dirs" << endl;
1503 progress.
sendTo(progressrcv);
1506 std::list<Pathname> cachedirs;
1507 cachedirs.push_back(_options.repoRawCachePath);
1508 cachedirs.push_back(_options.repoPackagesCachePath);
1509 cachedirs.push_back(_options.repoSolvCachePath);
1511 for_( dir, cachedirs.begin(), cachedirs.end() )
1513 if ( PathInfo(*dir).isExist() )
1515 std::list<Pathname> entries;
1520 unsigned sdircount = entries.size();
1521 unsigned sdircurrent = 1;
1522 for_( subdir, entries.begin(), entries.end() )
1526 for_( r, repoBegin(), repoEnd() )
1527 if ( subdir->basename() == r->escaped_alias() )
1528 { found =
true;
break; }
1533 progress.
set( progress.
val() + sdircurrent * 100 / sdircount );
1538 progress.
set( progress.
val() + 100 );
1548 progress.
sendTo(progressrcv);
1551 MIL <<
"Removing raw metadata cache for " << info.
alias() << endl;
1562 Pathname solvfile = solv_path_for_repoinfo(_options, info) /
"solv";
1564 if ( ! PathInfo(solvfile).isExist() )
1589 MIL <<
"Try to handle exception by rebuilding the solv-file" << endl;
1590 cleanCache( info, progressrcv );
1591 buildCache( info, BuildIfNeeded, progressrcv );
1609 MIL <<
"Try adding repo " << info << endl;
1616 if ( _options.probe )
1618 DBG <<
"unknown repository type, probing" << endl;
1619 assert_urls(tosave);
1633 Pathname repofile = generateNonExistingName(
1634 _options.knownReposPath, generateFilename(tosave));
1636 MIL <<
"Saving repo in " << repofile << endl;
1638 std::ofstream file(repofile.c_str());
1652 RepoInfo & oinfo( const_cast<RepoInfo &>(info) );
1656 reposManip().insert(tosave);
1661 UrlCredentialExtractor( _options.rootDir ).collect( tosave.
baseUrls() );
1666 MIL <<
"done" << endl;
1673 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
1678 for_ ( kit, repoBegin(), repoEnd() )
1680 if ( (*it).alias() == (*kit).alias() )
1682 ERR <<
"To be added repo " << (*it).alias() <<
" conflicts with existing repo " << (*kit).alias() << endl;
1688 std::string filename = Pathname(url.
getPathName()).basename();
1690 if ( filename == Pathname() )
1699 Pathname repofile = generateNonExistingName(_options.knownReposPath, filename);
1701 MIL <<
"Saving " << repos.size() <<
" repo" << ( repos.size() ?
"s" :
"" ) <<
" in " << repofile << endl;
1703 std::ofstream file(repofile.c_str());
1710 for ( std::list<RepoInfo>::iterator it = repos.begin();
1714 MIL <<
"Saving " << (*it).alias() << endl;
1715 it->setFilepath(repofile.asString());
1716 it->dumpAsIniOn(file);
1717 reposManip().insert(*it);
1722 MIL <<
"done" << endl;
1734 MIL <<
"Going to delete repo " << info.
alias() << endl;
1736 for_( it, repoBegin(), repoEnd() )
1741 if ( (!info.
alias().empty()) && ( info.
alias() != (*it).alias() ) )
1756 std::list<RepoInfo> filerepos = repositories_in_file(todelete.
filepath());
1757 if ( filerepos.size() == 0
1758 ||(filerepos.size() == 1 && filerepos.front().alias() == todelete.
alias() ) )
1762 if ( ! ( ret == 0 || ret == ENOENT ) )
1767 MIL << todelete.
alias() <<
" successfully deleted." << endl;
1779 std::ofstream file(todelete.
filepath().c_str());
1785 for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
1786 fit != filerepos.end();
1789 if ( (*fit).alias() != todelete.
alias() )
1790 (*fit).dumpAsIniOn(file);
1798 if ( isCached(todelete) )
1799 cleanCache( todelete, cSubprogrcv);
1801 cleanMetadata( todelete, mSubprogrcv );
1802 cleanPackages( todelete, pSubprogrcv );
1803 reposManip().erase(todelete);
1804 MIL << todelete.
alias() <<
" successfully deleted." << endl;
1818 RepoInfo toedit = getRepositoryInfo(alias);
1822 if ( alias != newinfo.
alias() && hasRepo( newinfo.
alias() ) )
1834 std::list<RepoInfo> filerepos = repositories_in_file(toedit.
filepath());
1844 std::ofstream file(toedit.
filepath().c_str());
1850 for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
1851 fit != filerepos.end();
1856 if ( (*fit).alias() != toedit.
alias() )
1857 (*fit).dumpAsIniOn(file);
1863 reposManip().erase(toedit);
1864 reposManip().insert(newinfo);
1866 UrlCredentialExtractor( _options.rootDir ).collect( newinfo.
baseUrls() );
1868 MIL <<
"repo " << alias <<
" modified" << endl;
1877 if ( it !=
repos().end() )
1887 for_( it, repoBegin(), repoEnd() )
1889 for_( urlit, (*it).baseUrlsBegin(), (*it).baseUrlsEnd() )
1891 if ( (*urlit).asString(urlview) == url.
asString(urlview) )
1908 assert_alias( service );
1911 if ( hasService( service.
alias() ) )
1917 saveService( toSave );
1921 UrlCredentialExtractor( _options.rootDir ).collect( toSave.
url() );
1923 MIL <<
"added service " << toSave.
alias() << endl;
1930 MIL <<
"Going to delete service " << alias << endl;
1932 const ServiceInfo & service = getService( alias );
1934 Pathname location = service.
filepath();
1935 if( location.empty() )
1944 if ( tmpSet.size() == 1 )
1951 MIL << alias <<
" successfully deleted." << endl;
1957 std::ofstream file(location.c_str());
1964 for_(it, tmpSet.begin(), tmpSet.end())
1966 if( it->alias() != alias )
1967 it->dumpAsIniOn(file);
1970 MIL << alias <<
" successfully deleted from file " << location << endl;
1974 RepoCollector rcollector;
1975 getRepositoriesInService( alias,
1976 boost::make_function_output_iterator( bind( &RepoCollector::collect, &rcollector, _1 ) ) );
1978 for_(rit, rcollector.repos.begin(), rcollector.repos.end())
1979 removeRepository(*rit);
1988 ServiceSet services( serviceBegin(), serviceEnd() );
1989 for_( it, services.begin(), services.end() )
1991 if ( !it->enabled() )
1995 refreshService(*it, options_r);
2005 assert_alias( service );
2006 assert_url( service );
2010 bool serviceModified =
false;
2011 MIL <<
"Going to refresh service '" << service.
alias() <<
"', url: "<< service.
url() <<
", opts: " << options_r << endl;
2022 serviceModified =
true;
2027 std::string servicesTargetDistro = _options.servicesTargetDistro;
2028 if ( servicesTargetDistro.empty() )
2032 DBG <<
"ServicesTargetDistro: " << servicesTargetDistro << endl;
2035 RepoCollector collector(servicesTargetDistro);
2047 uglyHack.first =
true;
2048 uglyHack.second = e;
2057 for_( it, collector.repos.begin(), collector.repos.end() )
2060 it->setAlias(
str::form(
"%s:%s", service.
alias().c_str(), it->alias().c_str() ) );
2062 it->setService( service.
alias() );
2065 newRepoStates[it->alias()] = *it;
2073 if ( !it->path().empty() )
2075 if ( it->path() !=
"/" )
2080 if ( it->baseUrlsEmpty() )
2083 if ( !path.empty() )
2085 it->setBaseUrl( std::move(url) );
2087 else if ( !path.empty() )
2090 for (
Url & url : urls )
2094 it->setBaseUrls( std::move(urls) );
2101 RepoInfoList oldRepos;
2102 getRepositoriesInService( service.
alias(), std::back_inserter( oldRepos ) );
2106 for_( oldRepo, oldRepos.begin(), oldRepos.end() )
2108 if ( ! foundAliasIn( oldRepo->alias(), collector.repos ) )
2110 if ( oldRepo->enabled() )
2113 const auto & last = service.
repoStates().find( oldRepo->alias() );
2114 if ( last != service.
repoStates().end() && ! last->second.enabled )
2116 DBG <<
"Service removes user enabled repo " << oldRepo->alias() << endl;
2118 serviceModified =
true;
2121 DBG <<
"Service removes enabled repo " << oldRepo->alias() << endl;
2124 DBG <<
"Service removes disabled repo " << oldRepo->alias() << endl;
2126 removeRepository( *oldRepo );
2132 UrlCredentialExtractor urlCredentialExtractor( _options.rootDir );
2133 for_( it, collector.repos.begin(), collector.repos.end() )
2139 TriBool toBeEnabled( indeterminate );
2140 DBG <<
"Service request to " << (it->enabled()?
"enable":
"disable") <<
" service repo " << it->alias() << endl;
2142 if ( options_r.testFlag( RefreshService_restoreStatus ) )
2144 DBG <<
"Opt RefreshService_restoreStatus " << it->alias() << endl;
2156 DBG <<
"User request to enable service repo " << it->alias() << endl;
2162 serviceModified =
true;
2166 DBG <<
"User request to disable service repo " << it->alias() << endl;
2167 toBeEnabled =
false;
2171 RepoInfoList::iterator oldRepo( findAlias( it->alias(), oldRepos ) );
2172 if ( oldRepo == oldRepos.end() )
2177 if ( ! indeterminate(toBeEnabled) )
2178 it->setEnabled( toBeEnabled );
2180 DBG <<
"Service adds repo " << it->alias() <<
" " << (it->enabled()?
"enabled":
"disabled") << endl;
2181 addRepository( *it );
2186 bool oldRepoModified =
false;
2188 if ( indeterminate(toBeEnabled) )
2192 if ( oldRepo->enabled() == it->enabled() )
2193 toBeEnabled = it->enabled();
2194 else if (options_r.testFlag( RefreshService_restoreStatus ) )
2196 toBeEnabled = it->enabled();
2197 DBG <<
"Opt RefreshService_restoreStatus " << it->alias() <<
" forces " << (toBeEnabled?
"enabled":
"disabled") << endl;
2201 const auto & last = service.
repoStates().find( oldRepo->alias() );
2202 if ( last == service.
repoStates().end() || last->second.enabled != it->enabled() )
2203 toBeEnabled = it->enabled();
2206 toBeEnabled = oldRepo->enabled();
2207 DBG <<
"User modified service repo " << it->alias() <<
" may stay " << (toBeEnabled?
"enabled":
"disabled") << endl;
2213 if ( toBeEnabled == oldRepo->enabled() )
2215 DBG <<
"Service repo " << it->alias() <<
" stays " << (oldRepo->enabled()?
"enabled":
"disabled") << endl;
2217 else if ( toBeEnabled )
2219 DBG <<
"Service repo " << it->alias() <<
" gets enabled" << endl;
2220 oldRepo->setEnabled(
true );
2221 oldRepoModified =
true;
2225 DBG <<
"Service repo " << it->alias() <<
" gets disabled" << endl;
2226 oldRepo->setEnabled(
false );
2227 oldRepoModified =
true;
2233 if ( oldRepo->rawName() != it->rawName() )
2235 DBG <<
"Service repo " << it->alias() <<
" gets new NAME " << it->rawName() << endl;
2236 oldRepo->setName( it->rawName() );
2237 oldRepoModified =
true;
2241 if ( oldRepo->autorefresh() != it->autorefresh() )
2243 DBG <<
"Service repo " << it->alias() <<
" gets new AUTOREFRESH " << it->autorefresh() << endl;
2244 oldRepo->setAutorefresh( it->autorefresh() );
2245 oldRepoModified =
true;
2249 if ( oldRepo->priority() != it->priority() )
2251 DBG <<
"Service repo " << it->alias() <<
" gets new PRIORITY " << it->priority() << endl;
2252 oldRepo->setPriority( it->priority() );
2253 oldRepoModified =
true;
2259 urlCredentialExtractor.extract( newUrls );
2260 if ( oldRepo->rawBaseUrls() != newUrls )
2262 DBG <<
"Service repo " << it->alias() <<
" gets new URLs " << newUrls << endl;
2263 oldRepo->setBaseUrls( std::move(newUrls) );
2264 oldRepoModified =
true;
2274 oldRepo->getRawGpgChecks( ogpg[0], ogpg[1], ogpg[2] );
2275 it-> getRawGpgChecks( ngpg[0], ngpg[1], ngpg[2] );
2276 #define Z_CHKGPG(I,N) \
2277 if ( ! sameTriboolState( ogpg[I], ngpg[I] ) ) \
2279 DBG << "Service repo " << it->alias() << " gets new "#N"Check " << ngpg[I] << endl; \
2280 oldRepo->set##N##Check( ngpg[I] ); \
2281 oldRepoModified = true; \
2290 if ( oldRepoModified )
2292 modifyRepository( oldRepo->alias(), *oldRepo );
2301 serviceModified =
true;
2308 serviceModified =
true;
2316 modifyService( service.
alias(), service );
2319 if ( uglyHack.first )
2321 throw( uglyHack.second );
2329 MIL <<
"Going to modify service " << oldAlias << endl;
2340 const ServiceInfo & oldService = getService(oldAlias);
2342 Pathname location = oldService.
filepath();
2343 if( location.empty() )
2353 std::ofstream file(location.c_str());
2354 for_(it, tmpSet.begin(), tmpSet.end())
2356 if( *it != oldAlias )
2357 it->dumpAsIniOn(file);
2366 UrlCredentialExtractor( _options.rootDir ).collect( service.
url() );
2370 if ( oldAlias != service.
alias()
2373 std::vector<RepoInfo> toModify;
2374 getRepositoriesInService(oldAlias, std::back_inserter(toModify));
2375 for_( it, toModify.begin(), toModify.end() )
2382 const auto & last = service.
repoStates().find( it->alias() );
2384 it->setEnabled( last->second.enabled );
2387 it->setEnabled(
false );
2390 if ( oldAlias != service.
alias() )
2391 it->setService(service.
alias());
2393 modifyRepository(it->alias(), *it);
2437 : _pimpl( new
Impl(opt) )
2469 std::string host( url_r.
getHost() );
2470 if ( ! host.empty() )
2592 {
return str << *obj.
_pimpl; }
void saveToCookieFile(const Pathname &path_r) const
Save the status information to a cookie file.
Pathname packagesPath(const RepoInfo &info) const
RepoManager(const RepoManagerOptions &options=RepoManagerOptions())
static const ValueType day
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
void removeService(const std::string &alias)
Removes service specified by its name.
thrown when it was impossible to match a repository
Thrown when the repo alias is found to be invalid.
RepoManagerOptions(const Pathname &root_r=Pathname())
Default ctor following ZConfig global settings.
bool hasService(const std::string &alias) const
std::string alias() const
unique identifier for this source.
static const std::string & sha1()
sha1
int exchange(const Pathname &lpath, const Pathname &rpath)
Exchanges two files or directories.
RepoStatus status(MediaSetAccess &media)
Status of the remote repository.
void setCacheStatus(const RepoInfo &info, const RepoStatus &status)
std::string generateFilename(const ServiceInfo &info) const
thrown when it was impossible to determine this repo type.
std::string digest()
get hex string representation of the digest
Retrieval of repository list for a service.
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Write this RepoInfo object into str in a .repo file format.
void refreshServices(const RefreshServiceOptions &options_r)
Pathname repoRawCachePath
bool serviceEmpty() const
Gets true if no service is in RepoManager (so no one in specified location)
void modifyService(const std::string &oldAlias, const ServiceInfo &service)
Modifies service file (rewrites it with new values) and underlying repositories if needed...
Read service data from a .service file.
void sendTo(const ReceiverFnc &fnc_r)
Set ReceiverFnc.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Date timestamp() const
The time the data were changed the last time.
ServiceConstIterator serviceBegin() const
static ZConfig & instance()
Singleton ctor.
static TmpDir makeSibling(const Pathname &sibling_r)
Provide a new empty temporary directory as sibling.
void refreshService(const std::string &alias, const RefreshServiceOptions &options_r)
scoped_ptr< media::CredentialManager > _cmPtr
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
void cleanCacheDirGarbage(const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Remove any subdirectories of cache directories which no longer belong to any of known repositories...
RepoConstIterator repoBegin() const
Pathname filepath() const
File where this repo was read from.
void resetDispose()
Set no dispose function.
bool isCached(const RepoInfo &info) const
void refreshServices(const RefreshServiceOptions &options_r=RefreshServiceOptions())
Refreshes all enabled services.
Service plugin is immutable.
RepoStatus metadataStatus(const RepoInfo &info) const
Status of local metadata.
std::string getPathName(EEncoding eflag=zypp::url::E_DECODED) const
Returns the path name from the URL.
#define _PL(MSG1, MSG2, N)
bool empty() const
Test for an empty path.
std::string getHost(EEncoding eflag=zypp::url::E_DECODED) const
Returns the hostname or IP from the URL authority.
RefreshCheckStatus
Possibly return state of checkIfRefreshMEtadata function.
Pathname metadataPath(const RepoInfo &info) const
Path where the metadata is downloaded and kept.
const std::string & command() const
The command we're executing.
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
RepoSet::size_type RepoSizeType
bool empty() const
Whether the status is empty (default constucted)
void loadFromCache(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Load resolvables into the pool.
ServiceConstIterator serviceEnd() const
Iterator to place behind last service in internal storage.
repo::RepoType probe(const Url &url, const Pathname &path) const
Probe repo metadata type.
std::string generateFilename(const RepoInfo &info) const
RepoConstIterator repoBegin() const
void addHistory(const std::string &msg_r)
Add some message text to the history.
void refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy=RefreshIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Refresh local raw cache.
Pathname packagesPath(const RepoInfo &info) const
Path where the rpm packages are downloaded and kept.
void addService(const std::string &alias, const Url &url)
void touchIndexFile(const RepoInfo &info)
void setAlias(const std::string &alias)
set the repository alias
void init_knownRepositories()
void addRepoToEnable(const std::string &alias_r)
Add alias_r to the set of ReposToEnable.
void removeRepository(const RepoInfo &info, OPT_PROGRESS)
RefreshServiceFlags RefreshServiceOptions
Options tuning RefreshService.
void modifyService(const std::string &oldAlias, const ServiceInfo &newService)
bool toMax()
Set counter value to current max value (unless no range).
void setProbedType(const repo::RepoType &t) const
This allows to adjust the RepoType lazy, from NONE to some probed value, even for const objects...
void refreshService(const std::string &alias, const RefreshServiceOptions &options_r=RefreshServiceOptions())
Refresh specific service.
void setFilepath(const Pathname &filename)
set the path to the .repo file
What is known about a repository.
void removeRepository(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Remove the best matching repository from known repos list.
const RepoSet & repos() const
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
const RepoStates & repoStates() const
Access the remembered repository states.
Pathname knownServicesPath
void setBaseUrl(const Url &url)
Clears current base URL list and adds url.
bool enabled() const
If enabled is false, then this repository must be ignored as if does not exists, except when checking...
void reposErase(const std::string &alias_r)
Remove a Repository named alias_r.
Service already exists and some unique attribute can't be duplicated.
void refreshService(const ServiceInfo &service, const RefreshServiceOptions &options_r)
bool repo_add_probe() const
Whether repository urls should be probed.
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
std::string targetDistribution() const
This is register.target attribute of the installed base product.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
static RepoStatus fromCookieFile(const Pathname &path)
Reads the status from a cookie file.
Service without alias was used in an operation.
RepoStatus metadataStatus(const RepoInfo &info) const
RepoSet::const_iterator RepoConstIterator
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Url::asString() view options.
void cleanMetadata(const RepoInfo &info, OPT_PROGRESS)
repo::RepoType probeCache(const Pathname &path_r) const
Probe Metadata in a local cache directory.
void modifyRepository(const std::string &alias, const RepoInfo &newinfo, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Modify repository attributes.
Pathname repoSolvCachePath
std::vector< std::string > Arguments
RepoManagerOptions _options
std::string asString() const
Returns a default string representation of the Url object.
ServiceInfo getService(const std::string &alias) const
RepoSizeType repoSize() const
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
void remember(const Exception &old_r)
Store an other Exception as history.
std::string & replaceAll(std::string &str_r, const std::string &from_r, const std::string &to_r)
Replace all occurrences of from_r with to_r in str_r (inplace).
void removeService(const ServiceInfo &service)
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Progress callback from another progress.
std::map< std::string, RepoState > RepoStates
std::string label() const
Label for use in messages for the user interface.
void addRepository(const RepoInfo &info, OPT_PROGRESS)
static const ServiceType RIS
Repository Index Service (RIS) (formerly known as 'Novell Update' (NU) service)
RepoManager implementation.
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
void setPathName(const std::string &path, EEncoding eflag=zypp::url::E_DECODED)
Set the path name.
std::set< RepoInfo > RepoSet
RepoInfo typedefs.
bool toMin()
Set counter value to current min value.
RepoInfo getRepositoryInfo(const std::string &alias, OPT_PROGRESS)
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
static Pool instance()
Singleton ctor.
bool serviceEmpty() const
static RepoManagerOptions makeTestSetup(const Pathname &root_r)
Test setup adjusting all paths to be located below one root_r directory.
Pathname rootDir
remembers root_r value for later use
void removeRepository(const RepoInfo &repo)
Log recently removed repository.
Provide a new empty temporary directory and recursively delete it when no longer needed.
void clearReposToDisable()
Clear the set of ReposToDisable.
Lightweight repository attribute value lookup.
std::string asCompleteString() const
Returns a complete string representation of the Url object.
std::ostream & operator<<(std::ostream &str, const Exception &obj)
RepoConstIterator repoEnd() const
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
void cleanCacheDirGarbage(OPT_PROGRESS)
int unlink(const Pathname &path)
Like 'unlink'.
thrown when it was impossible to determine one url for this repo.
static const ServiceType NONE
No service set.
static const SolvAttr repositoryToolVersion
Service type enumeration.
void modifyRepository(const std::string &alias, const RepoInfo &newinfo_r, OPT_PROGRESS)
ServiceSet::const_iterator ServiceConstIterator
void setRepoStates(RepoStates newStates_r)
Remember a new set of repository states.
std::ostream & operator<<(std::ostream &str, const DeltaCandidates &obj)
repo::ServiceType probeService(const Url &url) const
Probe the type or the service.
int recursive_rmdir(const Pathname &path)
Like 'rm -r DIR'.
void setMetadataPath(const Pathname &path)
set the path where the local metadata is stored
void setType(const repo::RepoType &t)
set the repository type
Maintain [min,max] and counter (value) for progress counting.
RepoStatus cacheStatus(const RepoInfo &info) const
static bool error(const MessageString &msg_r, const UserData &userData_r=UserData())
send error text
Pathname generateNonExistingName(const Pathname &dir, const std::string &basefilename) const
Generate a non existing filename in a directory, using a base name.
void addRepository(const RepoInfo &repo)
Log a newly added repository.
RepoInfo getRepo(const std::string &alias) const
Writing the zypp history fileReference counted signleton for writhing the zypp history file...
static bool schemeIsVolatile(const std::string &scheme_r)
cd dvd
void addRepository(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Adds a repository to the list of known repositories.
RepoInfo getRepositoryInfo(const std::string &alias, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Find a matching repository info.
static const ServiceType PLUGIN
Plugin services are scripts installed on your system that provide the package manager with repositori...
Base Exception for service handling.
std::string receiveLine()
Read one line from the input stream.
void init_knownServices()
void delRepoToEnable(const std::string &alias_r)
Remove alias_r from the set of ReposToEnable.
static std::string makeStupidAlias(const Url &url_r=Url())
Some stupid string but suitable as alias for your url if nothing better is available.
RefreshCheckStatus checkIfToRefreshMetadata(const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy=RefreshIfNeeded)
Checks whether to refresh metadata for specified repository and url.
void cleanCache(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
clean local cache
void cleanCache(const RepoInfo &info, OPT_PROGRESS)
std::string numstring(char n, int w=0)
ServiceSet::size_type ServiceSizeType
bool reposToDisableEmpty() const
static const RepoType NONE
int touch(const Pathname &path)
Change file's modification and access times.
ServiceInfo getService(const std::string &alias) const
Finds ServiceInfo by alias or return ServiceInfo::noService.
void getRepositoriesInService(const std::string &alias, OutputIterator out) const
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
url_set baseUrls() const
The complete set of repository urls.
std::ostream & copy(std::istream &from_r, std::ostream &to_r)
Copy istream to ostream.
int close()
Wait for the progamm to complete.
bool hasRepo(const std::string &alias) const
Return whether there is a known repository for alias.
static const RepoType RPMMD
creates and provides information about known sources.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
RepoStatus cacheStatus(const RepoInfo &info) const
Status of metadata cache.
repo::RepoType type() const
Type of repository,.
int readdir(std::list< std::string > &retlist_r, const Pathname &path_r, bool dots_r)
Return content of directory via retlist.
RepoSizeType repoSize() const
void addService(const ServiceInfo &service)
std::list< RepoInfo > readRepoFile(const Url &repo_file)
Parses repo_file and returns a list of RepoInfo objects corresponding to repositories found within th...
RepoInfo getRepo(const std::string &alias) const
Find RepoInfo by alias or return RepoInfo::noRepo.
Url rawUrl() const
The service raw url (no variables replaced)
static const RepoType YAST2
thrown when it was impossible to determine an alias for this repo.
void buildCache(const RepoInfo &info, CacheBuildPolicy policy=BuildIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Refresh local cache.
Base class for Exception.
void addRepositories(const Url &url, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Adds repositores from a repo file to the list of known repositories.
std::set< ServiceInfo > ServiceSet
ServiceInfo typedefs.
Exception for repository handling.
void saveService(ServiceInfo &service) const
Impl(const RepoManagerOptions &opt)
media::MediaAccessId _mid
static Date now()
Return the current time.
repo::RepoType probe(const Url &url, const Pathname &path=Pathname()) const
Probe the metadata type of a repository located at url.
DefaultIntegral< bool, false > _reposDirty
ServiceConstIterator serviceEnd() const
Functor thats filter RepoInfo by service which it belongs to.
bool isCached(const RepoInfo &info) const
Whether a repository exists in cache.
bool hasRepo(const std::string &alias) const
Reference counted access to a _Tp object calling a custom Dispose function when the last AutoDispose ...
The repository cache is not built yet so you can't create the repostories from the cache...
Url url() const
Pars pro toto: The first repository url.
void eraseFromPool()
Remove this Repository from it's Pool.
Pathname repoPackagesCachePath
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
static const ServiceInfo noService
Represents an empty service.
RepoConstIterator repoEnd() const
bool hasService(const std::string &alias) const
Return whether there is a known service for alias.
void removeService(const std::string &alias)
void buildCache(const RepoInfo &info, CacheBuildPolicy policy, OPT_PROGRESS)
bool repoToDisableFind(const std::string &alias_r) const
Whether alias_r is mentioned in ReposToDisable.
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
bool regex_match(const std::string &s, smatch &matches, const regex ®ex)
regex ZYPP_STR_REGEX regex ZYPP_STR_REGEX
Thrown when the repo alias is found to be invalid.
ServiceSizeType serviceSize() const
Gets count of service in RepoManager (in specified location)
static const RepoType RPMPLAINDIR
static const std::string & systemRepoAlias()
Reserved system repository alias .
bool repoToEnableFind(const std::string &alias_r) const
Whether alias_r is mentioned in ReposToEnable.
ServiceSizeType serviceSize() const
Track changing files or directories.
void cleanPackages(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Clean local package cache.
unsigned repo_refresh_delay() const
Amount of time in minutes that must pass before another refresh.
Repository already exists and some unique attribute can't be duplicated.
ServiceConstIterator serviceBegin() const
Iterator to first service in internal storage.
bool set(value_type val_r)
Set new counter value.
std::string getScheme() const
Returns the scheme name of the URL.
Url url() const
The service url.
static bool schemeIsDownloading(const std::string &scheme_r)
http https ftp sftp tftp
void modifyRepository(const RepoInfo &oldrepo, const RepoInfo &newrepo)
Log certain modifications to a repository.
std::ostream & operator<<(std::ostream &str, const RepoManager::Impl &obj)
Impl * clone() const
clone for RWCOW_pointer
urls_size_type baseUrlsSize() const
number of repository urls
static bool warning(const MessageString &msg_r, const UserData &userData_r=UserData())
send warning text
Repository addRepoSolv(const Pathname &file_r, const std::string &name_r)
Load Solvables from a solv-file into a Repository named name_r.
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void name(const std::string &name_r)
Set counter name.
Downloader for YUM (rpm-nmd) repositories Encapsulates all the knowledge of which files have to be do...
Pathname metadataPath(const RepoInfo &info) const
void setProbedType(const repo::ServiceType &t) const
Lazy init service type.
void cleanPackages(const RepoInfo &info, OPT_PROGRESS)
void loadFromCache(const RepoInfo &info, OPT_PROGRESS)
std::string hexstring(char n, int w=4)
std::string asUserString() const
Translated error message as string suitable for the user.
void addService(const std::string &alias, const Url &url)
Adds new service by it's alias and url.
void refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy, OPT_PROGRESS)
Service has no or invalid url defined.
static bool schemeIsLocal(const std::string &scheme_r)
hd cd dvd dir file iso
void addRepositories(const Url &url, OPT_PROGRESS)
void cleanMetadata(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Clean local metadata.
Pathname path() const
Repository path.
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Writes ServiceInfo to stream in ".service" format.
repo::ServiceType type() const
Service type.
iterator begin() const
Iterator to the begin of query results.
Repository type enumeration.
RefreshCheckStatus checkIfToRefreshMetadata(const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy)
repo::ServiceType probeService(const Url &url) const