#include <RepoManager.h>
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< ServiceInfo > | ServiceSet |
ServiceInfo typedefs. | |
typedef ServiceSet::const_iterator | ServiceConstIterator |
typedef ServiceSet::size_type | ServiceSizeType |
typedef std::set< RepoInfo > | RepoSet |
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< ServiceInfo > | knownServices () 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) |
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< RepoInfo > | knownRepositories () 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. |
Definition at line 114 of file RepoManager.h.
typedef std::set<ServiceInfo> zypp::RepoManager::ServiceSet |
typedef ServiceSet::const_iterator zypp::RepoManager::ServiceConstIterator |
Definition at line 124 of file RepoManager.h.
typedef ServiceSet::size_type zypp::RepoManager::ServiceSizeType |
Definition at line 125 of file RepoManager.h.
typedef std::set<RepoInfo> zypp::RepoManager::RepoSet |
typedef RepoSet::const_iterator zypp::RepoManager::RepoConstIterator |
Definition at line 129 of file RepoManager.h.
typedef RepoSet::size_type zypp::RepoManager::RepoSizeType |
Definition at line 130 of file RepoManager.h.
Definition at line 137 of file RepoManager.h.
Definition at line 150 of file RepoManager.h.
Possibly return state of checkIfRefreshMEtadata function.
REFRESH_NEEDED | refresh is needed |
REPO_UP_TO_DATE | repository not changed |
REPO_CHECK_DELAYED | refresh is delayed due to settings |
Definition at line 197 of file RepoManager.h.
zypp::RepoManager::RepoManager | ( | const RepoManagerOptions & | options = RepoManagerOptions() |
) |
Definition at line 585 of file RepoManager.cc.
zypp::RepoManager::~RepoManager | ( | ) |
bool zypp::RepoManager::repoEmpty | ( | ) | const |
RepoManager::RepoSizeType zypp::RepoManager::repoSize | ( | ) | const |
RepoManager::RepoConstIterator zypp::RepoManager::repoBegin | ( | ) | const |
Definition at line 602 of file RepoManager.cc.
References _pimpl.
Referenced by addRepositories(), cleanCacheDirGarbage(), getRepo(), getRepositoriesInService(), getRepositoryInfo(), hasRepo(), knownRepositories(), refreshMetadata(), and removeRepository().
RepoManager::RepoConstIterator zypp::RepoManager::repoEnd | ( | ) | const |
Definition at line 605 of file RepoManager.cc.
References _pimpl.
Referenced by addRepositories(), cleanCacheDirGarbage(), getRepo(), getRepositoriesInService(), getRepositoryInfo(), hasRepo(), knownRepositories(), refreshMetadata(), and removeRepository().
std::list<RepoInfo> zypp::RepoManager::knownRepositories | ( | ) | const [inline] |
List of known repositories.
Definition at line 168 of file RepoManager.h.
References repoBegin(), and repoEnd().
Referenced by zypp::misc::defaultLoadSystem().
RepoInfo zypp::RepoManager::getRepo | ( | const std::string & | alias | ) | const |
Find RepoInfo by alias or return RepoInfo::noRepo.
Definition at line 608 of file RepoManager.cc.
References for_, zypp::RepoInfo::noRepo, repoBegin(), and repoEnd().
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.
References zypp::repo::RepoInfoBase::alias(), and getRepo().
Referenced by getRepo().
bool zypp::RepoManager::hasRepo | ( | const std::string & | alias | ) | const |
Return whether there is a known repository for alias
.
Definition at line 616 of file RepoManager.cc.
References for_, repoBegin(), and repoEnd().
Referenced by modifyRepository().
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 180 of file RepoManager.h.
References zypp::repo::RepoInfoBase::alias(), and hasRepo().
Referenced by hasRepo().
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 624 of file RepoManager.cc.
References zypp::Url::asCompleteString(), zypp::Digest::digest(), zypp::Url::getHost(), zypp::Url::getScheme(), zypp::str::hexstring(), zypp::Date::now(), and zypp::Digest::sha1().
RepoStatus zypp::RepoManager::metadataStatus | ( | const RepoInfo & | info | ) | const |
Status of local metadata.
Definition at line 658 of file RepoManager.cc.
References _pimpl, probe(), zypp::rawcache_path_for_repoinfo(), zypp::rawproductdata_path_for_repoinfo(), zypp::repo::RepoType::toEnum(), and zypp::RepoInfo::type().
Referenced by buildCache(), and checkIfToRefreshMetadata().
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:
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)!=RepoInfoREFRESH_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.");
info | ||
url | ||
policy |
RepoUnknownTypeException | ||
repo::RepoNoAliasException | if can't figure an alias | |
Exception | on unknown error |
Definition at line 741 of file RepoManager.cc.
References _pimpl, zypp::repo::RepoInfoBase::alias(), zypp::assert_alias(), zypp::filesystem::assert_dir(), zypp::RepoStatus::checksum(), DBG, zypp::parser::plaindir::dirStatus(), zypp::RepoStatus::empty(), ERR, zypp::Url::getScheme(), zypp::ZConfig::instance(), zypp::filesystem::TmpDir::makeSibling(), metadataStatus(), MIL, zypp::Date::now(), zypp::RepoInfo::path(), probe(), zypp::rawcache_path_for_repoinfo(), REFRESH_NEEDED, RefreshForced, RefreshIfNeededIgnoreDelay, REPO_CHECK_DELAYED, zypp::ZConfig::repo_refresh_delay(), REPO_UP_TO_DATE, zypp::RepoStatus::timestamp(), zypp::repo::RepoType::toEnum(), touchIndexFile(), zypp::RepoInfo::type(), WAR, ZYPP_CAUGHT, ZYPP_RETHROW, and ZYPP_THROW.
Referenced by zypp::misc::defaultLoadSystem(), and refreshMetadata().
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.
info | Repository information |
repo::RepoNoAliasException | if can't figure an alias |
Definition at line 646 of file RepoManager.cc.
References _pimpl, and zypp::rawcache_path_for_repoinfo().
Referenced by addRepository().
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.
info | Repository information |
repo::RepoNoAliasException | if can't figure an alias |
Definition at line 651 of file RepoManager.cc.
References _pimpl, and zypp::packagescache_path_for_repoinfo().
Referenced by addRepository().
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.
repo::RepoNoUrlException | if no urls are available. | |
repo::RepoNoAliasException | if can't figure an alias | |
repo::RepoUnknownTypeException | if the metadata is unknown | |
repo::RepoException | if 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 892 of file RepoManager.cc.
References _, _pimpl, zypp::repo::RepoInfoBase::alias(), zypp::assert_alias(), zypp::filesystem::assert_dir(), zypp::assert_urls(), zypp::RepoInfo::baseUrlsBegin(), zypp::RepoInfo::baseUrlsEnd(), checkIfToRefreshMetadata(), zypp::RepoStatus::checksum(), zypp::parser::plaindir::dirStatus(), ERR, zypp::filesystem::exchange(), for_, zypp::str::form(), zypp::filesystem::TmpDir::makeSibling(), MIL, modifyRepository(), zypp::filesystem::TmpPath::path(), zypp::RepoInfo::path(), probe(), zypp::rawcache_path_for_repoinfo(), REFRESH_NEEDED, zypp::Exception::remember(), repoBegin(), repoEnd(), zypp::RepoInfo::setProbedType(), zypp::RepoInfo::setType(), zypp::repo::RepoType::toEnum(), zypp::RepoInfo::type(), url, ZYPP_CAUGHT, and ZYPP_THROW.
Referenced by buildCache(), and zypp::misc::defaultLoadSystem().
void zypp::RepoManager::cleanMetadata | ( | const RepoInfo & | info, | |
const ProgressData::ReceiverFnc & | progressrcv = ProgressData::ReceiverFnc() | |||
) |
Clean local metadata.
Empty local metadata.
repo::RepoNoAliasException | if can't figure an alias | |
Exception | on unknown error. |
Definition at line 1031 of file RepoManager.cc.
References _pimpl, zypp::rawcache_path_for_repoinfo(), zypp::filesystem::recursive_rmdir(), zypp::ProgressData::sendTo(), and zypp::ProgressData::toMax().
Referenced by removeRepository().
void zypp::RepoManager::cleanPackages | ( | const RepoInfo & | info, | |
const ProgressData::ReceiverFnc & | progressrcv = ProgressData::ReceiverFnc() | |||
) |
Clean local package cache.
Empty local directory with downloaded packages
repo::RepoNoAliasException | if can't figure an alias | |
Exception | on unknown error. |
Definition at line 1041 of file RepoManager.cc.
References _pimpl, zypp::packagescache_path_for_repoinfo(), zypp::filesystem::recursive_rmdir(), zypp::ProgressData::sendTo(), and zypp::ProgressData::toMax().
RepoStatus zypp::RepoManager::cacheStatus | ( | const RepoInfo & | info | ) | const |
Status of metadata cache.
Definition at line 1343 of file RepoManager.cc.
References _pimpl, zypp::RepoStatus::fromCookieFile(), and zypp::solv_path_for_repoinfo().
Referenced by buildCache().
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.
repo::RepoNoAliasException | if can't figure an alias to look in cache | |
repo::RepoMetadataException | if the metadata is not enough to build a cache (empty, incorrect, or refresh needed) | |
repo::RepoUnknownTypeException | ||
parser::ParseException | if parser encounters an error. | |
Exception | on unknown error. |
Definition at line 1051 of file RepoManager.cc.
References _, _pimpl, zypp::repo::RepoInfoBase::alias(), zypp::assert_alias(), zypp::filesystem::assert_dir(), zypp::RepoInfo::baseUrlsBegin(), BuildIfNeeded, cacheStatus(), zypp::RepoStatus::checksum(), cleanCache(), zypp::ExternalProgram::close(), zypp::ExternalProgram::command(), zypp::RepoStatus::empty(), zypp::str::form(), isCached(), zypp::repo::RepoInfoBase::label(), metadataStatus(), MIL, zypp::ProgressData::name(), zypp::RepoInfo::path(), probe(), zypp::rawcache_path_for_repoinfo(), zypp::rawproductdata_path_for_repoinfo(), zypp::externalprogram::ExternalDataSource::receiveLine(), RefreshIfNeeded, refreshMetadata(), zypp::Exception::remember(), report, zypp::AutoDispose< _Tp >::resetDispose(), zypp::ProgressData::sendTo(), setCacheStatus(), zypp::solv_path_for_repoinfo(), zypp::ExternalProgram::Stderr_To_Stdout, zypp::repo::RepoType::toEnum(), zypp::ProgressData::toMax(), zypp::ProgressData::toMin(), zypp::RepoInfo::type(), zypp::filesystem::unlink(), WAR, and ZYPP_THROW.
Referenced by zypp::misc::defaultLoadSystem(), and loadFromCache().
void zypp::RepoManager::cleanCache | ( | const RepoInfo & | info, | |
const ProgressData::ReceiverFnc & | progressrcv = ProgressData::ReceiverFnc() | |||
) |
clean local cache
Clean the cached version of the metadata
repo::RepoNoAliasException | if can't figure an alias to look in cache | |
cache::CacheRecordNotFoundException | if the cache could not be cleaned because of repository record not found. | |
Exception | on unknown error. |
Definition at line 1323 of file RepoManager.cc.
References _pimpl, zypp::repo::RepoInfoBase::alias(), MIL, zypp::filesystem::recursive_rmdir(), zypp::ProgressData::sendTo(), zypp::solv_path_for_repoinfo(), zypp::ProgressData::toMax(), and zypp::ProgressData::toMin().
Referenced by buildCache(), zypp::misc::defaultLoadSystem(), loadFromCache(), and removeRepository().
bool zypp::RepoManager::isCached | ( | const RepoInfo & | info | ) | const |
Whether a repository exists in cache.
RepoInfo | to be checked. |
Definition at line 1338 of file RepoManager.cc.
References _pimpl, and zypp::solv_path_for_repoinfo().
Referenced by buildCache(), zypp::misc::defaultLoadSystem(), and removeRepository().
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
repo::RepoNoAliasException | if can't figure an alias to look in cache | |
RepoNotCachedException | When the source is not cached. |
Definition at line 1360 of file RepoManager.cc.
References _pimpl, zypp::assert_alias(), zypp::sat::LookupAttr::begin(), buildCache(), BuildIfNeeded, cleanCache(), zypp::Repository::eraseFromPool(), zypp::sat::Pool::instance(), MIL, zypp::sat::SolvAttr::repositoryToolVersion, zypp::solv_path_for_repoinfo(), ZYPP_CAUGHT, and ZYPP_THROW.
Referenced by zypp::misc::defaultLoadSystem().
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 1276 of file RepoManager.cc.
References _, _pimpl, for_, zypp::str::form(), MIL, zypp::filesystem::readdir(), zypp::filesystem::recursive_rmdir(), repoBegin(), repoEnd(), zypp::ProgressData::sendTo(), zypp::ProgressData::set(), zypp::ProgressData::toMax(), zypp::ProgressData::toMin(), zypp::ProgressData::val(), and ZYPP_THROW.
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 1190 of file RepoManager.cc.
References _, zypp::Url::asString(), DBG, zypp::MediaSetAccess::doesFileExist(), zypp::str::form(), zypp::Url::getPathName(), zypp::Url::getScheme(), MIL, zypp::repo::RepoType::NONE, zypp::Exception::remember(), zypp::repo::RepoType::RPMMD, zypp::repo::RepoType::RPMPLAINDIR, zypp::Url::schemeIsDownloading(), zypp::repo::RepoType::YAST2, ZYPP_CAUGHT, and ZYPP_THROW.
Referenced by addRepository(), buildCache(), checkIfToRefreshMetadata(), metadataStatus(), probe(), refreshMetadata(), and touchIndexFile().
repo::RepoType zypp::RepoManager::probe | ( | const Url & | url | ) | const |
void zypp::RepoManager::addRepository | ( | const RepoInfo & | info, | |
const ProgressData::ReceiverFnc & | progressrcv = ProgressData::ReceiverFnc() | |||
) |
Adds a repository to the list of known repositories.
repo::RepoAlreadyExistsException | If the repo clash some unique attribute like alias | |
RepoUnknownType | If RepoManagerOptions::probe is true and repository type can't be determined. | |
RepoException | If RepoManagerOptions::probe is true and access to the url fails. | |
Exception | On other errors. |
Definition at line 1400 of file RepoManager.cc.
References _, _pimpl, zypp::assert_alias(), zypp::filesystem::assert_dir(), zypp::RepoInfo::baseUrlsBegin(), zypp::RepoInfo::baseUrlsEnd(), zypp::RepoInfo::baseUrlsSize(), DBG, zypp::RepoInfo::dumpAsIniOn(), for_, zypp::str::form(), zypp::repo::RepoInfoBase::label(), metadataPath(), MIL, zypp::ProgressData::name(), packagesPath(), zypp::RepoInfo::path(), probe(), report, zypp::media::CredentialManager::saveInUser(), zypp::ProgressData::sendTo(), zypp::ProgressData::set(), zypp::repo::RepoInfoBase::setFilepath(), zypp::RepoInfo::setMetadataPath(), zypp::RepoInfo::setPackagesPath(), zypp::RepoInfo::setType(), zypp::ProgressData::toMax(), zypp::ProgressData::toMin(), and ZYPP_THROW.
Referenced by refreshService().
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.
repo::RepoAlreadyExistsException | If the repo clash some unique attribute like alias | |
MediaException | If the access to the url fails | |
ParseException | If the file parsing fails | |
RepoUnknownType | If repository type can't be determined | |
RepoException | ON other repository related errors | |
Exception | On other errors. |
Definition at line 1491 of file RepoManager.cc.
References _, _pimpl, zypp::filesystem::assert_dir(), zypp::Url::asString(), ERR, for_, zypp::str::form(), zypp::Url::getPathName(), MIL, zypp::readRepoFile(), repoBegin(), repoEnd(), and ZYPP_THROW.
void zypp::RepoManager::removeRepository | ( | const RepoInfo & | info, | |
const ProgressData::ReceiverFnc & | progressrcv = ProgressData::ReceiverFnc() | |||
) |
Remove the best matching repository from known repos list.
RepoNotFoundException | If no repo match |
Definition at line 1549 of file RepoManager.cc.
References _, _pimpl, zypp::repo::RepoInfoBase::alias(), zypp::filesystem::assert_dir(), cleanCache(), cleanMetadata(), zypp::repo::RepoInfoBase::filepath(), for_, zypp::str::form(), isCached(), zypp::repo::RepoInfoBase::label(), MIL, zypp::ProgressData::name(), repoBegin(), repoEnd(), report, zypp::repositories_in_file(), zypp::ProgressData::sendTo(), zypp::filesystem::unlink(), and ZYPP_THROW.
Referenced by refreshService(), and removeService().
void zypp::RepoManager::modifyRepository | ( | const std::string & | alias, | |
const RepoInfo & | newinfo, | |||
const ProgressData::ReceiverFnc & | progressrcv = ProgressData::ReceiverFnc() | |||
) |
Modify repository attributes.
RepoAlreadyExistsException | if the alias specified in newinfo is already used by another repository | |
RepoNotFoundException | If no repo match | |
ParseException | If the file parsing fails | |
Exception | On other errors. |
Definition at line 1635 of file RepoManager.cc.
References _, _pimpl, zypp::repo::RepoInfoBase::alias(), zypp::filesystem::assert_dir(), zypp::RepoInfo::dumpAsIniOn(), zypp::repo::RepoInfoBase::filepath(), zypp::str::form(), getRepositoryInfo(), hasRepo(), MIL, zypp::repositories_in_file(), zypp::repo::RepoInfoBase::setFilepath(), and ZYPP_THROW.
Referenced by modifyService(), refreshMetadata(), and refreshService().
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 464 of file RepoManager.h.
References zypp::repo::RepoInfoBase::alias(), and modifyRepository().
Referenced by modifyRepository().
RepoInfo zypp::RepoManager::getRepositoryInfo | ( | const std::string & | alias, | |
const ProgressData::ReceiverFnc & | progressrcv = ProgressData::ReceiverFnc() | |||
) |
Find a matching repository info.
alias | Repository alias | |
progressrcv | Progress reporting function |
RepoNotFoundException | If no repo match the alias | |
ParseException | If the file parsing fails | |
Exception | On other errors. |
Definition at line 1693 of file RepoManager.cc.
References _pimpl, repoEnd(), zypp::repo::RepoInfoBase::setAlias(), and ZYPP_THROW.
Referenced by modifyRepository().
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.
url | URL to find. | |
urlview | url::ViewOption to influence URL matching. | |
progressrcv | Progress receiver function. |
the string representation of the URLs are compared. The urlview can be used to influence which parts of the URL are to be compared.
RepoNotFoundException | If no repo match | |
ParseException | If the file parsing fails | |
Exception | On other errors. |
Definition at line 1707 of file RepoManager.cc.
References zypp::Url::asString(), for_, repoBegin(), repoEnd(), zypp::RepoInfo::setBaseUrl(), and ZYPP_THROW.
bool zypp::RepoManager::serviceEmpty | ( | ) | const |
Gets true if no service is in RepoManager (so no one in specified location).
Definition at line 1732 of file RepoManager.cc.
References _pimpl.
RepoManager::ServiceSizeType zypp::RepoManager::serviceSize | ( | ) | const |
Gets count of service in RepoManager (in specified location).
Definition at line 1735 of file RepoManager.cc.
References _pimpl.
RepoManager::ServiceConstIterator zypp::RepoManager::serviceBegin | ( | ) | const |
Iterator to first service in internal storage.
Definition at line 1738 of file RepoManager.cc.
References _pimpl.
Referenced by getService(), hasService(), knownServices(), and refreshServices().
RepoManager::ServiceConstIterator zypp::RepoManager::serviceEnd | ( | ) | const |
Iterator to place behind last service in internal storage.
Definition at line 1741 of file RepoManager.cc.
References _pimpl.
Referenced by getService(), hasService(), knownServices(), and refreshServices().
std::list<ServiceInfo> zypp::RepoManager::knownServices | ( | ) | const [inline] |
List of known services.
Definition at line 543 of file RepoManager.h.
References serviceBegin(), and serviceEnd().
ServiceInfo zypp::RepoManager::getService | ( | const std::string & | alias | ) | const |
Finds ServiceInfo by alias or return ServiceInfo::noService.
alias | unique identifier of service |
Definition at line 1744 of file RepoManager.cc.
References for_, zypp::ServiceInfo::noService, serviceBegin(), and serviceEnd().
Referenced by modifyService(), refreshService(), and removeService().
bool zypp::RepoManager::hasService | ( | const std::string & | alias | ) | const |
Return whether there is a known service for alias
.
Definition at line 1752 of file RepoManager.cc.
References for_, serviceBegin(), and serviceEnd().
Referenced by addService().
repo::ServiceType zypp::RepoManager::probeService | ( | const Url & | url | ) | const |
Probe the type or the service.
Definition at line 2166 of file RepoManager.cc.
References _, zypp::Url::asString(), zypp::MediaSetAccess::doesFileExist(), zypp::str::form(), zypp::repo::ServiceType::NONE, zypp::Exception::remember(), zypp::repo::ServiceType::RIS, ZYPP_CAUGHT, and ZYPP_THROW.
Referenced by refreshService().
void zypp::RepoManager::addService | ( | const std::string & | alias, | |
const Url & | url | |||
) |
Adds new service by it's alias and url.
FIXME | RepoAlreadyExistException and as reponame is service name |
Definition at line 1762 of file RepoManager.cc.
void zypp::RepoManager::addService | ( | const ServiceInfo & | service | ) |
Adds new service.
service | service info |
FIXME | RepoAlreadyExistException and as reponame is service name |
Definition at line 1767 of file RepoManager.cc.
References _pimpl, zypp::repo::RepoInfoBase::alias(), zypp::assert_alias(), zypp::Url::hasCredentialsInAuthority(), hasService(), MIL, zypp::media::CredentialManager::saveInUser(), zypp::ServiceInfo::url(), and ZYPP_THROW.
void zypp::RepoManager::removeService | ( | const std::string & | alias | ) |
Removes service specified by its name.
alias | unique indientifier of the service to remove |
RepoException | if service is not found or file with ServiceInfo cannot be deleted | |
Exception | if file contain more services and rewrite file failed |
Definition at line 1796 of file RepoManager.cc.
References _, zypp::filesystem::assert_dir(), zypp::RepoCollector::collect(), zypp::repo::RepoInfoBase::filepath(), for_, zypp::str::form(), getRepositoriesInService(), getService(), MIL, removeRepository(), zypp::RepoCollector::repos, zypp::filesystem::unlink(), and ZYPP_THROW.
Referenced by removeService().
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 1851 of file RepoManager.cc.
References zypp::repo::RepoInfoBase::alias(), and removeService().
void zypp::RepoManager::refreshServices | ( | ) |
Refreshes all enabled services.
Definition at line 1856 of file RepoManager.cc.
References for_, refreshService(), serviceBegin(), and serviceEnd().
void zypp::RepoManager::refreshService | ( | const std::string & | alias | ) |
Refresh specific service.
alias | unique indientifier of the service to refresh |
RepoException | if service is not found. | |
MediaException | If there's a problem downloading the repo index file. |
Definition at line 1877 of file RepoManager.cc.
References _pimpl, addRepository(), zypp::ServiceInfo::addRepoToEnable(), zypp::repo::RepoInfoBase::alias(), zypp::assert_alias(), zypp::assert_url(), zypp::ServiceInfo::clearReposToDisable(), zypp::RepoCollector::collect(), DBG, zypp::ServiceInfo::delRepoToEnable(), for_, zypp::str::form(), zypp::Url::getPathName(), getRepositoriesInService(), getService(), MIL, modifyRepository(), modifyService(), zypp::repo::ServiceType::NONE, probeService(), removeRepository(), zypp::RepoCollector::repos, zypp::ServiceInfo::reposToDisableEmpty(), zypp::ServiceInfo::repoToDisableFind(), zypp::ServiceInfo::repoToEnableFind(), zypp::Url::setPathName(), zypp::ServiceInfo::setProbedType(), zypp::Target::targetDistribution(), zypp::ServiceInfo::type(), url, and zypp::ServiceInfo::url().
Referenced by refreshService(), and refreshServices().
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 1874 of file RepoManager.cc.
References zypp::repo::RepoInfoBase::alias(), and refreshService().
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.
oldAlias | Old alias of the service | |
service | ServiceInfo object containing new data |
RepoException | if sservice with oldAlias is not known | |
Exception | if have problems with files |
how to know the service needs a (auto) refresh????
Definition at line 2099 of file RepoManager.cc.
References _, _pimpl, zypp::repo::RepoInfoBase::alias(), zypp::filesystem::assert_dir(), zypp::ServiceInfo::dumpAsIniOn(), zypp::repo::RepoInfoBase::enabled(), zypp::repo::RepoInfoBase::filepath(), for_, getRepositoriesInService(), getService(), MIL, modifyRepository(), zypp::repo::RepoInfoBase::setFilepath(), zypp::ServiceInfo::type(), and ZYPP_THROW.
Referenced by refreshService().
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 632 of file RepoManager.h.
References zypp::repo::RepoInfoBase::alias(), and modifyService().
Referenced by modifyService().
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.
alias | service alias | |
out | output iterator which get all the repositories belonging to specified 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); getRepositoriesInService(name, boost::make_function_output_iterator( bind(&ChangePriority::doIt, &changer, _1)));
Definition at line 684 of file RepoManager.h.
References zypp::iostr::copy(), repoBegin(), and repoEnd().
Referenced by modifyService(), refreshService(), and removeService().
RepoStatus zypp::RepoManager::rawMetadataStatus | ( | const RepoInfo & | info | ) | [protected] |
void zypp::RepoManager::setCacheStatus | ( | const RepoInfo & | info, | |
const RepoStatus & | status | |||
) | [protected] |
Definition at line 1351 of file RepoManager.cc.
References _pimpl, zypp::filesystem::assert_dir(), zypp::RepoStatus::saveToCookieFile(), and zypp::solv_path_for_repoinfo().
Referenced by buildCache().
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 705 of file RepoManager.cc.
References _pimpl, probe(), zypp::rawproductdata_path_for_repoinfo(), zypp::repo::RepoType::toEnum(), zypp::filesystem::touch(), and zypp::RepoInfo::type().
Referenced by checkIfToRefreshMetadata().
std::ostream & operator<< | ( | std::ostream & | str, | |
const RepoManager & | obj | |||
) | [friend] |
Stream output
Definition at line 2196 of file RepoManager.cc.
RWCOW_pointer<Impl> zypp::RepoManager::_pimpl [private] |
Pointer to implementation.
Definition at line 708 of file RepoManager.h.
Referenced by addRepositories(), addRepository(), addService(), buildCache(), cacheStatus(), checkIfToRefreshMetadata(), cleanCache(), cleanCacheDirGarbage(), cleanMetadata(), cleanPackages(), getRepositoryInfo(), isCached(), loadFromCache(), metadataPath(), metadataStatus(), modifyRepository(), modifyService(), zypp::operator<<(), packagesPath(), refreshMetadata(), refreshService(), removeRepository(), repoBegin(), repoEmpty(), repoEnd(), repoSize(), serviceBegin(), serviceEmpty(), serviceEnd(), serviceSize(), setCacheStatus(), and touchIndexFile().