libzypp 17.37.10

zypp::Target Class Reference

`#include <zypp/Target.h>`

Inheritance diagram for zypp::Target:

## Classes
struct | DistributionLabel

## Public Types
using | Impl = target::TargetImpl
using | Impl_Ptr = intrusive_ptr<Impl>
using | PoolItemList = std::list<PoolItem>

## Public Member Functions
void | buildCache ()
| builds or refreshes the target cache
void | cleanCache ()
| cleans the target cache (.solv files)
void | load ()
| load resolvables into the pool
void | reload ()
void | unload ()
| unload target resolvables from the pool
target::rpm::RpmDb & | rpmDb ()
| Refference to the RPM database.
bool | providesFile (const std::string &name_str, const std::string &path_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.
Pathname | root () const
| Return the root set for this target.
bool | chrooted () const
| Whether the targets root is not `"/"`.
Pathname | assertRootPrefix (const Pathname &path_r) const
| Return the path prefixed by the target root, unless it already is prefixed.
Product::constPtr | baseProduct () const
| returns the target base installed product, also known as the distribution or platform.
LocaleSet | requestedLocales () const
| Languages to be supported by the system.
void | updateAutoInstalled ()
| Update the database of autoinstalled packages.
Public Member Functions inherited from zypp::base::ReferenceCounted
| ReferenceCounted ()
| Default ctor.
| ReferenceCounted (const ReferenceCounted &rhs)
| Copy ctor.
virtual | ~ReferenceCounted ()
| Dtor.
ReferenceCounted & | operator= (const ReferenceCounted &)
| Assignment.
unsigned | refCount () const
| Return reference counter value.
void | ref () const
| Add a reference.
void | unref () const
| Release a reference.

## Static Public Member Functions
static LocaleSet | requestedLocales (const Pathname &root_r)
Static Public Member Functions inherited from zypp::base::ReferenceCounted
static void | add_ref (const ReferenceCounted *ptr_r)
| Called by zypp::intrusive_ptr to add a reference.
static void | release (const ReferenceCounted *ptr_r)
| Called by zypp::intrusive_ptr to add a reference.

## Related Symbols
(Note that these are not member symbols.)
std::ostream & | operator<< (std::ostream &str, const Target &obj)
| Stream output.
std::ostream & | operator<< (std::ostream &str, const Target::DistributionLabel &obj)
| Stream output.
Related Symbols inherited from zypp::base::ReferenceCounted
void | intrusive_ptr_add_ref (const ReferenceCounted *ptr_r)
| intrusive_ptr hook to add_ref.
void | intrusive_ptr_release (const ReferenceCounted *ptr_r)
| intrusive_ptr hook to release.
std::ostream & | operator<< (std::ostream &str, const ReferenceCounted &obj)
| Stream output.

## Definition of vendor equivalence.
See also VendorAttr
class | zypp_detail::ZYppImpl
| Direct access to Impl.
std::ostream & | operator<< (std::ostream &str, const Target &obj)
RW_pointer< Impl, rw_pointer::Intrusive< Impl > > | _pimpl
| Pointer to implementation.
const VendorAttr & | vendorAttr () const
| The targets current vendor equivalence settings.
void | vendorAttr (VendorAttr vendorAttr_r)
| Assign new vendor equivalence settings to the target.
| Target (const Pathname &root="/", bool doRebuild_r=false) ZYPP_LOCAL
| Ctor.
| Target (const Impl_Ptr &impl_r) ZYPP_LOCAL
| Ctor.
std::ostream & | dumpOn (std::ostream &str) const override
| Stream output.

## Base product and registration.
Static methods herein allow one to retrieve the values without explicitly initializing the Target. They take a targets root directory as argument. If an empty Pathname is passed, an already existing Targets root is used, otherwise `"/"` is assumed.
std::string | targetDistribution () const
| This is `register.target` attribute of the installed base product.
std::string | targetDistributionRelease () const
| This is `register.release` attribute of the installed base product.
std::string | targetDistributionFlavor () const
| This is `register.flavor` attribute of the installed base product.
DistributionLabel | distributionLabel () const
| This is `shortName` and `summary` attribute of the installed base product.
std::string | distributionVersion () const
| This is `version` attribute of the installed base product.
std::string | 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.
std::string | anonymousUniqueId () const
| anonymous unique id
static std::string | targetDistribution (const Pathname &root_r)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static std::string | targetDistributionRelease (const Pathname &root_r)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static std::string | targetDistributionFlavor (const Pathname &root_r)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static DistributionLabel | distributionLabel (const Pathname &root_r)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static std::string | distributionVersion (const Pathname &root_r)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static std::string | distributionFlavor (const Pathname &root_r)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static std::string | anonymousUniqueId (const Pathname &root_r)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

## Additional Inherited Members
Protected Member Functions inherited from zypp::base::ReferenceCounted
virtual void | ref_to (unsigned) const
| Trigger derived classes after refCount was increased.
virtual void | unref_to (unsigned) const
| Trigger derived classes after refCount was decreased.

## Detailed Description

Definition at line 50 of file Target.h.

## Member Typedef Documentation

## ◆ Impl

using zypp::Target::Impl = target::TargetImpl

Definition at line 53 of file Target.h.

## ◆ Impl_Ptr

using zypp::Target::Impl_Ptr = intrusive_ptr<Impl>

Definition at line 54 of file Target.h.

## ◆ PoolItemList

using zypp::Target::PoolItemList = std::list<PoolItem>

Definition at line 55 of file Target.h.

## Constructor & Destructor Documentation

## ◆ Target() [1/2]

zypp::Target::Target | ( | const Pathname & | root = "/",
|  | bool | doRebuild_r = false )
| explicit

Ctor.

If `doRebuild_r` is `true`, an already existing database is rebuilt (rpm –rebuilddb ).

Definition at line 32 of file Target.cc.

## ◆ Target() [2/2]

zypp::Target::Target | ( | const Impl_Ptr & | impl_r | ) |
| explicit

Ctor.

Definition at line 42 of file Target.cc.

## Member Function Documentation

## ◆ buildCache()

void zypp::Target::buildCache | ( |  | ) |

builds or refreshes the target cache

Definition at line 61 of file Target.cc.

## ◆ cleanCache()

void zypp::Target::cleanCache | ( |  | ) |

cleans the target cache (.solv files)

Definition at line 64 of file Target.cc.

## ◆ load()

void zypp::Target::load | ( |  | ) |

load resolvables into the pool

Definition at line 67 of file Target.cc.

## ◆ reload()

void zypp::Target::reload | ( |  | ) |

Definition at line 70 of file Target.cc.

## ◆ unload()

void zypp::Target::unload | ( |  | ) |

unload target resolvables from the pool

Definition at line 73 of file Target.cc.

## ◆ rpmDb()

target::rpm::RpmDb & zypp::Target::rpmDb | ( |  | ) |

Refference to the RPM database.

Definition at line 76 of file Target.cc.

## ◆ providesFile()

bool zypp::Target::providesFile | ( | const std::string & | name_str,
|  | const std::string & | path_str ) const

If the package is installed and provides the file Needed to evaluate split provides during Resolver::Upgrade()

Definition at line 82 of file Target.cc.

## ◆ whoOwnsFile()

std::string zypp::Target::whoOwnsFile | ( | const std::string & | path_str | ) | const

Return name of package owning path_str or empty string if no installed package owns path_str.

Definition at line 85 of file Target.cc.

## ◆ root()

Pathname zypp::Target::root | ( |  | ) | const

Return the root set for this target.

Definition at line 79 of file Target.cc.

## ◆ chrooted()

bool zypp::Target::chrooted | ( |  | ) | const
| inline

Whether the targets root is not `"/"`.

Definition at line 98 of file Target.h.

## ◆ assertRootPrefix()

Pathname zypp::Target::assertRootPrefix | ( | const Pathname & | path_r | ) | const
| inline

Return the path prefixed by the target root, unless it already is prefixed.

Definition at line 102 of file Target.h.

## ◆ baseProduct()

Product::constPtr zypp::Target::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.

Note
  this method requires the target to be loaded, otherwise it will return 0 as no product is found.

if you require some base product attributes when the target is not loaded into the pool, see targetDistribution , targetDistributionRelease and distributionVersion that obtain the data on demand from the installed product information.

Definition at line 91 of file Target.cc.

## ◆ requestedLocales() [1/2]

LocaleSet zypp::Target::requestedLocales | ( |  | ) | const

Languages to be supported by the system.

E.g. language specific packages to be installed.

Definition at line 94 of file Target.cc.

## ◆ requestedLocales() [2/2]

LocaleSet zypp::Target::requestedLocales | ( | const Pathname & | root_r | ) |
| static

Definition at line 96 of file Target.cc.

## ◆ updateAutoInstalled()

void zypp::Target::updateAutoInstalled | ( |  | ) |

Update the database of autoinstalled packages.

This is done on commit, so you usually don't need to call this explicitly.

Definition at line 99 of file Target.cc.

## ◆ targetDistribution() [1/2]

std::string zypp::Target::targetDistribution | ( |  | ) | const

This is `register.target` attribute of the installed base product.

Used for registration and Service refresh.

Definition at line 102 of file Target.cc.

## ◆ targetDistribution() [2/2]

std::string zypp::Target::targetDistribution | ( | const Pathname & | root_r | ) |
| static

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 104 of file Target.cc.

## ◆ targetDistributionRelease() [1/2]

std::string zypp::Target::targetDistributionRelease | ( |  | ) | const

This is `register.release` attribute of the installed base product.

Used for registration.

Definition at line 107 of file Target.cc.

## ◆ targetDistributionRelease() [2/2]

std::string zypp::Target::targetDistributionRelease | ( | const Pathname & | root_r | ) |
| static

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 109 of file Target.cc.

## ◆ targetDistributionFlavor() [1/2]

std::string zypp::Target::targetDistributionFlavor | ( |  | ) | const

This is `register.flavor` attribute of the installed base product.

Used for registration.

Note
  don't mistake this for distributionFlavor

Definition at line 112 of file Target.cc.

## ◆ targetDistributionFlavor() [2/2]

std::string zypp::Target::targetDistributionFlavor | ( | const Pathname & | root_r | ) |
| static

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 114 of file Target.cc.

## ◆ distributionLabel() [1/2]

Target::DistributionLabel zypp::Target::distributionLabel | ( |  | ) | const

This is `shortName` and `summary` attribute of the installed base product.

Used e.g. for the bootloader menu.

Definition at line 117 of file Target.cc.

## ◆ distributionLabel() [2/2]

Target::DistributionLabel zypp::Target::distributionLabel | ( | const Pathname & | root_r | ) |
| static

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 119 of file Target.cc.

## ◆ distributionVersion() [1/2]

std::string zypp::Target::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 122 of file Target.cc.

## ◆ distributionVersion() [2/2]

std::string zypp::Target::distributionVersion | ( | const Pathname & | root_r | ) |
| static

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 124 of file Target.cc.

## ◆ distributionFlavor() [1/2]

std::string zypp::Target::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

Note
  don't mistake this for targetDistributionFlavor

Definition at line 127 of file Target.cc.

## ◆ distributionFlavor() [2/2]

std::string zypp::Target::distributionFlavor | ( | const Pathname & | root_r | ) |
| static

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 129 of file Target.cc.

## ◆ anonymousUniqueId() [1/2]

std::string zypp::Target::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 132 of file Target.cc.

## ◆ anonymousUniqueId() [2/2]

std::string zypp::Target::anonymousUniqueId | ( | const Pathname & | root_r | ) |
| static

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 134 of file Target.cc.

## ◆ vendorAttr() [1/2]

const VendorAttr & zypp::Target::vendorAttr | ( |  | ) | const

The targets current vendor equivalence settings.

Initialized from the targets /etc/zypp/vendors.d.

Definition at line 137 of file Target.cc.

## ◆ vendorAttr() [2/2]

void zypp::Target::vendorAttr | ( | VendorAttr | vendorAttr_r | ) |

Assign new vendor equivalence settings to the target.

Definition at line 139 of file Target.cc.

## ◆ dumpOn()

std::ostream & zypp::Target::dumpOn | ( | std::ostream & | str | ) | const
| override private virtual

Stream output.

Reimplemented from zypp::base::ReferenceCounted.

Definition at line 88 of file Target.cc.

## Friends And Related Symbol Documentation

## ◆ zypp_detail::ZYppImpl

friend class zypp_detail::ZYppImpl
| friend

Direct access to Impl.

Definition at line 243 of file Target.h.

## ◆ operator<< [1/3]

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

## ◆ operator<<() [2/3]

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

Stream output.

Definition at line 251 of file Target.h.

## Member Data Documentation

## ◆ _pimpl

RW_pointer<Impl,rw_pointer::Intrusive<Impl> > zypp::Target::_pimpl
| private

Pointer to implementation.

Definition at line 246 of file Target.h.

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

- zypp/Target.h
- zypp/Target.cc