21#include <zypp-core/base/InputStream>
25#include <zypp-core/base/DefaultIntegral>
38#include <zypp-media/auth/CredentialManager>
39#include <zypp-media/MediaException>
61#include <zypp-core/zyppng/pipelines/Lift>
71#define OPT_PROGRESS const ProgressData::ReceiverFnc & = ProgressData::ReceiverFnc()
82 const char *
env =
getenv(
"ZYPP_PLUGIN_APPDATA_FORCE_COLLECT");
104 MediaMounter(
const MediaMounter &) =
delete;
105 MediaMounter(MediaMounter &&) =
delete;
106 MediaMounter &operator=(
const MediaMounter &) =
delete;
107 MediaMounter &operator=(MediaMounter &&) =
delete;
121 Pathname getPathName(
const Pathname &
path_r = Pathname() )
const
148#define OUTS(V) case RepoManager::V: str << #V; break
149 OUTS( RefreshIfNeeded );
150 OUTS( RefreshForced );
151 OUTS( RefreshIfNeededIgnoreDelay );
160#define OUTS(V) case RepoManager::V: str << #V; break
161 OUTS( REFRESH_NEEDED );
162 OUTS( REPO_UP_TO_DATE );
163 OUTS( REPO_CHECK_DELAYED );
172#define OUTS(V) case RepoManager::V: str << #V; break
173 OUTS( BuildIfNeeded );
190 _pluginRepoverification(_options.pluginsPath /
"repoverification",
192 init_knownServices();
193 init_knownRepositories();
205 &&
geteuid() == 0 && ( _options.rootDir.empty() || _options.rootDir ==
"/" ) )
208 std::list<Pathname> entries;
209 filesystem::readdir( entries, _options.pluginsPath/
"appdata",
false );
210 if ( ! entries.empty() )
213 cmd.push_back(
"<" );
214 cmd.push_back(
">" );
215 cmd.push_back(
"PROGRAM" );
216 for (
const auto &
rinfo : repos() )
218 if ( !
rinfo.enabled() )
220 cmd.push_back(
"-R" );
222 cmd.push_back(
"-t" );
223 cmd.push_back(
rinfo.type().asString() );
224 cmd.push_back(
"-p" );
225 cmd.push_back( (
rinfo.metadataPath()/
rinfo.path()).asString() );
228 for_(
it, entries.begin(), entries.end() )
232 if (
pi.isFile() &&
pi.userMayRX() )
235 cmd[2] =
pi.asString();
246 RefreshCheckStatus checkIfToRefreshMetadata(
const RepoInfo & info,
const Url & url, RawMetadataRefreshPolicy policy );
280 {
return new Impl( *
this ); }
286 {
return str <<
"RepoManager::Impl"; }
292 return metadataStatus( info ).empty() ? REFRESH_NEEDED : REPO_UP_TO_DATE;
296 using zyppng::operators::operator|;
298 refreshGeoIPData( { url } );
300 auto ctx = zyppng::SyncContext::create();
301 auto res = zyppng::repo::SyncRefreshContext::create(
ctx, info, _options )
319 using zyppng::operators::operator|;
322 refreshGeoIPData( info.
baseUrls() );
329 "Valid metadata not found at specified URLs",
333 auto ctx = SyncContext::create();
338 for_(
it, repoBegin(), repoEnd() )
340 if ( info.
alias() == (*it).alias() )
355 if (
it->schemeIsVolatile() &&
not metadataStatus( info ).empty() ) {
361 auto res = zyppng::repo::SyncRefreshContext::create(
ctx, info, _options )
380 ERR <<
"Trying another url..." << endl;
391 ERR <<
"No more urls..." << endl;
418 if ( isCached( info ) )
420 MIL << info.
alias() <<
" is already cached." << endl;
425 MIL << info.
alias() <<
" cache is up to date with metadata." << endl;
426 if ( policy == BuildIfNeeded )
430 if ( !
PathInfo(base/
"solv.idx").isExist() )
436 MIL << info.
alias() <<
" cache rebuild is forced" << endl;
446 progress.name(
str::form(
_(
"Building repository '%s' cache"), info.
label().c_str()));
454 MIL << info.
alias() <<
" building cache..." << info.
type() << endl;
498 cmd.push_back(
PathInfo(
"/usr/bin/repo2solv" ).isFile() ?
"repo2solv" :
"repo2solv.sh" );
500 cmd.push_back(
"-o" );
502 cmd.push_back(
"-X" );
509 cmd.push_back(
"-R" );
543 MIL <<
"Commit cache.." << endl;
556 repo::RepoType RepoManager::Impl::probe(
const Url & url,
const Pathname & path )
const
560 using zyppng::operators::operator|;
562 auto ctx = zyppng::SyncContext::create();
564 |
and_then( [&](
auto mediaHandle ) {
585 MIL <<
"Try to handle exception by rebuilding the solv-file" << endl;
602 progress.name(
str::form(
_(
"Adding repository '%s'"), info.
label().c_str()));
605 MIL <<
"Try adding repo " << info << endl;
608 if ( repos().find(
tosave) != repos().end() )
612 if ( _options.probe )
614 DBG <<
"unknown repository type, probing" << endl;
629 MIL <<
"done" << endl;
636 for ( std::list<RepoInfo>::const_iterator
it = repos.begin();
641 for_ (
kit, repoBegin(), repoEnd() )
643 if ( (*it).alias() == (*kit).alias() )
645 ERR <<
"To be added repo " << (*it).alias() <<
" conflicts with existing repo " << (*kit).alias() << endl;
651 std::string filename = Pathname(url.
getPathName()).basename();
653 if ( filename == Pathname() )
662 Pathname
repofile = generateNonExistingName(_options.knownReposPath, filename);
664 MIL <<
"Saving " << repos.size() <<
" repo" << ( repos.size() ?
"s" :
"" ) <<
" in " <<
repofile << endl;
666 std::ofstream file(
repofile.c_str());
673 for ( std::list<RepoInfo>::iterator
it = repos.begin();
677 MIL <<
"Saving " << (*it).alias() << endl;
678 it->dumpAsIniOn(file);
682 reposManip().insert(*
it);
687 MIL <<
"done" << endl;
694 removeRepositoryImpl( info, std::ref(
adapt) );
703 void RepoManager::Impl::refreshServices(
const RefreshServiceOptions &
options_r )
707 ServiceSet services( serviceBegin(), serviceEnd() );
708 for_(
it, services.begin(), services.end() )
710 if ( !
it->enabled() )
721 void RepoManager::Impl::refreshService(
const std::string & alias,
const RefreshServiceOptions &
options_r )
726 MIL <<
"Going to refresh service '" << service.alias() <<
"', url: " << service.url() <<
", opts: " <<
options_r << endl;
728 if ( service.ttl() && !(
options_r.testFlag( RefreshService_forceRefresh) ||
options_r.testFlag( RefreshService_restoreStatus ) ) )
731 Date lrf = service.lrf();
737 if ( (lrf+=service.ttl()) > now )
739 MIL <<
"Skip: '" << service.alias() <<
"' metadata valid until " << lrf << endl;
744 WAR <<
"Force: '" << service.alias() <<
"' metadata last refresh in the future: " << lrf << endl;
761 service.setProbedType( type );
767 std::string servicesTargetDistro = _options.servicesTargetDistro;
768 if ( servicesTargetDistro.empty() )
772 DBG <<
"ServicesTargetDistro: " << servicesTargetDistro << endl;
797 if ( service.ttl() !=
origTtl )
799 if ( !service.ttl() )
800 service.setLrf( Date() );
809 for_(
it, collector.repos.begin(), collector.repos.end() )
812 it->setAlias(
str::form(
"%s:%s", service.alias().c_str(),
it->alias().c_str() ) );
814 it->setService( service.alias() );
825 if ( !
it->path().empty() )
827 if (
it->path() !=
"/" )
832 if (
it->baseUrlsEmpty() )
834 Url url( service.rawUrl() );
837 it->setBaseUrl( std::move(url) );
839 else if ( !path.empty() )
842 for (
Url & url : urls )
846 it->setBaseUrls( std::move(urls) );
854 getRepositoriesInService( service.alias(), std::back_inserter(
oldRepos ) );
865 const auto & last = service.repoStates().find(
oldRepo->alias() );
866 if ( last != service.repoStates().end() && ! last->second.enabled )
868 DBG <<
"Service removes user enabled repo " <<
oldRepo->alias() << endl;
869 service.addRepoToEnable(
oldRepo->alias() );
873 DBG <<
"Service removes enabled repo " <<
oldRepo->alias() << endl;
876 DBG <<
"Service removes disabled repo " <<
oldRepo->alias() << endl;
885 for_(
it, collector.repos.begin(), collector.repos.end() )
892 DBG <<
"Service request to " << (
it->enabled()?
"enable":
"disable") <<
" service repo " <<
it->alias() << endl;
894 if (
options_r.testFlag( RefreshService_restoreStatus ) )
896 DBG <<
"Opt RefreshService_restoreStatus " <<
it->alias() << endl;
901 service.delRepoToEnable(
it->alias() );
906 if ( service.repoToEnableFind(
it->alias() ) )
908 DBG <<
"User request to enable service repo " <<
it->alias() << endl;
913 service.delRepoToEnable(
it->alias() );
916 else if ( service.repoToDisableFind(
it->alias() ) )
918 DBG <<
"User request to disable service repo " <<
it->alias() << endl;
932 DBG <<
"Service adds repo " <<
it->alias() <<
" " << (
it->enabled()?
"enabled":
"disabled") << endl;
933 addRepository( *
it );
944 if (
oldRepo->enabled() ==
it->enabled() )
946 else if (
options_r.testFlag( RefreshService_restoreStatus ) )
949 DBG <<
"Opt RefreshService_restoreStatus " <<
it->alias() <<
" forces " << (
toBeEnabled?
"enabled":
"disabled") << endl;
953 const auto & last = service.repoStates().find(
oldRepo->alias() );
954 if ( last == service.repoStates().end() || last->second.enabled !=
it->enabled() )
959 DBG <<
"User modified service repo " <<
it->alias() <<
" may stay " << (
toBeEnabled?
"enabled":
"disabled") << endl;
967 DBG <<
"Service repo " <<
it->alias() <<
" stays " << (
oldRepo->enabled()?
"enabled":
"disabled") << endl;
971 DBG <<
"Service repo " <<
it->alias() <<
" gets enabled" << endl;
977 DBG <<
"Service repo " <<
it->alias() <<
" gets disabled" << endl;
985 if (
oldRepo->rawName() !=
it->rawName() )
987 DBG <<
"Service repo " <<
it->alias() <<
" gets new NAME " <<
it->rawName() << endl;
993 if (
oldRepo->autorefresh() !=
it->autorefresh() )
995 DBG <<
"Service repo " <<
it->alias() <<
" gets new AUTOREFRESH " <<
it->autorefresh() << endl;
996 oldRepo->setAutorefresh(
it->autorefresh() );
1001 if (
oldRepo->priority() !=
it->priority() )
1003 DBG <<
"Service repo " <<
it->alias() <<
" gets new PRIORITY " <<
it->priority() << endl;
1014 DBG <<
"Service repo " <<
it->alias() <<
" gets new URLs " <<
newUrls << endl;
1028#define Z_CHKGPG(I,N) \
1029 if ( ! sameTriboolState( ogpg[I], ngpg[I] ) ) \
1031 DBG << "Service repo " << it->alias() << " gets new "#N"Check " << ngpg[I] << endl; \
1032 oldRepo->set##N##Check( ngpg[I] ); \
1033 oldRepoModified = true; \
1050 if ( ! service.reposToDisableEmpty() )
1052 service.clearReposToDisable();
1067 if ( service.ttl() )
1076 modifyService( service.alias(), service );
1093 if (
access.doesFileExist(
"/repo/repoindex.xml") )
1121 MIL <<
"GeoIp disabled via ZConfig, not refreshing the GeoIP information." << std::endl;
1125 std::vector<std::string>
hosts;
1126 for (
const auto &baseUrl : urls ) {
1127 const auto &host = baseUrl.getHost();
1129 hosts.push_back( host );
1134 if (
hosts.empty() ) {
1135 MIL <<
"No configured geoip URL found, not updating geoip data" << std::endl;
1142 MIL <<
"Unable to create cache directory for GeoIP." << std::endl;
1147 MIL <<
"No access rights for the GeoIP cache directory." << std::endl;
1157 auto age = std::chrono::system_clock::now() - std::chrono::system_clock::from_time_t(
pi.mtime() );
1158 if (
age < std::chrono::hours(24) )
1161 MIL <<
"Removing GeoIP file for " <<
entry.name <<
" since it's older than 24hrs." << std::endl;
1167 std::for_each(
hosts.begin(),
hosts.end(), [ & ](
const std::string &hostname ) {
1170 if ( zypp::PathInfo( geoIPCache / hostname ).isExist() ) {
1171 MIL <<
"Skipping GeoIP request for " << hostname <<
" since a valid cache entry exists." << std::endl;
1175 MIL <<
"Query GeoIP for " << hostname << std::endl;
1186 MIL <<
"Ignoring invalid GeoIP hostname: " << hostname << std::endl;
1198 MIL <<
"Failed to query GeoIP from hostname: " << hostname << std::endl;
1201 if ( !file->
empty() ) {
1205 out.open(
fName.asString(), std::ios_base::trunc );
1206 if ( out.is_open() ) {
1207 out << host << std::endl;
1209 MIL <<
"Failed to create/open GeoIP cache file " <<
fName << std::endl;
1216 if (
reader.seekToNode( 1,
"host" ) ) {
1217 const auto &
str =
reader.nodeText().asString();
1225 MIL <<
"Storing geoIP redirection: " << hostname <<
" -> " <<
str << std::endl;
1230 MIL <<
"No host entry or empty file returned for GeoIP, remembering for 24hrs" << std::endl;
1234 MIL <<
"Empty or invalid GeoIP file, not requesting again for 24hrs" << std::endl;
1243 MIL <<
"Failed to query GeoIP data." << std::endl;
1261 {
return _pimpl->repoEmpty(); }
1264 {
return _pimpl->repoSize(); }
1267 {
return _pimpl->repoBegin(); }
1270 {
return _pimpl->repoEnd(); }
1273 {
return _pimpl->getRepo( alias ); }
1276 {
return _pimpl->hasRepo( alias ); }
1280 std::string
ret(
url_r.getScheme() );
1286 std::string host(
url_r.getHost() );
1287 if ( ! host.empty() )
1299 {
return _pimpl->metadataStatus( info ); }
1302 {
return _pimpl->checkIfToRefreshMetadata( info, url, policy ); }
1305 {
return _pimpl->metadataPath( info ); }
1308 {
return _pimpl->packagesPath( info ); }
1320 {
return _pimpl->cacheStatus( info ); }
1329 {
return _pimpl->isCached( info ); }
1338 {
return _pimpl->probe( url, path ); }
1341 {
return _pimpl->probe( url ); }
1356 {
return _pimpl->getRepositoryInfo( alias ); }
1362 {
return _pimpl->serviceEmpty(); }
1365 {
return _pimpl->serviceSize(); }
1368 {
return _pimpl->serviceBegin(); }
1371 {
return _pimpl->serviceEnd(); }
1374 {
return _pimpl->getService( alias ); }
1377 {
return _pimpl->hasService( alias ); }
1380 {
return _pimpl->probeService( url ); }
1383 {
return _pimpl->addService( alias, url ); }
1386 {
return _pimpl->addService( service ); }
1389 {
return _pimpl->removeService( alias ); }
1392 {
return _pimpl->removeService( service ); }
1404 {
return _pimpl->modifyService( oldAlias, service ); }
1407 {
return _pimpl->refreshGeoIPData( urls ); }
media::MediaAccessId _mid
RepoManager implementation.
std::ostream & operator<<(std::ostream &str, const RepoManager::Impl &obj)
Stream output.
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
void resetDispose()
Set no dispose function.
void reset()
Reset to default Ctor values.
shared_ptr< Impl > _pimpl
static Date now()
Return the current time.
std::string digest()
get hex string representation of the digest
static const std::string & sha1()
sha1
Base class for Exception.
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
std::vector< std::string > Arguments
Writing the zypp history file.
void addRepository(const RepoInfo &repo)
Log a newly added repository.
Maintain [min,max] and counter (value) for progress counting.
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
What is known about a repository.
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
repo::RepoType type() const
Type of repository,.
urls_size_type baseUrlsSize() const
number of repository urls
Url url() const
Pars pro toto: The first repository url.
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Pathname path() const
Repository path.
url_set baseUrls() const
The complete set of repository urls.
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Track changing files or directories.
std::map< std::string, RepoState > RepoStates
std::string targetDistribution() const
This is register.target attribute of the installed base product.
std::string asString() const
Returns a default string representation of the Url object.
std::string getPathName(EEncoding eflag=zypp::url::E_DECODED) const
Returns the path name from the URL.
void setPathName(const std::string &path, EEncoding eflag=zypp::url::E_DECODED)
Set the path name.
void setHost(const std::string &host)
Set the hostname or IP in the URL authority.
void setScheme(const std::string &scheme)
Set the scheme name in the URL.
static bool schemeIsVolatile(const std::string &scheme_r)
cd dvd
static ZConfig & instance()
Singleton ctor.
Wrapper class for stat/lstat.
bool empty() const
Test for an empty path.
Repository already exists and some unique attribute can't be duplicated.
Exception for repository handling.
std::string label() const
Label for use in messages for the user interface.
std::string alias() const
unique identifier for this source.
thrown when it was impossible to determine this repo type.
Retrieval of repository list for a service.
static Pool instance()
Singleton ctor.
xmlTextReader based interface to iterate xml streams.
Repository metadata verification beyond GPG.
String related utilities and Regular expression matching.
Namespace intended to collect all environment variables we use.
bool ZYPP_PLUGIN_APPDATA_FORCE_COLLECT()
To trigger appdata refresh unconditionally.
int unlink(const Pathname &path)
Like 'unlink'.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
int dirForEachExt(const Pathname &dir_r, const function< bool(const Pathname &, const DirEntry &)> &fnc_r)
Simiar to.
void updateSolvFileIndex(const Pathname &solvfile_r)
Create solv file content digest for zypper bash completion.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
bool strToBool(const C_Str &str, bool default_r)
Parse str into a bool depending on the default value.
std::string hexstring(char n, int w=4)
int compareCI(const C_Str &lhs, const C_Str &rhs)
Easy-to use interface to the ZYPP dependency resolver.
Pathname rawcache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the raw cache path for a repository, this is usually /var/cache/zypp/alias.
bool isTmpRepo(const RepoInfo &info_r)
Whether repo is not under RM control and provides its own methadata paths.
std::list< RepoInfo > readRepoFile(const Url &repo_file)
Parses repo_file and returns a list of RepoInfo objects corresponding to repositories found within th...
void assert_alias(const RepoInfo &info)
Pathname solv_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the solv cache path for a repository.
std::list< RepoInfo > repositories_in_file(const Pathname &file)
Reads RepoInfo's from a repo file.
Pathname packagescache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the packages cache path for a repository.
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
Pathname rawproductdata_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the raw product metadata path for a repository, this is inside the raw cache dir,...
bool any_of(const Container &c, Fnc &&cb)
void assert_url(const ServiceInfo &info)
void assert_urls(const RepoInfo &info)
bool foundAliasIn(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Check if alias_r is present in repo/service container.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Iterator findAlias(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Find alias_r in repo/service container.
AsyncOpRef< expected< zypp::repo::RepoType > > probeRepoType(ContextRef ctx, ProvideMediaHandle medium, zypp::Pathname path, std::optional< zypp::Pathname > targetPath={})
AsyncOpRef< expected< repo::AsyncRefreshContextRef > > buildCache(repo::AsyncRefreshContextRef refCtx, ProgressObserverRef progressObserver=nullptr)
AsyncOpRef< expected< repo::AsyncRefreshContextRef > > refreshMetadata(repo::AsyncRefreshContextRef refCtx, ProvideMediaHandle medium, ProgressObserverRef progressObserver)
AsyncOpRef< expected< repo::RefreshCheckStatus > > checkIfToRefreshMetadata(repo::AsyncRefreshContextRef refCtx, ProvideMediaHandle medium, ProgressObserverRef progressObserver=nullptr)
ResultType and_then(const expected< T, E > &exp, Function &&f)
Simple callback to collect the results.
bool collect(const RepoInfo &repo)
void loadFromCache(const RepoInfo &info, OPT_PROGRESS)
void addProbedRepository(const RepoInfo &info, repo::RepoType probedType)
creates and provides information about known sources.
bool hasRepo(const std::string &alias) const
Return whether there is a known repository for alias.
void cleanCacheDirGarbage(const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Remove any subdirectories of cache directories which no longer belong to any of known repositories.
void cleanMetadata(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Clean local metadata.
bool serviceEmpty() const
Gets true if no service is in RepoManager (so no one in specified location)
bool hasService(const std::string &alias) const
Return whether there is a known service for alias.
RefreshCheckStatus
Possibly return state of checkIfRefreshMEtadata function.
RefreshCheckStatus checkIfToRefreshMetadata(const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy)
Impl * clone() const
clone for RWCOW_pointer
ServiceSet::const_iterator ServiceConstIterator
void refreshService(const ServiceInfo &service, const RefreshServiceOptions &options_r)
void addRepository(const RepoInfo &info, OPT_PROGRESS)
void addService(const std::string &alias, const Url &url)
Adds a new service by its alias and URL.
Impl & operator=(Impl &&)=delete
bool isCached(const RepoInfo &info) const
Whether a repository exists in cache.
void loadFromCache(const RepoInfo &info, OPT_PROGRESS)
void refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy, OPT_PROGRESS)
void removeService(const std::string &alias)
Removes service specified by its name.
void refreshService(const std::string &alias, const RefreshServiceOptions &options_r)
void buildCache(const RepoInfo &info, CacheBuildPolicy policy, OPT_PROGRESS)
RepoInfo getRepo(const std::string &alias) const
Find RepoInfo by alias or return RepoInfo::noRepo.
repo::ServiceType probeService(const Url &url) const
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Impl & operator=(const Impl &)=delete
void cleanCache(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
clean local cache
RefreshServiceFlags RefreshServiceOptions
Options tuning RefreshService.
Pathname metadataPath(const RepoInfo &info) const
Path where the metadata is downloaded and kept.
zypp_private::repo::PluginRepoverification _pluginRepoverification
ServiceSet::size_type ServiceSizeType
Pathname packagesPath(const RepoInfo &info) const
Path where the rpm packages are downloaded and kept.
RepoStatus cacheStatus(const RepoInfo &info) const
Status of metadata cache.
void removeRepository(const RepoInfo &info, OPT_PROGRESS) override
void refreshGeoIp(const RepoInfo::url_set &urls)
ServiceConstIterator serviceEnd() const
Iterator to place behind last service in internal storage.
ServiceConstIterator serviceBegin() const
Iterator to first service in internal storage.
repo::RepoType probe(const Url &url, const Pathname &path=Pathname()) const
RepoSizeType repoSize() const
void modifyRepository(const std::string &alias, const RepoInfo &newinfo, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Modify repository attributes.
RepoInfo getRepositoryInfo(const std::string &alias, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Find a matching repository info.
ServiceSizeType serviceSize() const
Gets count of service in RepoManager (in specified location)
void addRepositories(const Url &url, OPT_PROGRESS)
ServiceInfo getService(const std::string &alias) const
Finds ServiceInfo by alias or return ServiceInfo::noService.
RepoSet::size_type RepoSizeType
void refreshServices(const RefreshServiceOptions &options_r)
Impl(const Impl &)=default
RepoConstIterator repoBegin() const
void cleanPackages(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Clean local package cache.
RepoConstIterator repoEnd() const
RepoStatus metadataStatus(const RepoInfo &info) const
Status of local metadata.
void modifyService(const std::string &oldAlias, const ServiceInfo &service)
Modifies service file (rewrites it with new values) and underlying repositories if needed.
RepoSet::const_iterator RepoConstIterator
static std::string makeStupidAlias(const Url &url_r=Url())
Some stupid string but suitable as alias for your url if nothing better is available.
Impl(RepoManagerOptions &&opt)
void refreshGeoIPData(const RepoInfo::url_set &urls)
Listentry returned by readdir.
Repository type enumeration.
static const RepoType NONE
static const RepoType RPMPLAINDIR
Functor replacing repository variables.
Service type enumeration.
static const ServiceType NONE
No service set.
static const ServiceType RIS
Repository Index Service (RIS) (formerly known as 'Novell Update' (NU) service)
static const ServiceType PLUGIN
Plugin services are scripts installed on your system that provide the package manager with repositori...
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Url::asString() view options.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
#define PL_(MSG1, MSG2, N)