#include <TargetImpl.h>
Solv file handling. | |
If target solv file is outdated, but (non-root-)user has no permission to create it at the default location, we use a temporary one. | |
Pathname | _tmpSolvfilesPath |
void | load () |
void | unload () |
void | clearCache () |
void | buildCache () |
Pathname | defaultSolvfilesPath () const |
The systems default solv file location. | |
Pathname | solvfilesPath () const |
The solv file location actually in use (default or temp). | |
bool | solvfilesPathIsTemp () const |
Whether we're using a temp. | |
Public Types | |
typedef std::list< PoolItem > | PoolItemList |
list of pool items | |
typedef std::set< PoolItem > | PoolItemSet |
set of pool items | |
Public Member Functions | |
TargetImpl (const Pathname &root_r="/", bool doRebuild_r=false) | |
Ctor. | |
virtual | ~TargetImpl () |
Dtor. | |
void | createAnonymousId () const |
generates the unique anonymous id which is called when creating the target | |
void | createLastDistributionFlavorCache () const |
generates a cache of the last product flavor | |
Pathname | root () const |
The root set for this target. | |
Pathname | home () const |
The directory to store things. | |
ZYppCommitResult | commit (ResPool pool_r, const ZYppCommitPolicy &policy_r) |
Commit changes in the pool. | |
void | installSrcPackage (const SrcPackage_constPtr &srcPackage_r) |
Install a source package on the Target. | |
virtual std::ostream & | dumpOn (std::ostream &str) const |
Overload to realize stream output. | |
rpm::RpmDb & | rpm () |
The RPM database. | |
bool | providesFile (const std::string &path_str, const std::string &name_str) const |
If the package is installed and provides the file Needed to evaluate split provides during Resolver::Upgrade(). | |
std::string | whoOwnsFile (const std::string &path_str) const |
Return name of package owning path_str or empty string if no installed package owns path_str. | |
Date | timestamp () const |
return the last modification date of the target | |
Product::constPtr | baseProduct () const |
std::string | targetDistribution () const |
std::string | targetDistributionRelease () const |
Target::DistributionLabel | distributionLabel () const |
std::string | distributionVersion () const |
std::string | distributionFlavor () const |
std::string | anonymousUniqueId () const |
Static Public Member Functions | |
static TargetImpl_Ptr | nullimpl () |
Null implementation. | |
static std::string | targetDistribution (const Pathname &root_r) |
static std::string | targetDistributionRelease (const Pathname &root_r) |
static Target::DistributionLabel | distributionLabel (const Pathname &root_r) |
static std::string | distributionVersion (const Pathname &root_r) |
static std::string | distributionFlavor (const Pathname &root_r) |
static std::string | anonymousUniqueId (const Pathname &root_r) |
Protected Attributes | |
Pathname | _root |
Path to the target. | |
rpm::RpmDb | _rpm |
RPM database. | |
RequestedLocalesFile | _requestedLocalesFile |
Requested Locales database. | |
SoftLocksFile | _softLocksFile |
Soft-locks database. | |
HardLocksFile | _hardLocksFile |
Hard-Locks database. | |
std::string | _distributionVersion |
Cache distributionVersion. | |
Private Member Functions | |
void | commit (const ZYppCommitPolicy &policy_r, CommitPackageCache &packageCache_r, ZYppCommitResult &result_r) |
Commit ordered changes (internal helper). | |
Static Private Attributes | |
static TargetImpl_Ptr | _nullimpl |
Null implementation. | |
Friends | |
std::ostream & | operator<< (std::ostream &str, const TargetImpl &obj) |
Constructed by TargetFactory. Public access via Target interface.
Definition at line 52 of file TargetImpl.h.
typedef std::list<PoolItem> zypp::target::TargetImpl::PoolItemList |
typedef std::set<PoolItem> zypp::target::TargetImpl::PoolItemSet |
zypp::target::TargetImpl::TargetImpl | ( | const Pathname & | root_r = "/" , |
|
bool | doRebuild_r = false | |||
) |
Ctor.
Definition at line 673 of file TargetImpl.cc.
References _root, _rpm, createAnonymousId(), zypp::target::rpm::RpmDb::initDatabase(), MIL, and zypp::HistoryLog::setRoot().
zypp::target::TargetImpl::~TargetImpl | ( | ) | [virtual] |
Dtor.
Definition at line 817 of file TargetImpl.cc.
References _rpm, zypp::target::rpm::RpmDb::closeDatabase(), and MIL.
TargetImpl_Ptr zypp::target::TargetImpl::nullimpl | ( | ) | [static] |
Null implementation.
Definition at line 661 of file TargetImpl.cc.
References _nullimpl.
Referenced by zypp::Target::nullimpl().
void zypp::target::TargetImpl::createAnonymousId | ( | ) | const |
generates the unique anonymous id which is called when creating the target
Definition at line 761 of file TargetImpl.cc.
References zypp::target::fileMissing(), zypp::target::generateRandomId(), home(), zypp::target::updateFileContent(), and WAR.
Referenced by TargetImpl().
void zypp::target::TargetImpl::createLastDistributionFlavorCache | ( | ) | const |
generates a cache of the last product flavor
Definition at line 781 of file TargetImpl.cc.
References baseProduct(), home(), zypp::target::updateFileContent(), and WAR.
Referenced by load().
Pathname zypp::target::TargetImpl::defaultSolvfilesPath | ( | ) | const [private] |
The systems default solv file location.
Definition at line 829 of file TargetImpl.cc.
References _root, zypp::sat::Pool::instance(), and zypp::ZConfig::instance().
Referenced by solvfilesPath().
Pathname zypp::target::TargetImpl::solvfilesPath | ( | ) | const [inline, private] |
The solv file location actually in use (default or temp).
Definition at line 94 of file TargetImpl.h.
References _tmpSolvfilesPath, defaultSolvfilesPath(), and solvfilesPathIsTemp().
Referenced by buildCache(), clearCache(), and load().
bool zypp::target::TargetImpl::solvfilesPathIsTemp | ( | ) | const [inline, private] |
Whether we're using a temp.
solvfile.
Definition at line 98 of file TargetImpl.h.
References _tmpSolvfilesPath.
Referenced by buildCache(), and solvfilesPath().
void zypp::target::TargetImpl::load | ( | ) |
Definition at line 990 of file TargetImpl.cc.
References _hardLocksFile, _requestedLocalesFile, _softLocksFile, zypp::Repository::addSolv(), buildCache(), clearCache(), createLastDistributionFlavorCache(), zypp::target::HardLocksFile::data(), zypp::target::SoftLocksFile::data(), zypp::Repository::eraseFromPool(), for_, zypp::ZConfig::instance(), zypp::ResPool::instance(), zypp::sat::Pool::instance(), zypp::target::RequestedLocalesFile::locales(), MIL, zypp::ResPool::setAutoSoftLocks(), zypp::ResPool::setHardLockQueries(), zypp::sat::Pool::setRequestedLocales(), zypp::Repository::solvablesBegin(), zypp::Repository::solvablesEmpty(), zypp::Repository::solvablesEnd(), zypp::Repository::solvablesSize(), solvfilesPath(), zypp::sat::Pool::systemRepo(), zypp::sat::Pool::systemRepoAlias(), and ZYPP_CAUGHT.
void zypp::target::TargetImpl::unload | ( | ) |
Definition at line 982 of file TargetImpl.cc.
References zypp::Repository::eraseFromPool(), and zypp::sat::Pool::instance().
void zypp::target::TargetImpl::clearCache | ( | ) |
Definition at line 834 of file TargetImpl.cc.
References zypp::filesystem::recursive_rmdir(), and solvfilesPath().
Referenced by load().
void zypp::target::TargetImpl::buildCache | ( | ) |
Definition at line 840 of file TargetImpl.cc.
References _root, _tmpSolvfilesPath, zypp::filesystem::assert_dir(), zypp::Exception::asUserHistory(), zypp::RepoStatus::checksum(), zypp::filesystem::chmod(), zypp::str::form(), zypp::RepoStatus::fromCookieFile(), zypp::ZConfig::instance(), zypp::sat::Pool::instance(), zypp::filesystem::TmpFile::makeSibling(), MIL, zypp::PluginScript::open(), zypp::filesystem::TmpPath::path(), zypp::PluginScript::receive(), zypp::filesystem::recursive_rmdir(), zypp::Exception::remember(), zypp::filesystem::rename(), zypp::AutoDispose< _Tp >::resetDispose(), zypp::RepoStatus::saveToCookieFile(), zypp::PluginScript::send(), solvfilesPath(), solvfilesPathIsTemp(), zypp::ExternalProgram::Stderr_To_Stdout, WAR, and ZYPP_THROW.
Pathname zypp::target::TargetImpl::root | ( | ) | const [inline] |
The root set for this target.
Definition at line 116 of file TargetImpl.h.
References _root.
Referenced by commit(), and distributionVersion().
Pathname zypp::target::TargetImpl::home | ( | ) | const [inline] |
The directory to store things.
Definition at line 120 of file TargetImpl.h.
References _root.
Referenced by anonymousUniqueId(), commit(), createAnonymousId(), createLastDistributionFlavorCache(), and distributionFlavor().
ZYppCommitResult zypp::target::TargetImpl::commit | ( | ResPool | pool_r, | |
const ZYppCommitPolicy & | policy_r | |||
) |
Commit changes in the pool.
Definition at line 1068 of file TargetImpl.cc.
References _hardLocksFile, _requestedLocalesFile, _root, _softLocksFile, zypp::ZYppCommitPolicy::allMedia(), zypp::filesystem::assert_dir(), zypp::sat::Transaction::begin(), buildCache(), DBG, zypp::DownloadAsNeeded, zypp::DownloadDefault, zypp::DownloadInHeaps, zypp::ZYppCommitPolicy::downloadMode(), zypp::DownloadOnly, zypp::ZYppCommitPolicy::dryRun(), zypp::sat::Transaction::end(), ERR, zypp::HistoryLog::fname(), for_, zypp::target::CommitPackageCache::get(), zypp::ResPool::getActiveSoftLocks(), zypp::ResPool::getHardLockQueries(), zypp::ResPool::getRequestedLocales(), zypp::Resolver::getTransaction(), home(), zypp::ZConfig::instance(), INT, zypp::ResStatus::isToBeInstalled(), zypp::target::CommitPlugins::load(), zypp::makeResObject(), MIL, N_, zypp::sat::Transaction::order(), zypp::repo::SrcPackageProvider::provideSrcPackage(), report, zypp::AutoDispose< _Tp >::resetDispose(), zypp::PoolItem::resolvable(), zypp::ResPool::resolver(), zypp::ZYppCommitPolicy::restrictToMedia(), root(), zypp::ZYppCommitResult::rTransaction(), zypp::ZYppCommitResult::rTransactionStepList(), zypp::target::CommitPackageCache::setCommitList(), zypp::target::HardLocksFile::setData(), zypp::target::SoftLocksFile::setData(), zypp::target::RequestedLocalesFile::setLocales(), zypp::PoolItem::status(), zypp::sat::Transaction::STEP_DONE, zypp::sat::Transaction::STEP_ERROR, zypp::sat::Transaction::STEP_TODO, zypp::ZYppCommitResult::transaction(), zypp::sat::Transaction::TRANSACTION_ERASE, zypp::sat::Transaction::TRANSACTION_IGNORE, zypp::sat::Transaction::TRANSACTION_INSTALL, zypp::sat::Transaction::TRANSACTION_MULTIINSTALL, WAR, zypp::target::writeUpgradeTestcase(), ZYPP_CAUGHT, and ZYPP_THROW.
void zypp::target::TargetImpl::installSrcPackage | ( | const SrcPackage_constPtr & | srcPackage_r | ) |
Install a source package on the Target.
Definition at line 1792 of file TargetImpl.cc.
References zypp::target::rpm::RpmDb::installPackage(), zypp::repo::SrcPackageProvider::provideSrcPackage(), and rpm().
Referenced by commit().
virtual std::ostream& zypp::target::TargetImpl::dumpOn | ( | std::ostream & | str | ) | const [inline, virtual] |
Overload to realize stream output.
Reimplemented from zypp::base::ReferenceCounted.
Definition at line 130 of file TargetImpl.h.
rpm::RpmDb & zypp::target::TargetImpl::rpm | ( | ) |
The RPM database.
Definition at line 1620 of file TargetImpl.cc.
References _rpm.
Referenced by commit(), and installSrcPackage().
bool zypp::target::TargetImpl::providesFile | ( | const std::string & | path_str, | |
const std::string & | name_str | |||
) | const |
If the package is installed and provides the file Needed to evaluate split provides during Resolver::Upgrade().
Definition at line 1625 of file TargetImpl.cc.
References _rpm, and zypp::target::rpm::RpmDb::hasFile().
std::string zypp::target::TargetImpl::whoOwnsFile | ( | const std::string & | path_str | ) | const [inline] |
Return name of package owning path_str or empty string if no installed package owns path_str.
Definition at line 144 of file TargetImpl.h.
References _rpm, and zypp::target::rpm::RpmDb::whoOwnsFile().
Date zypp::target::TargetImpl::timestamp | ( | ) | const |
return the last modification date of the target
Definition at line 1631 of file TargetImpl.cc.
References _rpm, and zypp::target::rpm::RpmDb::timestamp().
Product::constPtr zypp::target::TargetImpl::baseProduct | ( | ) | const |
returns the target base installed product, also known as the distribution or platform.
returns 0 if there is no base installed product in the pool.
Definition at line 1638 of file TargetImpl.cc.
References zypp::ResPool::byKindBegin(), zypp::ResPool::byKindEnd(), for_, and zypp::ResPool::instance().
Referenced by createLastDistributionFlavorCache().
std::string zypp::target::TargetImpl::targetDistribution | ( | ) | const |
This is register.target
attribute of the installed base product.
Used for registration and Service refresh.
Definition at line 1697 of file TargetImpl.cc.
References _root, zypp::target::baseproductdata(), and zypp::parser::ProductFileData::registerTarget().
Referenced by zypp::Target::targetDistribution().
std::string zypp::target::TargetImpl::targetDistribution | ( | const Pathname & | root_r | ) | [static] |
Definition at line 1700 of file TargetImpl.cc.
References zypp::target::baseproductdata(), zypp::parser::ProductFileData::registerTarget(), and zypp::target::staticGuessRoot().
std::string zypp::target::TargetImpl::targetDistributionRelease | ( | ) | const |
This is register.release
attribute of the installed base product.
Used for registration.
Definition at line 1703 of file TargetImpl.cc.
References _root, zypp::target::baseproductdata(), and zypp::parser::ProductFileData::registerRelease().
Referenced by zypp::Target::targetDistributionRelease().
std::string zypp::target::TargetImpl::targetDistributionRelease | ( | const Pathname & | root_r | ) | [static] |
Definition at line 1706 of file TargetImpl.cc.
References zypp::target::baseproductdata(), zypp::parser::ProductFileData::registerRelease(), and zypp::target::staticGuessRoot().
Target::DistributionLabel zypp::target::TargetImpl::distributionLabel | ( | ) | const |
This is version
attribute of the installed base product.
For example http://download.opensue.org/update/11.0 The 11.0 corresponds to the base product version.
Definition at line 1709 of file TargetImpl.cc.
References _root, zypp::target::baseproductdata(), zypp::parser::ProductFileData::shortName(), zypp::Target::DistributionLabel::shortName, zypp::parser::ProductFileData::summary(), and zypp::Target::DistributionLabel::summary.
Referenced by zypp::Target::distributionLabel().
Target::DistributionLabel zypp::target::TargetImpl::distributionLabel | ( | const Pathname & | root_r | ) | [static] |
std::string zypp::target::TargetImpl::distributionVersion | ( | ) | const |
This is version
attribute of the installed base product.
For example http://download.opensue.org/update/11.0 The 11.0 corresponds to the base product version.
Definition at line 1727 of file TargetImpl.cc.
References _distributionVersion, MIL, and root().
Referenced by distributionVersion(), and zypp::Target::distributionVersion().
std::string zypp::target::TargetImpl::distributionVersion | ( | const Pathname & | root_r | ) | [static] |
Definition at line 1738 of file TargetImpl.cc.
References zypp::target::baseproductdata(), distributionVersion(), zypp::ZConfig::distroverpkg(), zypp::parser::ProductFileData::edition(), zypp::target::rpm::librpmDb::db_const_iterator::findByProvides(), zypp::ZConfig::instance(), zypp::target::staticGuessRoot(), zypp::ZConfig::systemRoot(), and zypp::Edition::version().
std::string zypp::target::TargetImpl::distributionFlavor | ( | ) | const |
This is flavor
attribute of the installed base product but does not require the target to be loaded as it remembers the last used one.
It can be empty is the target has never been loaded, as the value is not present in the system but computer from a package provides
Definition at line 1768 of file TargetImpl.cc.
References zypp::target::firstNonEmptyLineIn(), and home().
Referenced by zypp::Target::distributionFlavor().
std::string zypp::target::TargetImpl::distributionFlavor | ( | const Pathname & | root_r | ) | [static] |
Definition at line 1773 of file TargetImpl.cc.
References zypp::target::firstNonEmptyLineIn(), and zypp::target::staticGuessRoot().
std::string zypp::target::TargetImpl::anonymousUniqueId | ( | ) | const |
anonymous unique id
This id is generated once and stays in the saved in the target. It is unique and is used only for statistics.
Definition at line 1780 of file TargetImpl.cc.
References zypp::target::firstNonEmptyLineIn(), and home().
Referenced by zypp::Target::anonymousUniqueId().
std::string zypp::target::TargetImpl::anonymousUniqueId | ( | const Pathname & | root_r | ) | [static] |
Definition at line 1785 of file TargetImpl.cc.
References zypp::target::firstNonEmptyLineIn(), and zypp::target::staticGuessRoot().
void zypp::target::TargetImpl::commit | ( | const ZYppCommitPolicy & | policy_r, | |
CommitPackageCache & | packageCache_r, | |||
ZYppCommitResult & | result_r | |||
) | [private] |
Commit ordered changes (internal helper).
Definition at line 1366 of file TargetImpl.cc.
References _root, zypp::PoolItem::buddy(), zypp::ZYppCommitPolicy::dryRun(), ERR, for_, zypp::target::CommitPackageCache::get(), zypp::target::rpm::RpmDb::installPackage(), installSrcPackage(), zypp::ZConfig::instance(), INT, zypp::ResStatus::isToBeInstalled(), MIL, N_, zypp::target::rpm::RpmDb::removePackage(), zypp::AutoDispose< _Tp >::resetDispose(), zypp::ResStatus::resetTransact(), zypp::PoolItem::resolvable(), rpm(), zypp::target::rpm::InstallResolvableReport::RPM_NODEPS_FORCE, zypp::ZYppCommitPolicy::rpmExcludeDocs(), zypp::target::rpm::RPMINST_EXCLUDEDOCS, zypp::target::rpm::RPMINST_FORCE, zypp::target::rpm::RPMINST_JUSTDB, zypp::target::rpm::RPMINST_NODEPS, zypp::target::rpm::RPMINST_NOSIGNATURE, zypp::target::rpm::RPMINST_NOUPGRADE, zypp::target::rpm::RPMINST_TEST, zypp::ZYppCommitPolicy::rpmInstFlags(), zypp::ZYppCommitPolicy::rpmNoSignature(), zypp::ZYppCommitResult::rTransactionStepList(), zypp::target::RunUpdateMessages(), zypp::target::RunUpdateScripts(), zypp::PoolItem::satSolvable(), zypp::PoolItem::status(), zypp::sat::Transaction::STEP_DONE, zypp::sat::Transaction::STEP_ERROR, zypp::sat::Transaction::TRANSACTION_IGNORE, zypp::filesystem::unlink(), zypp::ResStatus::USER, WAR, ZYPP_CAUGHT, and ZYPP_THROW.
std::ostream & operator<< | ( | std::ostream & | str, | |
const TargetImpl & | obj | |||
) | [friend] |
Stream output
Definition at line 211 of file TargetImpl.h.
Pathname zypp::target::TargetImpl::_tmpSolvfilesPath [private] |
Definition at line 101 of file TargetImpl.h.
Referenced by buildCache(), solvfilesPath(), and solvfilesPathIsTemp().
Pathname zypp::target::TargetImpl::_root [protected] |
Path to the target.
Definition at line 192 of file TargetImpl.h.
Referenced by buildCache(), commit(), defaultSolvfilesPath(), distributionLabel(), home(), root(), targetDistribution(), targetDistributionRelease(), and TargetImpl().
rpm::RpmDb zypp::target::TargetImpl::_rpm [protected] |
RPM database.
Definition at line 194 of file TargetImpl.h.
Referenced by providesFile(), rpm(), TargetImpl(), timestamp(), whoOwnsFile(), and ~TargetImpl().
std::string zypp::target::TargetImpl::_distributionVersion [mutable, protected] |
Cache distributionVersion.
Definition at line 202 of file TargetImpl.h.
Referenced by distributionVersion().
TargetImpl_Ptr zypp::target::TargetImpl::_nullimpl [static, private] |