libzypp  15.28.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 
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/base/PtrTypes.h"
20 #include "zypp/APIConfig.h"
21 
22 #include "zypp/Product.h"
23 #include "zypp/Pathname.h"
24 #include "zypp/ResPool.h"
25 
27 namespace zypp
28 {
29  namespace target
30  {
31  class TargetImpl;
32  namespace rpm {
33  class RpmDb;
34  }
35  }
36  namespace zypp_detail
37  {
38  class ZYppImpl;
39  }
40 
42 
44  //
45  // CLASS NAME : Target
46  //
50  {
51  public:
53  typedef intrusive_ptr<Impl> Impl_Ptr;
54  typedef std::list<PoolItem> PoolItemList;
55 
56  public:
57 
61  void buildCache();
62 
66  void cleanCache();
67 
71  void load();
72 
73  void reload();
74 
79  void unload();
80 
83 
86  bool providesFile (const std::string & name_str, const std::string & path_str) const;
87 
91  std::string whoOwnsFile (const std::string & path_str) const;
92 
94  Pathname root() const;
95 
97  Pathname assertRootPrefix( const Pathname & path_r ) const
98  { return Pathname::assertprefix( root(), path_r ); }
99 
101  Date timestamp() const;
102 
120 
125  LocaleSet requestedLocales() const;
128  static LocaleSet requestedLocales( const Pathname & root_r );
129 
130  public:
142  std::string targetDistribution() const;
144  static std::string targetDistribution( const Pathname & root_r );
145 
149  std::string targetDistributionRelease() const;
151  static std::string targetDistributionRelease( const Pathname & root_r );
152 
157  std::string targetDistributionFlavor() const;
159  static std::string targetDistributionFlavor( const Pathname & root_r );
160 
161  struct DistributionLabel { std::string shortName; std::string summary; };
167  static DistributionLabel distributionLabel( const Pathname & root_r );
168 
173  std::string distributionVersion() const;
175  static std::string distributionVersion( const Pathname & root_r );
176 
185  std::string distributionFlavor() const;
187  static std::string distributionFlavor( const Pathname & root_r );
188 
197  std::string anonymousUniqueId() const;
199  static std::string anonymousUniqueId( const Pathname & root_r );
201 
202  public:
206  explicit
207  Target( const Pathname & root = "/", bool doRebuild_r = false );
209  explicit
210  Target( const Impl_Ptr & impl_r );
211 
212  private:
213  friend std::ostream & operator<<( std::ostream & str, const Target & obj );
215  std::ostream & dumpOn( std::ostream & str ) const;
216 
217  private:
219  friend class zypp_detail::ZYppImpl;
220 
223  };
225 
227  inline std::ostream & operator<<( std::ostream & str, const Target & obj )
228  { return obj.dumpOn( str ); }
229 
237  std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj );
238 
240 } // namespace zypp
242 #endif // ZYPP_TARGET_H
Interface to the rpm program.
Definition: RpmDb.h:47
std::ostream & operator<<(std::ostream &str, const Target &obj)
Definition: Target.h:227
void cleanCache()
cleans the target cache (.solv files)
Definition: Target.cc:64
DistributionLabel distributionLabel() const
This is shortName and summary attribute of the installed base product.
Definition: Target.cc:117
std::string distributionVersion() const
This is version attribute of the installed base product.
Definition: Target.cc:122
void reload()
Definition: Target.cc:70
TraitsType::constPtrType constPtr
Definition: Product.h:38
std::string targetDistribution() const
This is register.target attribute of the installed base product.
Definition: Target.cc:102
target::rpm::RpmDb & rpmDb()
Refference to the RPM database.
Definition: Target.cc:76
target::TargetImpl Impl
Definition: Target.h:52
Pathname root() const
Return the root set for this target.
Definition: Target.cc:79
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
std::string anonymousUniqueId() const
anonymous unique id
Definition: Target.cc:132
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
Store and operate on date (time_t).
Definition: Date.h:32
Base class for concrete Target implementations.
Definition: TargetImpl.h:53
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:120
DEFINE_PTR_TYPE(Application)
Provides API related macros.
RW_pointer< Impl, rw_pointer::Intrusive< Impl > > _pimpl
Pointer to implementation.
Definition: Target.h:222
std::string targetDistributionRelease() const
This is register.release attribute of the installed base product.
Definition: Target.cc:107
intrusive_ptr< Impl > Impl_Ptr
Definition: Target.h:53
Pathname assertRootPrefix(const Pathname &path_r) const
Return the path prefixed by the target root, unless it already is prefixed.
Definition: Target.h:97
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
void buildCache()
builds or refreshes the target cache
Definition: Target.cc:61
Base class for reference counted objects.
void load()
load resolvables into the pool
Definition: Target.cc:67
void unload()
unload target resolvables from the pool
Definition: Target.cc:73
Date timestamp() const
return the last modification date of the target
Definition: Target.cc:91
Target(const Pathname &root="/", bool doRebuild_r=false)
Ctor.
Definition: Target.cc:32
Product::constPtr baseProduct() const
returns the target base installed product, also known as the distribution or platform.
Definition: Target.cc:94
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:285
std::ostream & dumpOn(std::ostream &str) const
Stream output.
Definition: Target.cc:88
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
friend std::ostream & operator<<(std::ostream &str, const Target &obj)
LocaleSet requestedLocales() const
Languages to be supported by the system.
Definition: Target.cc:97
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:27
std::list< PoolItem > PoolItemList
Definition: Target.h:54
std::string targetDistributionFlavor() const
This is register.flavor attribute of the installed base product.
Definition: Target.cc:112