libzypp 17.31.0
zypp::RepoManager Class Reference

creates and provides information about known sources. More...

#include <RepoManager.h>

Inheritance diagram for zypp::RepoManager:

Classes

struct  MatchServiceAlias
 Functor thats filter RepoInfo by service which it belongs to. More...
 

Public Types

enum  RawMetadataRefreshPolicy { RefreshIfNeeded , RefreshForced , RefreshIfNeededIgnoreDelay }
 
enum  CacheBuildPolicy { BuildIfNeeded , BuildForced }
 
enum  RefreshServiceBit { RefreshService_restoreStatus = (1<<0) , RefreshService_forceRefresh = (1<<1) }
 Flags for tuning RefreshService. More...
 
typedef std::set< ServiceInfoServiceSet
 ServiceInfo typedefs. More...
 
typedef ServiceSet::const_iterator ServiceConstIterator
 
typedef ServiceSet::size_type ServiceSizeType
 
typedef std::set< RepoInfoRepoSet
 RepoInfo typedefs. More...
 
typedef RepoSet::const_iterator RepoConstIterator
 
typedef RepoSet::size_type RepoSizeType
 
typedef RefreshServiceFlags RefreshServiceOptions
 Options tuning RefreshService. More...
 

Public Member Functions

 Impl (const RepoManagerOptions &opt)
 
 ~Impl ()
 
bool repoEmpty () const
 
RepoSizeType repoSize () const
 
RepoConstIterator repoBegin () const
 
RepoConstIterator repoEnd () const
 
bool hasRepo (const std::string &alias) const
 
RepoInfo getRepo (const std::string &alias) const
 
Pathname metadataPath (const RepoInfo &info) const
 
Pathname packagesPath (const RepoInfo &info) const
 
RepoStatus metadataStatus (const RepoInfo &info) const
 
RefreshCheckStatus checkIfToRefreshMetadata (const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy)
 
void refreshMetadata (const RepoInfo &info, RawMetadataRefreshPolicy policy, OPT_PROGRESS)
 
void cleanMetadata (const RepoInfo &info, OPT_PROGRESS)
 
void cleanPackages (const RepoInfo &info, OPT_PROGRESS)
 
void buildCache (const RepoInfo &info, CacheBuildPolicy policy, OPT_PROGRESS)
 
repo::RepoType probe (const Url &url, const Pathname &path=Pathname()) const
 
repo::RepoType probeCache (const Pathname &path_r) const
 
void cleanCacheDirGarbage (OPT_PROGRESS)
 
void cleanCache (const RepoInfo &info, OPT_PROGRESS)
 
bool isCached (const RepoInfo &info) const
 
RepoStatus cacheStatus (const RepoInfo &info) const
 
void loadFromCache (const RepoInfo &info, OPT_PROGRESS)
 
void addRepository (const RepoInfo &info, OPT_PROGRESS)
 
void addRepositories (const Url &url, OPT_PROGRESS)
 
void removeRepository (const RepoInfo &info, OPT_PROGRESS)
 
void modifyRepository (const std::string &alias, const RepoInfo &newinfo_r, OPT_PROGRESS)
 
RepoInfo getRepositoryInfo (const std::string &alias, OPT_PROGRESS)
 
RepoInfo getRepositoryInfo (const Url &url, const url::ViewOption &urlview, OPT_PROGRESS)
 
bool serviceEmpty () const
 
ServiceSizeType serviceSize () const
 
ServiceConstIterator serviceBegin () const
 
ServiceConstIterator serviceEnd () const
 
bool hasService (const std::string &alias) const
 
ServiceInfo getService (const std::string &alias) const
 
void addService (const ServiceInfo &service)
 
void addService (const std::string &alias, const Url &url)
 
void removeService (const std::string &alias)
 
void removeService (const ServiceInfo &service)
 
void refreshServices (const RefreshServiceOptions &options_r)
 
void refreshService (const std::string &alias, const RefreshServiceOptions &options_r)
 
void refreshService (const ServiceInfo &service, const RefreshServiceOptions &options_r)
 
void modifyService (const std::string &oldAlias, const ServiceInfo &newService)
 
repo::ServiceType probeService (const Url &url) const
 
 RepoManager (const RepoManagerOptions &options=RepoManagerOptions())
 
 ~RepoManager ()
 Dtor. More...
 
 ZYPP_DECLARE_FLAGS (RefreshServiceFlags, RefreshServiceBit)
 

Private Member Functions

void saveService (ServiceInfo &service) const
 
Pathname generateNonExistingName (const Pathname &dir, const std::string &basefilename) const
 
std::string generateFilename (const RepoInfo &info) const
 
std::string generateFilename (const ServiceInfo &info) const
 
void setCacheStatus (const RepoInfo &info, const RepoStatus &status)
 
void touchIndexFile (const RepoInfo &info)
 
template<typename OutputIterator >
void getRepositoriesInService (const std::string &alias, OutputIterator out) const
 
void init_knownServices ()
 
void init_knownRepositories ()
 
const RepoSetrepos () const
 Iterate the known repositories. More...
 
RepoSetreposManip ()
 
