libzypp 17.37.17
TargetImpl.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_TARGET_TARGETIMPL_H
13#define ZYPP_TARGET_TARGETIMPL_H
14
15#include <iosfwd>
16#include <set>
17
20#include <zypp/base/PtrTypes.h>
21#include <zypp/PoolItem.h>
22#include <zypp/ZYppCommit.h>
23
24#include <zypp/Pathname.h>
25#include <zypp/Target.h>
31#include <zypp/ManagedFile.h>
32#include <zypp/VendorAttr.h>
33
35namespace zypp
36{
38 namespace target
39 {
40
43
45 //
46 // CLASS NAME : TargetImpl
47 //
54 {
55 friend std::ostream & operator<<( std::ostream & str, const TargetImpl & obj );
56
57 public:
59 using PoolItemList = std::list<PoolItem>;
60
62 using PoolItemSet = std::set<PoolItem>;
63
64 public:
66 TargetImpl(const Pathname & root_r = "/", bool doRebuild_r = false );
68 ~TargetImpl() override;
69
74 void createAnonymousId() const;
75
80
87 private:
90
94
97 { return ! _tmpSolvfilesPath.empty(); }
98
100
101 public:
102 void load( bool force = true );
103
104 void unload();
105
106 void reload();
107
108 void clearCache();
109
110 bool buildCache();
112
113 public:
114
117 { return _root; }
118
121 { return home( _root ); }
122
123 static Pathname home( const Pathname & root_r )
124 { return root_r / "/var/lib/zypp"; }
125
127 ZYppCommitResult commit( ResPool pool_r, const ZYppCommitPolicy & policy_r );
128
130 void installSrcPackage( const SrcPackage_constPtr & srcPackage_r );
131
133 ManagedFile provideSrcPackage( const SrcPackage_constPtr & srcPackage_r );
134
136 std::ostream & dumpOn( std::ostream & str ) const override
137 { return str << "Target(" << root() << ")"; }
138
140 rpm::RpmDb & rpm();
141
144 bool providesFile (const std::string & path_str, const std::string & name_str) const;
145
148 std::string whoOwnsFile (const std::string & path_str) const
149 { return _rpm.whoOwnsFile (path_str); }
150
153
156 { return _requestedLocalesFile.locales(); }
157
158 static LocaleSet requestedLocales( const Pathname & root_r );
159
161 void updateAutoInstalled();
162
164 std::string targetDistribution() const;
166 static std::string targetDistribution( const Pathname & root_r );
167
169 std::string targetDistributionRelease() const;
171 static std::string targetDistributionRelease( const Pathname & root_r );
172
174 std::string targetDistributionFlavor() const;
176 static std::string targetDistributionFlavor( const Pathname & root_r );
177
182
184 std::string distributionVersion() const;
186 static std::string distributionVersion( const Pathname & root_r );
187
189 std::string distributionFlavor() const;
191 static std::string distributionFlavor( const Pathname & root_r );
192
194 std::string anonymousUniqueId() const;
196 static std::string anonymousUniqueId( const Pathname & root_r );
197
199 const VendorAttr & vendorAttr() const
200 { return _vendorAttr; }
201
202 void vendorAttr( VendorAttr vendorAttr_r );
204
205 public:
206 private:
208 void commit( const ZYppCommitPolicy & policy_r,
209 CommitPackageCache & packageCache_r,
210 ZYppCommitResult & result_r );
211
213 void commitInSingleTransaction( const ZYppCommitPolicy & policy_r,
214 CommitPackageCache & packageCache_r,
215 ZYppCommitResult & result_r );
216
217
219 void commitFindFileConflicts( const ZYppCommitPolicy & policy_r, ZYppCommitResult & result_r );
220 protected:
232 mutable std::string _distributionVersion;
235 };
236
237
239 inline std::ostream & operator<<( std::ostream & str, const TargetImpl & obj )
240 {
241 return obj.dumpOn( str );
242 }
243
245 } // namespace target
248} // namespace zypp
250#endif // ZYPP_TARGET_TARGETIMPL_H
TraitsType::constPtrType constPtr
Definition Product.h:39
Global ResObject pool.
Definition ResPool.h:62
Definition of vendor equivalence.
Definition VendorAttr.h:61
Options and policies for ZYpp::commit.
Result returned from ZYpp::commit.
Base class for reference counted objects.
Target::commit helper optimizing package provision.
Save and restore hardlocks.
Save and restore locale set from file.
Save and restore a list of solvable names (ident IdString)
Base class for concrete Target implementations.
Definition TargetImpl.h:54
std::string targetDistributionRelease() const
This is register.release attribute of the installed base product.
const VendorAttr & vendorAttr() const
The targets current vendor equivalence settings.
Definition TargetImpl.h:199
std::string targetDistribution() const
This is register.target attribute of the installed base product.
std::set< PoolItem > PoolItemSet
set of pool items
Definition TargetImpl.h:62
std::list< PoolItem > PoolItemList
list of pool items
Definition TargetImpl.h:59
LocaleSet requestedLocales() const
Languages to be supported by the system.
Definition TargetImpl.h:155
friend std::ostream & operator<<(std::ostream &str, const TargetImpl &obj)
void updateAutoInstalled()
Update the database of autoinstalled packages.
ManagedFile provideSrcPackage(const SrcPackage_constPtr &srcPackage_r)
Provides a source package on the Target.
Pathname _root
Path to the target.
Definition TargetImpl.h:222
RequestedLocalesFile _requestedLocalesFile
Requested Locales database.
Definition TargetImpl.h:226
void createLastDistributionFlavorCache() const
generates a cache of the last product flavor
std::string _distributionVersion
Cache distributionVersion.
Definition TargetImpl.h:232
rpm::RpmDb _rpm
RPM database.
Definition TargetImpl.h:224
~TargetImpl() override
Dtor.
rpm::RpmDb & rpm()
The RPM database.
Pathname solvfilesPath() const
The solv file location actually in use (default or temp).
Definition TargetImpl.h:92
std::string distributionVersion() const
This is version attribute of the installed base product.
void createAnonymousId() const
generates the unique anonymous id which is called when creating the target
static Pathname home(const Pathname &root_r)
Definition TargetImpl.h:123
SolvIdentFile _autoInstalledFile
user/auto installed database
Definition TargetImpl.h:228
std::ostream & dumpOn(std::ostream &str) const override
Overload to realize stream output.
Definition TargetImpl.h:136
Product::constPtr baseProduct() const
returns the target base installed product, also known as the distribution or platform.
Target::DistributionLabel distributionLabel() const
This is shortName and summary attribute of the installed base product.
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::...
HardLocksFile _hardLocksFile
Hard-Locks database.
Definition TargetImpl.h:230
Pathname root() const
The root set for this target.
Definition TargetImpl.h:116
void load(bool force=true)
std::string distributionFlavor() const
This is flavor attribute of the installed base product but does not require the target to be loaded a...
void commitInSingleTransaction(const ZYppCommitPolicy &policy_r, CommitPackageCache &packageCache_r, ZYppCommitResult &result_r)
Commit ordered changes (internal helper)
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 TargetImpl.h:148
void installSrcPackage(const SrcPackage_constPtr &srcPackage_r)
Install a source package on the Target.
ZYppCommitResult commit(ResPool pool_r, const ZYppCommitPolicy &policy_r)
Commit changes in the pool.
VendorAttr _vendorAttr
vendor equivalence settings.
Definition TargetImpl.h:234
Pathname home() const
The directory to store things.
Definition TargetImpl.h:120
void commitFindFileConflicts(const ZYppCommitPolicy &policy_r, ZYppCommitResult &result_r)
Commit helper checking for file conflicts after download.
Pathname defaultSolvfilesPath() const
The systems default solv file location.
std::string anonymousUniqueId() const
anonymous unique id
TargetImpl(const Pathname &root_r="/", bool doRebuild_r=false)
Ctor.
bool solvfilesPathIsTemp() const
Whether we're using a temp.
Definition TargetImpl.h:96
std::string targetDistributionFlavor() const
This is register.flavor attribute of the installed base product.
Interface to the rpm program.
Definition RpmDb.h:51
String related utilities and Regular expression matching.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition NonCopyable.h:26
Easy-to use interface to the ZYPP dependency resolver.
std::unordered_set< Locale > LocaleSet
Definition Locale.h:29
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
Definition ManagedFile.h:27
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
Definition PtrTypes.h:639