12#ifndef ZYPP_NG_REPOMANAGER_INCLUDED
13#define ZYPP_NG_REPOMANAGER_INCLUDED
26#include <zypp-core/base/DefaultIntegral>
30#include <zypp-core/zyppng/base/Base>
55 {
return(
info_r.filepath().empty() &&
info_r.usesAutoMetadataPaths() ); }
59 if ( info.
alias().empty() )
63 if ( info.
alias()[0] ==
'.')
65 info,
_(
"Repository alias cannot start with dot."))) );
71 if (info.
alias().empty())
75 if (info.
alias()[0] ==
'.')
77 info,
_(
"Service alias cannot start with dot."))));
83 template <
class Iterator>
92 template <
class Container>
97 template <
class Iterator>
106 template <
class Container>
110 template <
class Container>
116 std::string
filenameFromAlias(
const std::string & alias_r,
const std::string & stem_r );
245 template <
typename ZyppContextRefType>
269 template <
typename ...Args >
272 auto mgr = std::make_shared< RepoManager<ZyppContextRefType> >(
private_constr_t{}, std::forward<Args>(args)... );
319 bool hasRepo(
const std::string & alias )
const
399 std::vector<std::pair<RepoInfo, expected<void> > >
refreshMetadata(std::vector<RepoInfo>
infos, RawMetadataRefreshPolicy policy, ProgressObserverRef
myProgress =
nullptr );
470 template<
typename OutputIterator>
474 std::copy( boost::make_filter_iterator( filter,
repos().begin(),
repos().end() ),
475 boost::make_filter_iterator( filter,
repos().end(),
repos().end() ),
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Base class for Exception.
What is known about a repository.
Pathname metadataPath() const
Path where this repo metadata was read from.
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Pathname path() const
Repository path.
std::string service() const
Gets name of the service to which this repository belongs or empty string if it has been added manual...
Pathname packagesPath() const
Path where this repo packages are cached.
Track changing files or directories.
static RepoStatus fromCookieFile(const Pathname &path)
Reads the status from a cookie file.
void saveToCookieFile(const Pathname &path_r) const
Save the status information to a cookie file.
Url url() const
The service url.
bool isValid() const
Verifies the Url.
Wrapper class for stat/lstat.
Pathname dirname() const
Return all but the last component od this path.
std::string escaped_alias() const
Same as alias(), just escaped in a way to be a valid file name.
std::string alias() const
unique identifier for this source.
Thrown when the repo alias is found to be invalid.
thrown when it was impossible to determine an alias for this repo.
Thrown when the repo alias is found to be invalid.
Service without alias was used in an operation.
Service has no or invalid url defined.
Repository metadata verification beyond GPG.
The RepoManager class Provides knowledge and methods to maintain repo settings and metadata for a giv...
RepoSet::size_type RepoSizeType
ServiceInfo getService(const std::string &alias) const
expected< void > refreshServices(const RefreshServiceOptions &options_r)
static expected< std::shared_ptr< RepoManager< ZyppContextRefType > > > create(Args &&...args)
expected< RepoStatus > cacheStatus(const RepoInfo &info) const
std::set< ServiceInfo > ServiceSet
ServiceInfo typedefs.
RepoInfo getRepo(const std::string &alias) const
expected< void > refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress=nullptr)
Refresh local raw cache.
expected< void > modifyService(const std::string &oldAlias, const ServiceInfo &newService)
static expected< RepoStatus > cacheStatus(const RepoInfo &info, const RepoManagerOptions &options)
expected< zypp::Pathname > packagesPath(const RepoInfo &info) const
ServiceConstIterator serviceBegin() const
expected< void > addService(const ServiceInfo &service)
expected< void > refreshGeoIp(const RepoInfo::url_set &urls)
expected< void > removeService(const std::string &alias)
ZYPP_ENABLE_MAYBE_ASYNC_MIXIN((std::is_same_v< ZyppContextRefType, ContextRef >))
expected< void > cleanPackages(const RepoInfo &info, ProgressObserverRef myProgress=nullptr, bool isAutoClean=false)
expected< void > removeService(const ServiceInfo &service)
bool serviceEmpty() const
static expected< void > touchIndexFile(const RepoInfo &info, const RepoManagerOptions &options)
expected< RepoInfo > getRepositoryInfo(const std::string &alias)
expected< void > refreshService(const ServiceInfo &service, const RefreshServiceOptions &options_r)
expected< RepoInfo > modifyRepository(const std::string &alias, const RepoInfo &newinfo_r, ProgressObserverRef myProgress=nullptr)
void getRepositoriesInService(const std::string &alias, OutputIterator out) const
ServiceConstIterator serviceEnd() const
static zypp::repo::RepoType probeCache(const zypp::Pathname &path_r)
Probe Metadata in a local cache directory.
expected< void > addService(const std::string &alias, const zypp::Url &url)
expected< void > init_knownServices()
ZyppContextRefType ContextRefType
expected< RepoInfo > addProbedRepository(RepoInfo info, zypp::repo::RepoType probedType)
expected< void > setCacheStatus(const RepoInfo &info, const RepoStatus &status)
expected< zypp::repo::RepoType > probe(const zypp::Url &url, const zypp::Pathname &path=zypp::Pathname()) const
Probe the metadata type of a repository located at url.
const RepoSet & repos() const
ServiceSet::size_type ServiceSizeType
expected< void > cleanCacheDirGarbage(ProgressObserverRef myProgress=nullptr)
expected< RefreshCheckStatus > checkIfToRefreshMetadata(const RepoInfo &info, const zypp::Url &url, RawMetadataRefreshPolicy policy)
expected< bool > isCached(const RepoInfo &info) const
expected< RepoInfo > addRepository(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
expected< zypp::repo::ServiceType > probeService(const zypp::Url &url) const
ServiceSizeType serviceSize() const
std::string generateFilename(const ServiceInfo &info) const
expected< void > initialize()
zypp::Pathname generateNonExistingName(const zypp::Pathname &dir, const std::string &basefilename) const
Generate a non existing filename in a directory, using a base name.
zypp_private::repo::PluginRepoverification _pluginRepoverification
expected< void > buildCache(const RepoInfo &info, CacheBuildPolicy policy, ProgressObserverRef myProgress=nullptr)
RepoSet::const_iterator RepoConstIterator
expected< zypp::Pathname > metadataPath(const RepoInfo &info) const
RepoSizeType repoSize() const
expected< void > addRepositories(const zypp::Url &url, ProgressObserverRef myProgress=nullptr)
ZYPP_ADD_PRIVATE_CONSTR_HELPER()
ServiceSet::const_iterator ServiceConstIterator
ContextRefType zyppContext() const
RepoManagerOptions _options
expected< void > init_knownRepositories()
expected< void > cleanCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
zypp::DefaultIntegral< bool, false > _reposDirty
expected< void > loadFromCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
std::set< RepoInfo > RepoSet
RepoInfo typedefs.
expected< void > cleanMetadata(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
static expected< RepoStatus > metadataStatus(const RepoInfo &info, const RepoManagerOptions &options)
expected< void > removeRepository(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
bool hasService(const std::string &alias) const
RepoConstIterator repoBegin() const
expected< void > saveService(ServiceInfo &service) const
bool hasRepo(const std::string &alias) const
std::string generateFilename(const RepoInfo &info) const
ZYPP_DECL_PRIVATE_CONSTR_ARGS(RepoManager, ZyppContextRefType zyppCtx, RepoManagerOptions opt)
typename ZyppContextRefType::element_type ContextType
RepoConstIterator repoEnd() const
zypp::RepoManagerFlags::RefreshServiceOptions RefreshServiceOptions
expected< void > refreshService(const std::string &alias, const RefreshServiceOptions &options_r)
const RepoManagerOptions & options() const
zypp::RepoManagerFlags::CacheBuildPolicy CacheBuildPolicy
ContextRefType _zyppContext
Functor collecting ServiceInfos into a ServiceSet.
ServiceCollector(ServiceSet &services_r)
bool operator()(const ServiceInfo &service_r) const
std::set< ServiceInfo > ServiceSet
static expected success(ConsParams &&...params)
RefreshCheckStatus
Possibly return state of RepoManager::checkIfToRefreshMetadata function.
RefreshServiceFlags RefreshServiceOptions
Options tuning RefreshService.
RefreshServiceBit
Flags for tuning RefreshService.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
detail::collect_helper collect()
bool isTmpRepo(const RepoInfo &info_r)
Whether repo is not under RM control and provides its own methadata paths.
expected< void > assert_url(const ServiceInfo &info)
expected< void > assert_urls(const RepoInfo &info)
std::string filenameFromAlias(const std::string &alias_r, const std::string &stem_r)
Generate a related filename from a repo/service infos alias.
static expected< std::decay_t< Type >, Err > make_expected_success(Type &&t)
expected< zypp::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.
expected< void > assert_alias(const RepoInfo &info)
ResultType and_then(const expected< T, E > &exp, Function &&f)
zypp::ServiceInfo ServiceInfo
RepoManagerRef< SyncContextRef > SyncRepoManagerRef
expected< zypp::Pathname > solv_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the solv cache path for a repository.
expected< std::list< RepoInfo > > repositories_in_file(const zypp::Pathname &file)
Reads RepoInfo's from a repo file.
Iterator findAlias(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Find alias_r in repo/service container.
bool foundAliasIn(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Check if alias_r is present in repo/service container.
expected< zypp::Pathname > packagescache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the packages cache path for a repository.
expected< zypp::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,...
zypp::RepoInfoList RepoInfoList
bool autoPruneInDir(const zypp::Pathname &path_r)
bsc#1204956: Tweak to prevent auto pruning package caches.
Pathname repoSolvCachePath
Pathname repoRawCachePath
Pathname repoPackagesCachePath
Repository type enumeration.
Url::asString() view options.
Simple callback to collect the results.
RepoCollector(std::string targetDistro_)
Functor thats filter RepoInfo by service which it belongs to.
MatchServiceAlias(std::string alias_)
bool operator()(const RepoInfo &info) const
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
#define ZYPP_EXCPT_PTR(EXCPT)
Drops a logline and returns Exception as a std::exception_ptr.
#define ZYPP_FWD_DECL_TEMPL_TYPE_WITH_REFS_ARG1(T, TArg1)
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)