Implclone () const
 clone for RWCOW_pointer More...
 

Private Attributes

RepoManagerOptions _options
 
RepoSet _reposX
 
ServiceSet _services
 
DefaultIntegral< bool, false > _reposDirty
 
PluginRepoverification _pluginRepoverification
 

Friends

ImplrwcowClone (const Impl *rhs)
 
std::ostream & operator<< (std::ostream &str, const RepoManager &obj)
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const RepoManager &obj)
 Stream output. More...
 

Known repositories.

The known repositories are read from RepoManagerOptions::knownReposPath passed on the Ctor.

Which defaults to ZYpp global settings.

enum  RefreshCheckStatus { REFRESH_NEEDED , REPO_UP_TO_DATE , REPO_CHECK_DELAYED }
 Possibly return state of checkIfRefreshMEtadata function. More...
 
bool repoEmpty () const
 
RepoSizeType repoSize () const
 
RepoConstIterator repoBegin () const
 
RepoConstIterator repoEnd () const
 
Iterable< RepoConstIteratorrepos () const
 
std::list< RepoInfoknownRepositories () const
 List of known repositories. More...
 
RepoInfo getRepo (const std::string &alias) const
 Find RepoInfo by alias or return RepoInfo::noRepo. More...
 
RepoInfo getRepo (const RepoInfo &info_r) const
 
bool hasRepo (const std::string &alias) const
 Return whether there is a known repository for alias. More...
 
bool hasRepo (const RepoInfo &info_r) const
 
RepoStatus metadataStatus (const RepoInfo &info) const
 Status of local metadata. More...
 
RefreshCheckStatus checkIfToRefreshMetadata (const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy=RefreshIfNeeded)
 Checks whether to refresh metadata for specified repository and url. More...
 
Pathname metadataPath (const RepoInfo &info) const
 Path where the metadata is downloaded and kept. More...
 
Pathname packagesPath (const RepoInfo &info) const
 Path where the rpm packages are downloaded and kept. More...
 
