12#ifndef ZYPP_ZYPP_DETAIL_REPOMANAGERIMPL_H
13#define ZYPP_ZYPP_DETAIL_REPOMANAGERIMPL_H
20#include <zypp-core/base/Gettext.h>
22#include <zypp-core/base/DefaultIntegral>
23#include <zypp-core/base/NonCopyable.h>
24#include <zypp-core/fs/PathInfo.h>
29 #define OPT_PROGRESS const ProgressData::ReceiverFnc & = ProgressData::ReceiverFnc()
33 {
return(
info_r.filepath().empty() &&
info_r.usesAutoMetadataPaths() ); }
39 if ( info.
alias().empty() )
43 if ( info.
alias()[0] ==
'.')
45 info,
_(
"Service alias cannot start with dot.")));
49 template <
class Iterator>
58 template <
class Container>
63 template <
class Iterator>
72 template <
class Container>
76 template <
class Container>
82 std::string
filenameFromAlias(
const std::string & alias_r,
const std::string & stem_r );
225 {
return info.
service() == alias; }
251 bool hasRepo(
const std::string & alias )
const
257 return it == repos().end() ? RepoInfo::noRepo : *
it;
284 {
return cacheStatus( info, _options ); }
297 RepoInfo getRepositoryInfo(
const std::string & alias );
312 return it == _services.end() ? ServiceInfo::noService : *
it;
320 void removeService(
const std::string & alias );
322 { removeService( service.
alias() ); }
343 filesystem::assert_dir(base);
347 void touchIndexFile(
const RepoInfo & info );
349 template<
typename OutputIterator>
353 std::copy( boost::make_filter_iterator( filter, repos().begin(), repos().end() ),
354 boost::make_filter_iterator( filter, repos().end(), repos().end() ),
359 void init_knownServices();
360 void init_knownRepositories();
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
What is known about a repository.
Pathname metadataPath() const
Path where this repo metadata was read from.
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.
void saveToCookieFile(const Pathname &path_r) const
Save the status information to a cookie file.
Functor collecting ServiceInfos into a ServiceSet.
std::set< ServiceInfo > ServiceSet
ServiceCollector(ServiceSet &services_r)
bool operator()(const ServiceInfo &service_r) const
Url url() const
The service url.
bool isValid() const
Verifies the Url.
Wrapper class for stat/lstat.
bool isExist() const
Return whether valid stat info exists.
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.
Service without alias was used in an operation.
Service has no or invalid url defined.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
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.
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.
bool autoPruneInDir(const Pathname &path_r)
bsc#1204956: Tweak to prevent auto pruning package caches.
Pathname packagescache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the packages cache path for a repository.
std::list< RepoInfo > repositories_in_dir(const Pathname &dir)
List of RepoInfo's from a directory.
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,...
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::string filenameFromAlias(const std::string &alias_r, const std::string &stem_r)
Generate a related filename from a repo/service infos alias.
Iterator findAlias(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Find alias_r in repo/service container.
Simple callback to collect the results.
RepoCollector(std::string targetDistro_)
bool collect(const RepoInfo &repo)
Functor thats filter RepoInfo by service which it belongs to.
MatchServiceAlias(std::string alias_)
bool operator()(const RepoInfo &info) const
RepoSet::const_iterator RepoConstIterator
RepoInfo getRepo(const std::string &alias) const
ServiceConstIterator serviceEnd() const
static RepoStatus cacheStatus(const RepoInfo &info, const RepoManagerOptions &options)
RepoSet::size_type RepoSizeType
RepoConstIterator repoEnd() const
ServiceSet::const_iterator ServiceConstIterator
bool hasService(const std::string &alias) const
void removeService(const ServiceInfo &service)
ServiceSet::size_type ServiceSizeType
RepoStatus cacheStatus(const RepoInfo &info) const
virtual void removeRepository(const RepoInfo &info, OPT_PROGRESS)=0
bool hasRepo(const std::string &alias) const
std::set< RepoInfo > RepoSet
RepoInfo typedefs.
void getRepositoriesInService(const std::string &alias, OutputIterator out) const
std::set< ServiceInfo > ServiceSet
ServiceInfo typedefs.
Pathname packagesPath(const RepoInfo &info) const
void setCacheStatus(const RepoInfo &info, const RepoStatus &status)
RepoSizeType repoSize() const
RepoManagerOptions _options
ServiceInfo getService(const std::string &alias) const
DefaultIntegral< bool, false > _reposDirty
RepoConstIterator repoBegin() const
void addService(const std::string &alias, const Url &url)
bool isCached(const RepoInfo &info) const
ServiceSizeType serviceSize() const
bool serviceEmpty() const
const RepoSet & repos() const
std::string generateFilename(const ServiceInfo &info) const
std::string generateFilename(const RepoInfo &info) const
ServiceConstIterator serviceBegin() const
Pathname metadataPath(const RepoInfo &info) const
Pathname repoSolvCachePath
Pathname repoRawCachePath
Pathname repoPackagesCachePath
Repository type enumeration.
Url::asString() view options.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.