12 #ifndef ZYPP_ZYPP_DETAIL_REPOMANAGERIMPL_H 13 #define ZYPP_ZYPP_DETAIL_REPOMANAGERIMPL_H 22 #include <zypp-core/base/DefaultIntegral> 29 #define OPT_PROGRESS const ProgressData::ReceiverFnc & = ProgressData::ReceiverFnc() 39 if ( info.
alias().empty() )
43 if ( info.
alias()[0] ==
'.')
45 info,
_(
"Service alias cannot start with dot.")));
49 template <
class Iterator>
50 inline bool foundAliasIn(
const std::string & alias_r, Iterator begin_r, Iterator end_r )
52 for_( it, begin_r, end_r )
53 if ( it->alias() == alias_r )
58 template <
class Container>
59 inline bool foundAliasIn(
const std::string & alias_r,
const Container & cont_r )
60 {
return foundAliasIn( alias_r, cont_r.begin(), cont_r.end() ); }
63 template <
class Iterator>
64 inline Iterator
findAlias(
const std::string & alias_r, Iterator begin_r, Iterator end_r )
66 for_( it, begin_r, end_r )
67 if ( it->alias() == alias_r )
72 template <
class Container>
73 inline typename Container::iterator
findAlias(
const std::string & alias_r, Container & cont_r )
74 {
return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
76 template <
class Container>
77 inline typename Container::const_iterator
findAlias(
const std::string & alias_r,
const Container & cont_r )
78 {
return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
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 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() ); }
324 void modifyService(
const std::string & oldAlias,
const ServiceInfo & newService );
332 Pathname generateNonExistingName(
const Pathname & dir,
const std::string & basefilename )
const;
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();
Pathname filepath() const
File where this repo was read from.
ServiceSet::size_type ServiceSizeType
Pathname path() const
Repository path.
Thrown when the repo alias is found to be invalid.
Pathname solv_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the solv cache path for a repository.
RepoStatus cacheStatus(const RepoInfo &info) const
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
Pathname repoRawCachePath
ServiceSet::const_iterator ServiceConstIterator
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
std::string generateFilename(const RepoInfo &info) const
std::list< RepoInfo > repositories_in_file(const Pathname &file)
Reads RepoInfo's from a repo file.
std::string service() const
Gets name of the service to which this repository belongs or empty string if it has been added manual...
bool collect(const RepoInfo &repo)
ServiceConstIterator serviceEnd() const
bool hasRepo(const std::string &alias) const
RepoCollector(std::string targetDistro_)
ServiceConstIterator serviceBegin() const
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
static RepoStatus cacheStatus(const RepoInfo &info, const RepoManagerOptions &options)
What is known about a repository.
Pathname packagescache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the packages cache path for a repository.
std::string escaped_alias() const
Same as alias(), just escaped in a way to be a valid file name.
RepoInfo getRepo(const std::string &alias) const
std::string generateFilename(const ServiceInfo &info) const
static RepoStatus fromCookieFile(const Pathname &path)
Reads the status from a cookie file.
Service without alias was used in an operation.
Url::asString() view options.
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.
Pathname repoSolvCachePath
const RepoSet & repos() const
bool hasService(const std::string &alias) const
void saveToCookieFile(const Pathname &path_r) const
Save the status information to a cookie file.
bool empty() const
Test for an empty path.
bool serviceEmpty() const
void assert_alias(const RepoInfo &info)
Iterator findAlias(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Find alias_r in repo/service container.
std::string alias() const
unique identifier for this source.
bool isExist() const
Return whether valid stat info exists.
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...
Pathname dirname() const
Return all but the last component od this path.
RepoManagerOptions _options
ServiceInfo getService(const std::string &alias) const
bool isValid() const
Verifies the Url.
Pathname packagesPath(const RepoInfo &info) const
Functor thats filter RepoInfo by service which it belongs to.
Pathname metadataPath() const
Path where this repo metadata was read from.
bool isTmpRepo(const RepoInfo &info_r)
Whether repo is not under RM control and provides its own methadata paths.
Url url() const
The service url.
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
std::ostream & copy(std::istream &from_r, std::ostream &to_r)
Copy istream to ostream.
Simple callback to collect the results.
void addService(const std::string &alias, const Url &url)
std::set< ServiceInfo > ServiceSet
std::string filenameFromAlias(const std::string &alias_r, const std::string &stem_r)
Generate a related filename from a repo/service infos alias.
void assert_urls(const RepoInfo &info)
void removeService(const ServiceInfo &service)
MatchServiceAlias(std::string alias_)
RepoSizeType repoSize() const
RepoConstIterator repoBegin() const
void assert_url(const ServiceInfo &info)
RepoSet::size_type RepoSizeType
DefaultIntegral< bool, false > _reposDirty
Pathname repoPackagesCachePath
Functor collecting ServiceInfos into a ServiceSet.
std::set< RepoInfo > RepoSet
RepoInfo typedefs.
std::set< ServiceInfo > ServiceSet
ServiceInfo typedefs.
Pathname packagesPath() const
Path where this repo packages are cached.
ServiceSizeType serviceSize() const
RepoSet::const_iterator RepoConstIterator
Wrapper class for ::stat/::lstat.
void getRepositoriesInService(const std::string &alias, OutputIterator out) const
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Track changing files or directories.
bool foundAliasIn(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Check if alias_r is present in repo/service container.
std::list< RepoInfo > repositories_in_dir(const Pathname &dir)
List of RepoInfo's from a directory.
Pathname metadataPath(const RepoInfo &info) const
Easy-to use interface to the ZYPP dependency resolver.
ServiceCollector(ServiceSet &services_r)
RepoConstIterator repoEnd() const
Service has no or invalid url defined.
bool isCached(const RepoInfo &info) const
void setCacheStatus(const RepoInfo &info, const RepoStatus &status)
bool autoPruneInDir(const Pathname &path_r)
bsc#1204956: Tweak to prevent auto pruning package caches.
bool operator()(const ServiceInfo &service_r) const
Repository type enumeration.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
bool operator()(const RepoInfo &info) const