void refreshMetadata (const RepoInfo &info, RawMetadataRefreshPolicy policy=RefreshIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Refresh local raw cache. More...
 
void cleanMetadata (const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Clean local metadata. More...
 
void cleanPackages (const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Clean local package cache. More...
 
RepoStatus cacheStatus (const RepoInfo &info) const
 Status of metadata cache. More...
 
void buildCache (const RepoInfo &info, CacheBuildPolicy policy=BuildIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Refresh local cache. More...
 
void cleanCache (const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 clean local cache More...
 
bool isCached (const RepoInfo &info) const
 Whether a repository exists in cache. More...
 
void loadFromCache (const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Load resolvables into the pool. More...
 
void cleanCacheDirGarbage (const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Remove any subdirectories of cache directories which no longer belong to any of known repositories. More...
 
repo::RepoType probe (const Url &url, const Pathname &path) const
 Probe repo metadata type. More...
 
repo::RepoType probe (const Url &url) const
 
void addRepository (const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Adds a repository to the list of known repositories. More...
 
void addRepositories (const Url &url, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Adds repositores from a repo file to the list of known repositories. More...
 
void removeRepository (const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Remove the best matching repository from known repos list. More...
 
void modifyRepository (const std::string &alias, const RepoInfo &newinfo, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Modify repository attributes. More...
 
void modifyRepository (const RepoInfo &newinfo, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 
RepoInfo getRepositoryInfo (const std::string &alias, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Find a matching repository info. More...
 
RepoInfo getRepositoryInfo (const Url &url, const url::ViewOption &urlview=url::ViewOption::DEFAULTS, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Find repository info by URL. More...
 
static std::string makeStupidAlias (const Url &url_r=Url())
 Some stupid string but suitable as alias for your url if nothing better is available. More...
 

Known services.

The known services are read from RepoManagerOptions::knownServicesPath passed on the Ctor.

Which defaults to ZYpp global settings.

RWCOW_pointer< Impl_pimpl
 Pointer to implementation. More...
 
bool serviceEmpty () const
 Gets true if no service is in RepoManager (so no one in specified location) More...
 
ServiceSizeType serviceSize () const
 Gets count of service in RepoManager (in specified location) More...
 
ServiceConstIterator serviceBegin () const
 Iterator to first service in internal storage. More...
 
ServiceConstIterator serviceEnd () const
 Iterator to place behind last service in internal storage. More...
 
Iterable< ServiceConstIteratorservices () const
 Iterate the known services. More...
 
std::list< ServiceInfoknownServices () const
 List of known services. More...
 
ServiceInfo getService (const std::string &alias) const
 Finds ServiceInfo by alias or return ServiceInfo::noService. More...
 
bool hasService (const std::string &alias) const
 Return whether there is a known service for alias. More...
 
repo::ServiceType probeService (const Url &url) const
 Probe the type or the service. More...
 
void addService (const std::string &alias, const Url &url)
 Adds a new service by its alias and URL. More...
 
void addService (const ServiceInfo &service)
 Adds new service. More...
 
void removeService (const std::string &alias)
 Removes service specified by its name. More...
 
void removeService (const ServiceInfo &service)
 
void refreshServices (const RefreshServiceOptions &options_r=RefreshServiceOptions())
 Refreshes all enabled services. More...
 
void refreshService (const std::string &alias, const RefreshServiceOptions &options_r=RefreshServiceOptions())
 Refresh specific service. More...
 
void refreshService (const ServiceInfo &service, const RefreshServiceOptions &options_r=RefreshServiceOptions())
 
void modifyService (const std::string &oldAlias, const ServiceInfo &service)
 Modifies service file (rewrites it with new values) and underlying repositories if needed. More...
 
void modifyService (const ServiceInfo &service)
 
template<typename OutputIterator >
void getRepositoriesInService (const std::string &alias, OutputIterator out) const
 fill to output iterator repositories in service name. More...
 

Detailed Description

creates and provides information about known sources.

Definition at line 522 of file RepoManager.cc.

Member Typedef Documentation

◆ ServiceSet

ServiceInfo typedefs.

Definition at line 114 of file RepoManager.h.

◆ ServiceConstIterator

typedef ServiceSet::const_iterator zypp::RepoManager::ServiceConstIterator

Definition at line 115 of file RepoManager.h.

◆ ServiceSizeType

typedef ServiceSet::size_type zypp::RepoManager::ServiceSizeType

Definition at line 116 of file RepoManager.h.

◆ RepoSet

RepoInfo typedefs.

Definition at line 119 of file RepoManager.h.

◆ RepoConstIterator

typedef RepoSet::const_iterator zypp::RepoManager::RepoConstIterator

Definition at line 120 of file RepoManager.h.

◆ RepoSizeType

typedef RepoSet::size_type zypp::RepoManager::RepoSizeType

Definition at line 121 of file RepoManager.h.

◆ RefreshServiceOptions

typedef RefreshServiceFlags zypp::RepoManager::RefreshServiceOptions

Options tuning RefreshService.

Definition at line 150 of file RepoManager.h.

Member Enumeration Documentation

◆ RawMetadataRefreshPolicy

Enumerator
RefreshIfNeeded 
RefreshForced 
RefreshIfNeededIgnoreDelay 

Definition at line 128 of file RepoManager.h.

◆ CacheBuildPolicy

Enumerator
BuildIfNeeded 
BuildForced 

Definition at line 135 of file RepoManager.h.

◆ RefreshServiceBit

Flags for tuning RefreshService.

Enumerator
RefreshService_restoreStatus 

Force restoring repo enabled/disabled status.

RefreshService_forceRefresh 

Force refresh even if TTL is not reached.

Definition at line 142 of file RepoManager.h.

◆ RefreshCheckStatus

Possibly return state of checkIfRefreshMEtadata function.

Enumerator
REFRESH_NEEDED 

refresh is needed

REPO_UP_TO_DATE 

repository not changed

REPO_CHECK_DELAYED 

refresh is delayed due to settings

Definition at line 196 of file RepoManager.h.

Constructor & Destructor Documentation

◆ ~Impl()

zypp::RepoManager::~Impl ( )
inline

Definition at line 533 of file RepoManager.cc.

◆ RepoManager()

zypp::RepoManager::RepoManager ( const RepoManagerOptions options = RepoManagerOptions())

Definition at line 2547 of file RepoManager.cc.

◆ ~RepoManager()

zypp::RepoManager::~RepoManager ( )

Dtor.

Definition at line 2551 of file RepoManager.cc.

Member Function Documentation

◆ Impl()

zypp::RepoManager::Impl ( const RepoManagerOptions opt)
inline

Definition at line 525 of file RepoManager.cc.

◆ repoEmpty() [1/2]

bool zypp::RepoManager::repoEmpty ( ) const
inline

Definition at line 578 of file RepoManager.cc.

◆ repoSize() [1/2]

RepoManager::RepoSizeType zypp::RepoManager::repoSize ( ) const
inline

Definition at line 579 of file RepoManager.cc.

◆ repoBegin() [1/2]

RepoManager::RepoConstIterator zypp::RepoManager::repoBegin ( ) const
inline

Definition at line 580 of file RepoManager.cc.

◆ repoEnd() [1/2]

RepoManager::RepoConstIterator zypp::RepoManager::repoEnd ( ) const
inline

Definition at line 581 of file RepoManager.cc.

◆ hasRepo() [1/3]

bool zypp::RepoManager::hasRepo ( const std::string &  alias) const
inline

Definition at line 583 of file RepoManager.cc.

◆ getRepo() [1/3]

RepoInfo zypp::RepoManager::getRepo ( const std::string &  alias) const
inline

Definition at line 586 of file RepoManager.cc.

◆ metadataPath() [1/2]

Pathname zypp::RepoManager::metadataPath ( const RepoInfo info) const
inline

Definition at line 593 of file RepoManager.cc.

◆ packagesPath() [1/2]

Pathname zypp::RepoManager::packagesPath ( const RepoInfo info) const
inline

Definition at line 596 of file RepoManager.cc.

◆ metadataStatus() [1/2]

RepoStatus zypp::RepoManager::metadataStatus ( const RepoInfo info) const

Definition at line 2592 of file RepoManager.cc.

◆ checkIfToRefreshMetadata() [1/2]

RepoManager::RefreshCheckStatus zypp::RepoManager::checkIfToRefreshMetadata ( const RepoInfo info,
const Url url,
RawMetadataRefreshPolicy  policy 
)

Definition at line 2595 of file RepoManager.cc.

◆ refreshMetadata() [1/2]

void zypp::RepoManager::refreshMetadata ( const RepoInfo info,
RawMetadataRefreshPolicy  policy,
OPT_PROGRESS   
)

◆ cleanMetadata() [1/2]

void zypp::RepoManager::cleanMetadata ( const RepoInfo info,
OPT_PROGRESS   
)

◆ cleanPackages() [1/2]

void zypp::RepoManager::cleanPackages ( const RepoInfo info,
OPT_PROGRESS   
)

◆ buildCache() [1/2]

void zypp::RepoManager::buildCache ( const RepoInfo info,
CacheBuildPolicy  policy,
OPT_PROGRESS   
)

◆ probe() [1/3]

repo::RepoType zypp::RepoManager::probe ( const Url url,
const Pathname path = Pathname() 
) const

Definition at line 2631 of file RepoManager.cc.

◆ probeCache()

repo::RepoType zypp::RepoManager::probeCache ( const Pathname path_r) const

◆ cleanCacheDirGarbage() [1/2]

void zypp::RepoManager::cleanCacheDirGarbage ( OPT_PROGRESS  )

◆ cleanCache() [1/2]

void zypp::RepoManager::cleanCache ( const RepoInfo info,
OPT_PROGRESS   
)

◆ isCached() [1/2]

bool zypp::RepoManager::isCached ( const RepoInfo info) const
inline

Definition at line 618 of file RepoManager.cc.

◆ cacheStatus() [1/2]

RepoStatus zypp::RepoManager::cacheStatus ( const RepoInfo info) const
inline

Definition at line 621 of file RepoManager.cc.

◆ loadFromCache() [1/2]

void zypp::RepoManager::loadFromCache ( const RepoInfo info,
OPT_PROGRESS   
)

◆ addRepository() [1/2]

void zypp::RepoManager::addRepository ( const RepoInfo info,
OPT_PROGRESS   
)

◆ addRepositories() [1/2]

void zypp::RepoManager::addRepositories ( const Url url,
OPT_PROGRESS   
)

◆ removeRepository() [1/2]

void zypp::RepoManager::removeRepository ( const RepoInfo info,
OPT_PROGRESS   
)

◆ modifyRepository() [1/3]

void zypp::RepoManager::modifyRepository ( const std::string &  alias,
const RepoInfo newinfo_r,
OPT_PROGRESS   
)

◆ getRepositoryInfo() [1/4]

RepoInfo zypp::RepoManager::getRepositoryInfo ( const std::string &  alias,
OPT_PROGRESS   
)

◆ getRepositoryInfo() [2/4]

RepoInfo zypp::RepoManager::getRepositoryInfo ( const Url url,
const url::ViewOption urlview,
OPT_PROGRESS   
)

◆ serviceEmpty() [1/2]

bool zypp::RepoManager::serviceEmpty ( ) const
inline

Definition at line 638 of file RepoManager.cc.

◆ serviceSize() [1/2]

RepoManager::ServiceSizeType zypp::RepoManager::serviceSize ( ) const
inline

Definition at line 639 of file RepoManager.cc.

◆ serviceBegin() [1/2]

RepoManager::ServiceConstIterator zypp::RepoManager::serviceBegin ( ) const
inline

Definition at line 640 of file RepoManager.cc.

◆ serviceEnd() [1/2]

RepoManager::ServiceConstIterator zypp::RepoManager::serviceEnd ( ) const
inline

Definition at line 641 of file RepoManager.cc.

◆ hasService() [1/2]

bool zypp::RepoManager::hasService ( const std::string &  alias) const
inline

Definition at line 643 of file RepoManager.cc.

◆ getService() [1/2]

ServiceInfo zypp::RepoManager::getService ( const std::string &  alias) const
inline

Definition at line 646 of file RepoManager.cc.

◆ addService() [1/4]

void zypp::RepoManager::addService ( const ServiceInfo service)

Definition at line 2679 of file RepoManager.cc.

◆ addService() [2/4]

void zypp::RepoManager::addService ( const std::string &  alias,
const Url url 
)
inline

Definition at line 654 of file RepoManager.cc.

◆ removeService() [1/4]

void zypp::RepoManager::removeService ( const std::string &  alias)

Definition at line 2682 of file RepoManager.cc.

◆ removeService() [2/4]

void zypp::RepoManager::removeService ( const ServiceInfo service)
inline

Definition at line 658 of file RepoManager.cc.

◆ refreshServices() [1/2]

void zypp::RepoManager::refreshServices ( const RefreshServiceOptions options_r)

Definition at line 2688 of file RepoManager.cc.

◆ refreshService() [1/4]

void zypp::RepoManager::refreshService ( const std::string &  alias,
const RefreshServiceOptions options_r 
)

Definition at line 2691 of file RepoManager.cc.

◆ refreshService() [2/4]

void zypp::RepoManager::refreshService ( const ServiceInfo service,
const RefreshServiceOptions options_r 
)
inline

Definition at line 664 of file RepoManager.cc.

◆ modifyService() [1/3]

void zypp::RepoManager::modifyService ( const std::string &  oldAlias,
const ServiceInfo newService 
)

Definition at line 2697 of file RepoManager.cc.

◆ probeService() [1/2]

repo::ServiceType zypp::RepoManager::probeService ( const Url url) const

Definition at line 2673 of file RepoManager.cc.

◆ saveService()

void zypp::RepoManager::saveService ( ServiceInfo service) const
private

◆ generateNonExistingName()

Pathname zypp::RepoManager::generateNonExistingName ( const Pathname dir,
const std::string &  basefilename 
) const
private

◆ generateFilename() [1/2]

std::string zypp::RepoManager::generateFilename ( const RepoInfo info) const
inlineprivate

Definition at line 676 of file RepoManager.cc.

◆ generateFilename() [2/2]

std::string zypp::RepoManager::generateFilename ( const ServiceInfo info) const
inlineprivate

Definition at line 679 of file RepoManager.cc.

◆ setCacheStatus()

void zypp::RepoManager::setCacheStatus ( const RepoInfo info,
const RepoStatus status 
)
inlineprivate

Definition at line 682 of file RepoManager.cc.

◆ touchIndexFile()

void zypp::RepoManager::touchIndexFile ( const RepoInfo info)
private

◆ getRepositoriesInService() [1/2]

template<typename OutputIterator >
void zypp::RepoManager::getRepositoriesInService ( const std::string &  alias,
OutputIterator  out 
) const
inlineprivate

Definition at line 692 of file RepoManager.cc.

◆ init_knownServices()

void zypp::RepoManager::init_knownServices ( )
private

◆ init_knownRepositories()

void zypp::RepoManager::init_knownRepositories ( )
private

◆ repos() [1/2]

Iterable< RepoManager::RepoConstIterator > zypp::RepoManager::repos ( ) const
inlineprivate

Iterate the known repositories.

Definition at line 704 of file RepoManager.cc.

◆ reposManip()

RepoSet & zypp::RepoManager::reposManip ( )
inlineprivate

Definition at line 705 of file RepoManager.cc.

◆ clone()

Impl * zypp::RepoManager::clone ( ) const
inlineprivate

clone for RWCOW_pointer

Definition at line 719 of file RepoManager.cc.

◆ ZYPP_DECLARE_FLAGS()

zypp::RepoManager::ZYPP_DECLARE_FLAGS ( RefreshServiceFlags  ,
RefreshServiceBit   
)

◆ repoEmpty() [2/2]

bool zypp::RepoManager::repoEmpty ( ) const

◆ repoSize() [2/2]

RepoSizeType zypp::RepoManager::repoSize ( ) const

◆ repoBegin() [2/2]

RepoConstIterator zypp::RepoManager::repoBegin ( ) const

◆ repoEnd() [2/2]

RepoConstIterator zypp::RepoManager::repoEnd ( ) const

◆ repos() [2/2]

Iterable< RepoConstIterator > zypp::RepoManager::repos ( ) const

◆ knownRepositories()

std::list< RepoInfo > zypp::RepoManager::knownRepositories ( ) const
inline

List of known repositories.

Definition at line 167 of file RepoManager.h.

◆ getRepo() [2/3]

RepoInfo zypp::RepoManager::getRepo ( const std::string &  alias) const

Find RepoInfo by alias or return RepoInfo::noRepo.

◆ getRepo() [3/3]

RepoInfo zypp::RepoManager::getRepo ( const RepoInfo info_r) const
inline

Definition at line 173 of file RepoManager.h.

◆ hasRepo() [2/3]

bool zypp::RepoManager::hasRepo ( const std::string &  alias) const

Return whether there is a known repository for alias.

◆ hasRepo() [3/3]

bool zypp::RepoManager::hasRepo ( const RepoInfo info_r) const
inline

Definition at line 179 of file RepoManager.h.

◆ makeStupidAlias()

std::string zypp::RepoManager::makeStupidAlias ( const Url url_r = Url())
static

Some stupid string but suitable as alias for your url if nothing better is available.

Something like "http-download.opensuse.org-83df67e5"

Definition at line 2572 of file RepoManager.cc.

◆ metadataStatus() [2/2]

RepoStatus zypp::RepoManager::metadataStatus ( const RepoInfo info) const

Status of local metadata.

◆ checkIfToRefreshMetadata() [2/2]

RefreshCheckStatus zypp::RepoManager::checkIfToRefreshMetadata ( const RepoInfo info,
const Url url,
RawMetadataRefreshPolicy  policy = RefreshIfNeeded 
)

Checks whether to refresh metadata for specified repository and url.

The need for refresh is evaluated according to the following conditions, in that order:

  • the refresh policy (refresh may be forced)
  • the repo.refresh.delay ZConfig value compared to the difference between cached index file timestamp and actual time
  • the timestamp of cached repo index file compared to the remote index file timestamp.

This method checks the status against the specified url only. If more baseurls are defined for in the RepoInfo, each one must be check individually. Example:

RepoInfo info; // try urls one by one for ( RepoInfo::urls_const_iterator it = info.baseUrlsBegin(); it != info.baseUrlsEnd(); ++it ) { try { // check whether to refresh metadata // if the check fails for this url, it throws, so another url will be checked if (checkIfToRefreshMetadata(info, *it, policy)!=RepoInfo::REFRESH_NEEDED) return;

// do the actual refresh } catch (const Exception & e) { ZYPP_CAUGHT(e); ERR << *it << " doesn't look good. Trying another url." << endl; } } // for all urls

handle("No more URLs.");

Parameters
info
url
policy
Returns
state of repository
See also
RefreshCheckStatus
Exceptions
RepoUnknownTypeException
repo::RepoNoAliasExceptionif can't figure an alias
Exceptionon unknown error

◆ metadataPath() [2/2]

Pathname zypp::RepoManager::metadataPath ( const RepoInfo info) const

Path where the metadata is downloaded and kept.

Given a repoinfo, tells where RepoManager will download and keep the raw metadata.

Parameters
infoRepository information
Exceptions
repo::RepoNoAliasExceptionif can't figure an alias

◆ packagesPath() [2/2]

Pathname zypp::RepoManager::packagesPath ( const RepoInfo info) const

Path where the rpm packages are downloaded and kept.

Given a repoinfo, tells where RepoProvidePackage will download and keep the .rpm files.

Parameters
infoRepository information
Exceptions
repo::RepoNoAliasExceptionif can't figure an alias

◆ refreshMetadata() [2/2]

void zypp::RepoManager::refreshMetadata ( const RepoInfo info,
RawMetadataRefreshPolicy  policy = RefreshIfNeeded,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Refresh local raw cache.

Will try to download the metadata

In case of falure the metadata remains as it was before.

Exceptions
repo::RepoNoUrlExceptionif no urls are available.
repo::RepoNoAliasExceptionif can't figure an alias
repo::RepoUnknownTypeExceptionif the metadata is unknown
repo::RepoExceptionif the repository is invalid (no valid metadata found at any of baseurls)

Definition at line 2604 of file RepoManager.cc.

◆ cleanMetadata() [2/2]

void zypp::RepoManager::cleanMetadata ( const RepoInfo info,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Clean local metadata.

Empty local metadata.

Exceptions
repo::RepoNoAliasExceptionif can't figure an alias
Exceptionon unknown error.

Definition at line 2607 of file RepoManager.cc.

◆ cleanPackages() [2/2]

void zypp::RepoManager::cleanPackages ( const RepoInfo info,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Clean local package cache.

Empty local directory with downloaded packages

Exceptions
repo::RepoNoAliasExceptionif can't figure an alias
Exceptionon unknown error.

Definition at line 2610 of file RepoManager.cc.

◆ cacheStatus() [2/2]

RepoStatus zypp::RepoManager::cacheStatus ( const RepoInfo info) const

Status of metadata cache.

◆ buildCache() [2/2]

void zypp::RepoManager::buildCache ( const RepoInfo info,
CacheBuildPolicy  policy = BuildIfNeeded,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Refresh local cache.

Will try to build the cache from local metadata.

If the cache exists it will be overwriten.

Note
the local metadata must be valid.
Exceptions
repo::RepoNoAliasExceptionif can't figure an alias to look in cache
repo::RepoMetadataExceptionif the metadata is not enough to build a cache (empty, incorrect, or refresh needed)
repo::RepoUnknownTypeException
parser::ParseExceptionif parser encounters an error.
Exceptionon unknown error.

Definition at line 2616 of file RepoManager.cc.

◆ cleanCache() [2/2]

void zypp::RepoManager::cleanCache ( const RepoInfo info,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

clean local cache

Clean the cached version of the metadata

Note
the local metadata must be valid.
Exceptions
repo::RepoNoAliasExceptionif can't figure an alias to look in cache
cache::CacheRecordNotFoundExceptionif the cache could not be cleaned because of repository record not found.
Exceptionon unknown error.

Definition at line 2619 of file RepoManager.cc.

◆ isCached() [2/2]

bool zypp::RepoManager::isCached ( const RepoInfo info) const

Whether a repository exists in cache.

Parameters
RepoInfoto be checked.

◆ loadFromCache() [2/2]

void zypp::RepoManager::loadFromCache ( const RepoInfo info,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Load resolvables into the pool.

Creating from cache requires that the repository is refreshed (metadata downloaded) and cached

Exceptions
repo::RepoNoAliasExceptionif can't figure an alias to look in cache
RepoNotCachedExceptionWhen the source is not cached.

Definition at line 2625 of file RepoManager.cc.

◆ cleanCacheDirGarbage() [2/2]

void zypp::RepoManager::cleanCacheDirGarbage ( const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc())

Remove any subdirectories of cache directories which no longer belong to any of known repositories.

These can be temporary directories left by interrupted refresh, or dirs left after changing .repo files outside of libzypp.

Definition at line 2628 of file RepoManager.cc.

◆ probe() [2/3]

repo::RepoType zypp::RepoManager::probe ( const Url url,
const Pathname path 
) const

Probe repo metadata type.

The location to probe consists of the base url (you may think of it as a mountpoint) and the path to the repository on the mounted media (ususally / ).

◆ probe() [3/3]

repo::RepoType zypp::RepoManager::probe ( const Url url) const

Definition at line 2634 of file RepoManager.cc.

◆ addRepository() [2/2]

void zypp::RepoManager::addRepository ( const RepoInfo info,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Adds a repository to the list of known repositories.

Exceptions
repo::RepoAlreadyExistsExceptionIf the repo clash some unique attribute like alias
RepoUnknownTypeIf RepoManagerOptions::probe is true and repository type can't be determined.
RepoExceptionIf RepoManagerOptions::probe is true and access to the url fails.
ExceptionOn other errors.

Definition at line 2637 of file RepoManager.cc.

◆ addRepositories() [2/2]

void zypp::RepoManager::addRepositories ( const Url url,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Adds repositores from a repo file to the list of known repositories.

Parameters
urlUrl of the repo file
Exceptions
repo::RepoAlreadyExistsExceptionIf the repo clash some unique attribute like alias
MediaExceptionIf the access to the url fails
ParseExceptionIf the file parsing fails
RepoUnknownTypeIf repository type can't be determined
RepoExceptionON other repository related errors
ExceptionOn other errors.

Definition at line 2640 of file RepoManager.cc.

◆ removeRepository() [2/2]

void zypp::RepoManager::removeRepository ( const RepoInfo info,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Remove the best matching repository from known repos list.

Exceptions
RepoNotFoundExceptionIf no repo match

Definition at line 2643 of file RepoManager.cc.

◆ modifyRepository() [2/3]

void zypp::RepoManager::modifyRepository ( const std::string &  alias,
const RepoInfo newinfo,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Modify repository attributes.

Exceptions
RepoAlreadyExistsExceptionif the alias specified in newinfo is already used by another repository
RepoNotFoundExceptionIf no repo match
ParseExceptionIf the file parsing fails
ExceptionOn other errors.

Definition at line 2646 of file RepoManager.cc.

◆ modifyRepository() [3/3]

void zypp::RepoManager::modifyRepository ( const RepoInfo newinfo,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)
inline

Definition at line 463 of file RepoManager.h.

◆ getRepositoryInfo() [3/4]

RepoInfo zypp::RepoManager::getRepositoryInfo ( const std::string &  alias,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Find a matching repository info.

Note
if multiple repositories incorrectly share the same alias, the first one found will be returned.
Parameters
aliasRepository alias
progressrcvProgress reporting function
Returns
RepoInfo of the found repository
Exceptions
RepoNotFoundExceptionIf no repo match the alias
ParseExceptionIf the file parsing fails
ExceptionOn other errors.

Definition at line 2649 of file RepoManager.cc.

◆ getRepositoryInfo() [4/4]

RepoInfo zypp::RepoManager::getRepositoryInfo ( const Url url,
const url::ViewOption urlview = url::ViewOption::DEFAULTS,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Find repository info by URL.

Parameters
urlURL to find.
urlviewurl::ViewOption to influence URL matching.
progressrcvProgress receiver function.
Returns
RepoInfo of the found repository.
Note
if multpile repositories incorrectly share the same URL, the first one found will be returned.
the string representation of the URLs are compared. The urlview can be used to influence which parts of the URL are to be compared.
Exceptions
RepoNotFoundExceptionIf no repo match
ParseExceptionIf the file parsing fails
ExceptionOn other errors.

Definition at line 2652 of file RepoManager.cc.

◆ serviceEmpty() [2/2]

bool zypp::RepoManager::serviceEmpty ( ) const

Gets true if no service is in RepoManager (so no one in specified location)

Returns
true if any ServiceInfo is in RepoManager

◆ serviceSize() [2/2]

ServiceSizeType zypp::RepoManager::serviceSize ( ) const

Gets count of service in RepoManager (in specified location)

Returns
count of service

◆ serviceBegin() [2/2]

ServiceConstIterator zypp::RepoManager::serviceBegin ( ) const

Iterator to first service in internal storage.

Note
Iterator is immutable, so you cannot change pointed ServiceInfo
Returns
Iterator to first service

◆ serviceEnd() [2/2]

ServiceConstIterator zypp::RepoManager::serviceEnd ( ) const

Iterator to place behind last service in internal storage.

Returns
iterator to end

◆ services()

Iterable< RepoManager::ServiceConstIterator > zypp::RepoManager::services ( ) const
inline

Iterate the known services.

Definition at line 711 of file RepoManager.h.

◆ knownServices()

std::list< ServiceInfo > zypp::RepoManager::knownServices ( ) const
inline

List of known services.

Definition at line 545 of file RepoManager.h.

◆ getService() [2/2]

ServiceInfo zypp::RepoManager::getService ( const std::string &  alias) const

Finds ServiceInfo by alias or return ServiceInfo::noService.

Parameters
aliasunique identifier of service
Returns
information about service

◆ hasService() [2/2]

bool zypp::RepoManager::hasService ( const std::string &  alias) const

Return whether there is a known service for alias.

◆ probeService() [2/2]

repo::ServiceType zypp::RepoManager::probeService ( const Url url) const

Probe the type or the service.

◆ addService() [3/4]

void zypp::RepoManager::addService ( const std::string &  alias,
const Url url 
)

Adds a new service by its alias and URL.

Parameters
aliasunique identifier of the service
urlurl to service
Exceptions
FIXMERepoAlreadyExistException and as reponame is service name

◆ addService() [4/4]

void zypp::RepoManager::addService ( const ServiceInfo service)

Adds new service.

Parameters
serviceservice info
Exceptions
FIXMERepoAlreadyExistException and as reponame is service name

◆ removeService() [3/4]

void zypp::RepoManager::removeService ( const std::string &  alias)

Removes service specified by its name.

Parameters
aliasunique indientifier of the service to remove
Exceptions
RepoExceptionif service is not found or file with ServiceInfo cannot be deleted
Exceptionif file contain more services and rewrite file failed

◆ removeService() [4/4]

void zypp::RepoManager::removeService ( const ServiceInfo service)

◆ refreshServices() [2/2]

void zypp::RepoManager::refreshServices ( const RefreshServiceOptions options_r = RefreshServiceOptions())

Refreshes all enabled services.

See also
refreshService(ServiceInfo)

◆ refreshService() [3/4]

void zypp::RepoManager::refreshService ( const std::string &  alias,
const RefreshServiceOptions options_r = RefreshServiceOptions() 
)

Refresh specific service.

Parameters
aliasunique indientifier of the service to refresh
Exceptions
RepoExceptionif service is not found.
MediaExceptionIf there's a problem downloading the repo index file.

◆ refreshService() [4/4]

void zypp::RepoManager::refreshService ( const ServiceInfo service,
const RefreshServiceOptions options_r = RefreshServiceOptions() 
)

◆ modifyService() [2/3]

void zypp::RepoManager::modifyService ( const std::string &  oldAlias,
const ServiceInfo service 
)

Modifies service file (rewrites it with new values) and underlying repositories if needed.

Modifications of a service can lead to rewrite of all .repo files of contained repositories. Particularily, disabling a service (changing ServiceInfo::enabled() from true to false) will disable all contained repositories. Renaming of a service will modify the "service" key of all contained repositories.

Parameters
oldAliasOld alias of the service
serviceServiceInfo object containing new data
Exceptions
RepoExceptionif sservice with oldAlias is not known
Exceptionif have problems with files

◆ modifyService() [3/3]

void zypp::RepoManager::modifyService ( const ServiceInfo service)
inline

Definition at line 634 of file RepoManager.h.

◆ getRepositoriesInService() [2/2]

template<typename OutputIterator >
void zypp::RepoManager::getRepositoriesInService ( const std::string &  alias,
OutputIterator  out 
) const
inline

fill to output iterator repositories in service name.

This output iterator can perform any action on with Repo or service Container, because it is sets and it isn't dynamic recreate.

Note
Don't use this function with RepoManager::removeRepository(), it will lead to segfaults due to invalidated internal iterators. FIXME can this be solved (using STL) so that this warning would not be needed?
Parameters
aliasservice alias
outoutput iterator which get all the repositories belonging to specified service

example how set priority for each RepoInfo in this service:

//functor
class ChangePriority
{
private:
int priority;
public:
ChangePriority(int prio) : priority(prio) {}
// missing rewrite priority back via RepoManager::modifyRepo
void doIt( RepoInfo info ) { info.setPriority(priority); }
}
//somewhere in code
ChangePriority changer(10);
boost::make_function_output_iterator(
bind(&ChangePriority::doIt, &changer, _1)));
void getRepositoriesInService(const std::string &alias, OutputIterator out) const
Definition: RepoManager.cc:692

Definition at line 686 of file RepoManager.h.

Friends And Related Function Documentation

◆ rwcowClone

Impl * rwcowClone ( const Impl rhs)
friend

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream &  str,
const RepoManager obj 
)
friend

Definition at line 2702 of file RepoManager.cc.

◆ operator<<() [2/2]

std::ostream & operator<< ( std::ostream &  str,
const RepoManager obj 
)
related

Stream output.

Definition at line 2702 of file RepoManager.cc.

Member Data Documentation

◆ _options

RepoManagerOptions zypp::RepoManager::_options
private

Definition at line 708 of file RepoManager.cc.

◆ _reposX

RepoSet zypp::RepoManager::_reposX
private

Definition at line 709 of file RepoManager.cc.

◆ _services

ServiceSet zypp::RepoManager::_services
private

Definition at line 710 of file RepoManager.cc.

◆ _reposDirty

DefaultIntegral<bool,false> zypp::RepoManager::_reposDirty
private

Definition at line 712 of file RepoManager.cc.

◆ _pluginRepoverification

PluginRepoverification zypp::RepoManager::_pluginRepoverification
private

Definition at line 714 of file RepoManager.cc.

◆ _pimpl

RWCOW_pointer<Impl> zypp::RepoManager::_pimpl
private

Pointer to implementation.

Definition at line 698 of file RepoManager.h.


The documentation for this class was generated from the following files: