libzypp  11.13.5
zypp::RepoManager Class Reference

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

#include <RepoManager.h>

List of all members.

Classes

struct  Impl
 RepoManager implementation. More...
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  RepoRemovePolicy
enum  RefreshCheckStatus { REFRESH_NEEDED, REPO_UP_TO_DATE, REPO_CHECK_DELAYED }
 Possibly return state of checkIfRefreshMEtadata function. More...
typedef std::set< ServiceInfoServiceSet
 ServiceInfo typedefs.
typedef ServiceSet::const_iterator ServiceConstIterator
typedef ServiceSet::size_type ServiceSizeType
typedef std::set< RepoInfoRepoSet
 RepoInfo typedefs.
typedef RepoSet::const_iterator RepoConstIterator
typedef RepoSet::size_type RepoSizeType

Public Member Functions

 RepoManager (const RepoManagerOptions &options=RepoManagerOptions())
 ~RepoManager ()
 Dtor.
RepoStatus metadataStatus (const RepoInfo &info) const
 Status of local metadata.
RefreshCheckStatus checkIfToRefreshMetadata (const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy=RefreshIfNeeded)
 Checks whether to refresh metadata for specified repository and url.
Pathname metadataPath (const RepoInfo &info) const
 Path where the metadata is downloaded and kept.
Pathname packagesPath (const RepoInfo &info) const
 Path where the rpm packages are downloaded and kept.
void refreshMetadata (const RepoInfo &info, RawMetadataRefreshPolicy policy=RefreshIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Refresh local raw cache.
void cleanMetadata (const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Clean local metadata.
void cleanPackages (const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Clean local package cache.
RepoStatus cacheStatus (const RepoInfo &info) const
 Status of metadata cache.
void buildCache (const RepoInfo &info, CacheBuildPolicy policy=BuildIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Refresh local cache.
void cleanCache (const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 clean local cache
bool isCached (const RepoInfo &info) const
 Whether a repository exists in cache.
void loadFromCache (const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Load resolvables into the pool.
void cleanCacheDirGarbage (const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Remove any subdirectories of cache directories which no longer belong to any of known repositories.
repo::RepoType probe (const Url &url, const Pathname &path) const
 Probe repo metadata type.
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.
void addRepositories (const Url &url, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Adds repositores from a repo file to the list of known repositories.
void removeRepository (const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Remove the best matching repository from known repos list.
void modifyRepository (const std::string &alias, const RepoInfo &newinfo, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Modify repository attributes.
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.
RepoInfo getRepositoryInfo (const Url &url, const url::ViewOption &urlview=url::ViewOption::DEFAULTS, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
 Find repository info by URL.
repo::ServiceType probeService (const Url &url) const
 Probe the type or the service.
void addService (const std::string &alias, const Url &url)
 Adds new service by it's alias and url.
void addService (const ServiceInfo &service)
 Adds new service.
void removeService (const std::string &alias)
 Removes service specified by its name.
void removeService (const ServiceInfo &service)
void refreshServices ()
 Refreshes all enabled services.
void refreshService (const std::string &alias)
 Refresh specific service.
void refreshService (const ServiceInfo &service)
void modifyService (const std::string &oldAlias, const ServiceInfo &service)
 Modifies service file (rewrites it with new values) and underlying repositories if needed.
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.
Known services.

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

Which defaults to ZYpp global settings.

bool serviceEmpty () const
 Gets true if no service is in RepoManager (so no one in specified location)
ServiceSizeType serviceSize () const
 Gets count of service in RepoManager (in specified location)
ServiceConstIterator serviceBegin () const
 Iterator to first service in internal storage.
ServiceConstIterator serviceEnd () const
 Iterator to place behind last service in internal storage.
std::list< ServiceInfoknownServices () const
 List of known services.
ServiceInfo getService (const std::string &alias) const
 Finds ServiceInfo by alias or return ServiceInfo::noService.
bool hasService (const std::string &alias) const
 Return whether there is a known service for alias.

Protected Member Functions

RepoStatus rawMetadataStatus (const RepoInfo &info)
void setCacheStatus (const RepoInfo &info, const RepoStatus &status)
void touchIndexFile (const RepoInfo &info)
 Update timestamp of repository index file for the specified repository info.

Private Attributes

RWCOW_pointer< Impl_pimpl
 Pointer to implementation.

Friends

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)

Known repositories.

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

Which defaults to ZYpp global settings.

bool repoEmpty () const
RepoSizeType repoSize () const
RepoConstIterator repoBegin () const
RepoConstIterator repoEnd () const
std::list< RepoInfoknownRepositories () const
 List of known repositories.
RepoInfo getRepo (const std::string &alias) const
 Find RepoInfo by alias or return RepoInfo::noRepo.
RepoInfo getRepo (const RepoInfo &info_r) const
bool hasRepo (const std::string &alias) const
 Return whether there is a known repository for alias.
bool hasRepo (const RepoInfo &info_r) const
static std::string makeStupidAlias (const Url &url_r=Url())
 Some stupid string but suitable as alias for your url if nothing better is available.

Additional Inherited Members


Detailed Description

creates and provides information about known sources.

Definition at line 108 of file RepoManager.h.


Member Typedef Documentation

ServiceInfo typedefs.

Definition at line 114 of file RepoManager.h.

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

Definition at line 118 of file RepoManager.h.

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

Definition at line 119 of file RepoManager.h.

RepoInfo typedefs.

Definition at line 122 of file RepoManager.h.

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

Definition at line 123 of file RepoManager.h.

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

Definition at line 124 of file RepoManager.h.


Member Enumeration Documentation

Enumerator:
RefreshIfNeeded 
RefreshForced 
RefreshIfNeededIgnoreDelay 

Definition at line 131 of file RepoManager.h.

Enumerator:
BuildIfNeeded 
BuildForced 

Definition at line 138 of file RepoManager.h.

Definition at line 144 of file RepoManager.h.

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 191 of file RepoManager.h.


Constructor & Destructor Documentation

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

Definition at line 598 of file RepoManager.cc.

zypp::RepoManager::~RepoManager ( )

Dtor.

Definition at line 604 of file RepoManager.cc.


Member Function Documentation

bool zypp::RepoManager::repoEmpty ( ) const

Definition at line 609 of file RepoManager.cc.

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

Definition at line 612 of file RepoManager.cc.

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

Definition at line 615 of file RepoManager.cc.

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

Definition at line 618 of file RepoManager.cc.

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

List of known repositories.

Definition at line 162 of file RepoManager.h.

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

Find RepoInfo by alias or return RepoInfo::noRepo.

Definition at line 621 of file RepoManager.cc.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 168 of file RepoManager.h.

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

Return whether there is a known repository for alias.

Definition at line 629 of file RepoManager.cc.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 174 of file RepoManager.h.

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 637 of file RepoManager.cc.

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

Status of local metadata.

Definition at line 671 of file RepoManager.cc.

RepoManager::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

Definition at line 754 of file RepoManager.cc.

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

Definition at line 659 of file RepoManager.cc.

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

Definition at line 664 of file RepoManager.cc.

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)

Given a downloader, sets the other repos raw metadata path as cache paths for the fetcher, so if another repo has the same file, it will not download it but copy it from the other repository

Definition at line 905 of file RepoManager.cc.

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 1053 of file RepoManager.cc.

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 1063 of file RepoManager.cc.

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

Status of metadata cache.

Definition at line 1380 of file RepoManager.cc.

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 1073 of file RepoManager.cc.

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 1360 of file RepoManager.cc.

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

Whether a repository exists in cache.

Parameters:
RepoInfoto be checked.

Definition at line 1375 of file RepoManager.cc.

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 1397 of file RepoManager.cc.

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 1313 of file RepoManager.cc.

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 / ).

Definition at line 1227 of file RepoManager.cc.

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

Definition at line 1224 of file RepoManager.cc.

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.
Todo:
use a method calling UI callbacks to ask where to save creds?

Definition at line 1438 of file RepoManager.cc.

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 1529 of file RepoManager.cc.

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 1587 of file RepoManager.cc.

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 1673 of file RepoManager.cc.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 458 of file RepoManager.h.

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 1731 of file RepoManager.cc.

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 1745 of file RepoManager.cc.

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

Definition at line 1770 of file RepoManager.cc.

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

Gets count of service in RepoManager (in specified location)

Returns:
count of service

Definition at line 1773 of file RepoManager.cc.

RepoManager::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

Definition at line 1776 of file RepoManager.cc.

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

Iterator to place behind last service in internal storage.

Returns:
iterator to end

Definition at line 1779 of file RepoManager.cc.

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

List of known services.

Definition at line 537 of file RepoManager.h.

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

Definition at line 1782 of file RepoManager.cc.

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

Return whether there is a known service for alias.

Definition at line 1790 of file RepoManager.cc.

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

Probe the type or the service.

Definition at line 2204 of file RepoManager.cc.

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

Adds new service by it's alias and url.

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

Definition at line 1800 of file RepoManager.cc.

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

Adds new service.

Parameters:
serviceservice info
Exceptions:
FIXMERepoAlreadyExistException and as reponame is service name
Todo:
use a method calling UI callbacks to ask where to save creds?

Definition at line 1805 of file RepoManager.cc.

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

Definition at line 1834 of file RepoManager.cc.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1889 of file RepoManager.cc.

void zypp::RepoManager::refreshServices ( )

Refreshes all enabled services.

See also:
refreshService(ServiceInfo)

Definition at line 1894 of file RepoManager.cc.

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

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.
Todo:
add callbacks for apps (start, end, repo removed, repo added, repo changed)

Definition at line 1915 of file RepoManager.cc.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1912 of file RepoManager.cc.

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
Todo:
do nothing? the repos will be enabled on service refresh
Todo:
how to know the service needs a (auto) refresh????
Todo:
refresh the service automatically if url is changed?

Definition at line 2137 of file RepoManager.cc.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 626 of file RepoManager.h.

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)));

Definition at line 678 of file RepoManager.h.

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

Definition at line 1388 of file RepoManager.cc.

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

Update timestamp of repository index file for the specified repository info.

Used in checkIfToRefreshMetadata() for repo.refresh.delay feature.

Definition at line 718 of file RepoManager.cc.


Friends And Related Function Documentation

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

Definition at line 2234 of file RepoManager.cc.

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

Stream output

Definition at line 2234 of file RepoManager.cc.


Member Data Documentation

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

Pointer to implementation.

Definition at line 702 of file RepoManager.h.


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