libzypp: zypp/Target.h Source File

libzypp 17.38.6

Target.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_TARGET_H
13#define ZYPP_TARGET_H
14
15#include <iosfwd>
16
17#include <zypp/base/ReferenceCounted.h>
18#include <zypp-core/base/NonCopyable.h>
19#include <zypp-core/base/PtrTypes.h>
20#include <zypp-core/Globals.h>
21
22#include <zypp/Product.h>
23#include <zypp-core/Pathname.h>
24#include <zypp/ResPool.h>
25
27namespace zypp
28{
29 class VendorAttr;
30 namespace target
31 {
32 class TargetImpl;
33 namespace rpm {
34 class RpmDb;
35 }
36 }
37 namespace zypp_detail
38 {
39 class ZYppImpl;
40 }
41
42 DEFINE_PTR_TYPE(Target);
43
45 //
46 // CLASS NAME : Target
47 //
50 class ZYPP_API Target : public base::ReferenceCounted, public base::NonCopyable
51 {
52 public:
53 using Impl = target::TargetImpl;
54 using Impl_Ptr = intrusive_ptr<Impl>;
55 using PoolItemList = std::list<PoolItem>;
56
57 public:
58
62 void buildCache();
63
67 void cleanCache();
68
72 void load();
73
74 void reload();
75
80 void unload();
81
83 target::rpm::RpmDb & rpmDb();
84
87 bool providesFile (const std::string & name_str, const std::string & path_str) const;
88
92 std::string whoOwnsFile (const std::string & path_str) const;
93
95 Pathname root() const;
96
98 bool chrooted() const
99 { return( ! root().emptyOrRoot() ); }
100
102 Pathname assertRootPrefix( const Pathname & path_r ) const
103 { return Pathname::assertprefix( root(), path_r ); }
104
121 Product::constPtr baseProduct() const;
122
127 LocaleSet requestedLocales() const;
130 static LocaleSet requestedLocales( const Pathname & root_r );
131
135 void updateAutoInstalled();
136
137 public:
146
149 std::string targetDistribution() const;
151 static std::string targetDistribution( const Pathname & root_r );
152
156 std::string targetDistributionRelease() const;
158 static std::string targetDistributionRelease( const Pathname & root_r );
159
164 std::string targetDistributionFlavor() const;
166 static std::string targetDistributionFlavor( const Pathname & root_r );
167
168 struct DistributionLabel { std::string shortName; std::string summary; };
172 DistributionLabel distributionLabel() const;
174 static DistributionLabel distributionLabel( const Pathname & root_r );
175
180 std::string distributionVersion() const;
182 static std::string distributionVersion( const Pathname & root_r );
183
192 std::string distributionFlavor() const;
194 static std::string distributionFlavor( const Pathname & root_r );
195
204 std::string anonymousUniqueId() const;
206 static std::string anonymousUniqueId( const Pathname & root_r );
208
209 public:
214
217 const VendorAttr & vendorAttr() const;
219 void vendorAttr( VendorAttr vendorAttr_r );
221
222 public:
227 explicit
228 Target( const Pathname & root = "/", bool doRebuild_r = false ) ZYPP_LOCAL;
233 explicit
234 Target( const Impl_Ptr & impl_r ) ZYPP_LOCAL;
235
236 private:
237 friend std::ostream & operator<<( std::ostream & str, const Target & obj );
239 std::ostream & dumpOn( std::ostream & str ) const override;
240
241 private:
243 friend class zypp_detail::ZYppImpl;
244
246 RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
247 };
248
249
251 inline std::ostream & operator<<( std::ostream & str, const Target & obj )
252 { return obj.dumpOn( str ); }
253
261 std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj );
262
264} // namespace zypp
266#endif // ZYPP_TARGET_H
Globals.h
Provides API related macros.
ZYPP_LOCAL
#define ZYPP_LOCAL
Definition Globals.h:71
NonCopyable.h
Pathname.h
Product.h
PtrTypes.h
DEFINE_PTR_TYPE
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
Definition PtrTypes.h:639
ResPool.h
intrusive_ptr
zypp::Pathname::assertprefix
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Return path_r prefixed with root_r, unless it is already prefixed.
Definition Pathname.cc:272
zypp::Product::constPtr
TraitsType::constPtrType constPtr
Definition Product.h:39
zypp::Target
Definition Target.h:51
zypp::Target::Target
Target(const Pathname &root="/", bool doRebuild_r=false) ZYPP_LOCAL
Ctor.
Definition Target.cc:32
zypp::Target::distributionFlavor
std::string distributionFlavor() const
This is flavor attribute of the installed base product but does not require the target to be loaded a...
Definition Target.cc:127
zypp::Target::ZYppImpl
friend class zypp_detail::ZYppImpl
Direct access to Impl.
Definition Target.h:243
zypp::Target::root
Pathname root() const
Return the root set for this target.
Definition Target.cc:79
zypp::Target::anonymousUniqueId
std::string anonymousUniqueId() const
anonymous unique id
Definition Target.cc:132
zypp::Target::dumpOn
std::ostream & dumpOn(std::ostream &str) const override
Stream output.
Definition Target.cc:88
zypp::Target::reload
void reload()
Definition Target.cc:70
zypp::Target::chrooted
bool chrooted() const
Whether the targets root is not "/".
Definition Target.h:98
zypp::Target::Impl_Ptr
intrusive_ptr< Impl > Impl_Ptr
Definition Target.h:54
zypp::Target::rpmDb
target::rpm::RpmDb & rpmDb()
Refference to the RPM database.
Definition Target.cc:76
zypp::Target::buildCache
void buildCache()
builds or refreshes the target cache
Definition Target.cc:61
zypp::Target::assertRootPrefix
Pathname assertRootPrefix(const Pathname &path_r) const
Return the path prefixed by the target root, unless it already is prefixed.
Definition Target.h:102
zypp::Target::whoOwnsFile
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.
Definition Target.cc:85
zypp::Target::PoolItemList
std::list< PoolItem > PoolItemList
Definition Target.h:55
zypp::Target::_pimpl
RW_pointer< Impl, rw_pointer::Intrusive< Impl > > _pimpl
Pointer to implementation.
Definition Target.h:246
zypp::Target::vendorAttr
const VendorAttr & vendorAttr() const
The targets current vendor equivalence settings.
Definition Target.cc:137
zypp::Target::Impl
target::TargetImpl Impl
Definition Target.h:53
zypp::Target::providesFile
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::...
Definition Target.cc:82
zypp::Target::unload
void unload()
unload target resolvables from the pool
Definition Target.cc:73
zypp::Target::distributionVersion
std::string distributionVersion() const
This is version attribute of the installed base product.
Definition Target.cc:122
zypp::Target::cleanCache
void cleanCache()
cleans the target cache (.solv files)
Definition Target.cc:64
zypp::Target::distributionLabel
DistributionLabel distributionLabel() const
This is shortName and summary attribute of the installed base product.
Definition Target.cc:117
zypp::Target::load
void load()
load resolvables into the pool
Definition Target.cc:67
zypp::VendorAttr
Definition of vendor equivalence.
Definition VendorAttr.h:61
zypp::base::ReferenceCounted
Base class for reference counted objects.
Definition ReferenceCounted.h:35
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::target::TargetImpl
Base class for concrete Target implementations.
Definition TargetImpl.h:54
zypp::target::rpm::RpmDb
Interface to the rpm program.
Definition RpmDb.h:51
zypp::zypp_detail::ZYppImpl
Definition ZYppImpl.h:41
std
Definition ansi.h:855
str
String related utilities and Regular expression matching.
zypp::base::NonCopyable
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition NonCopyable.h:26
zypp::rw_pointer
Don't forgett to provide versions for PtrType and constPtrType, esp.
Definition PtrTypes.h:194
zypp::target::rpm
Definition KeyRing.h:327
zypp::target
Definition KeyRing.h:325
zypp::zypp_detail
Definition Target.h:38
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::LocaleSet
std::unordered_set< Locale > LocaleSet
Definition Locale.h:29
zypp::ZYPP_API
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
Definition Arch.h:173
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Definition Capabilities.cc:65
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293
zypp::Target::DistributionLabel
Definition Target.h:168
zypp::Target::DistributionLabel::shortName
std::string shortName
Definition Target.h:168
zypp::Target::DistributionLabel::summary
std::string summary
Definition Target.h:168
ReferenceCounted.h