libzypp  17.23.8
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  bool chrooted() const
98  { return( ! root().emptyOrRoot() ); }
99 
101  Pathname assertRootPrefix( const Pathname & path_r ) const
102  { return Pathname::assertprefix( root(), path_r ); }
103 
121 
126  LocaleSet requestedLocales() const;
129  static LocaleSet requestedLocales( const Pathname & root_r );
130 
134  void updateAutoInstalled();
135 
136  public:
148  std::string targetDistribution() const;
150  static std::string targetDistribution( const Pathname & root_r );
151 
155  std::string targetDistributionRelease() const;
157  static std::string targetDistributionRelease( const Pathname & root_r );
158 
163  std::string targetDistributionFlavor() const;
165  static std::string targetDistributionFlavor( const Pathname & root_r );
166 
167  struct DistributionLabel { std::string shortName; std::string summary; };
173  static DistributionLabel distributionLabel( const Pathname & root_r );
174 
179  std::string distributionVersion() const;
181  static std::string distributionVersion( const Pathname & root_r );
182 
191  std::string distributionFlavor() const;
193  static std::string distributionFlavor( const Pathname & root_r );
194 
203  std::string anonymousUniqueId() const;
205  static std::string anonymousUniqueId( const Pathname & root_r );
207 
208  public:
212  explicit
213  Target( const Pathname & root = "/", bool doRebuild_r = false );
215  explicit
216  Target( const Impl_Ptr & impl_r );
217 
218  private:
219  friend std::ostream & operator<<( std::ostream & str, const Target & obj );
221  std::ostream & dumpOn( std::ostream & str ) const;
222 
223  private:
225  friend class zypp_detail::ZYppImpl;
226 
229  };
231 
233  inline std::ostream & operator<<( std::ostream & str, const Target & obj )
234  { return obj.dumpOn( str ); }
235 
243  std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj );
244 
246 } // namespace zypp
248 #endif // ZYPP_TARGET_H
ResPool.h
zypp::Target::targetDistributionFlavor
std::string targetDistributionFlavor() const
This is register.flavor attribute of the installed base product.
Definition: Target.cc:112
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::operator<<
std::ostream & operator<<(std::ostream &str, const Target &obj)
Definition: Target.h:233
zypp::DEFINE_PTR_TYPE
DEFINE_PTR_TYPE(Application)
zypp::Target::root
Pathname root() const
Return the root set for this target.
Definition: Target.cc:79
zypp::Target
Definition: Target.h:49
zypp::Target::DistributionLabel
Definition: Target.h:167
zypp::Target::DistributionLabel::summary
std::string summary
Definition: Target.h:167
zypp::Target::cleanCache
void cleanCache()
cleans the target cache (.solv files)
Definition: Target.cc:64
zypp::Target::targetDistribution
std::string targetDistribution() const
This is register.target attribute of the installed base product.
Definition: Target.cc:102
zypp::Product::constPtr
TraitsType::constPtrType constPtr
Definition: Product.h:38
zypp::Target::reload
void reload()
Definition: Target.cc:70
zypp::Target::Impl
target::TargetImpl Impl
Definition: Target.h:52
zypp::base::ReferenceCounted
Base class for reference counted objects.
Definition: ReferenceCounted.h:33
PtrTypes.h
zypp::Target::chrooted
bool chrooted() const
Whether the targets root is not "/".
Definition: Target.h:97
zypp::filesystem::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:235
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
Product.h
Pathname.h
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::rpmDb
target::rpm::RpmDb & rpmDb()
Refference to the RPM database.
Definition: Target.cc:76
zypp::Target::requestedLocales
LocaleSet requestedLocales() const
Languages to be supported by the system.
Definition: Target.cc:94
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:285
zypp::target::TargetImpl
Base class for concrete Target implementations.
Definition: TargetImpl.h:53
zypp::base::NonCopyable
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
zypp::Target::Impl_Ptr
intrusive_ptr< Impl > Impl_Ptr
Definition: Target.h:53
zypp::target::rpm::RpmDb
Interface to the rpm program.
Definition: RpmDb.h:47
zypp::Target::baseProduct
Product::constPtr baseProduct() const
returns the target base installed product, also known as the distribution or platform.
Definition: Target.cc:91
zypp::Target::DistributionLabel::shortName
std::string shortName
Definition: Target.h:167
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
zypp::Target::_pimpl
RW_pointer< Impl, rw_pointer::Intrusive< Impl > > _pimpl
Pointer to implementation.
Definition: Target.h:228
zypp::Target::targetDistributionRelease
std::string targetDistributionRelease() const
This is register.release attribute of the installed base product.
Definition: Target.cc:107
zypp::Target::load
void load()
load resolvables into the pool
Definition: Target.cc:67
zypp::Target::unload
void unload()
unload target resolvables from the pool
Definition: Target.cc:73
zypp::Target::distributionLabel
DistributionLabel distributionLabel() const
This is shortName and summary attribute of the installed base product.
Definition: Target.cc:117
zypp::zypp_detail::ZYppImpl
Definition: ZYppImpl.h:38
zypp::Target::buildCache
void buildCache()
builds or refreshes the target cache
Definition: Target.cc:61
zypp::Target::operator<<
friend std::ostream & operator<<(std::ostream &str, const Target &obj)
zypp::Target::dumpOn
std::ostream & dumpOn(std::ostream &str) const
Stream output.
Definition: Target.cc:88
zypp::Target::anonymousUniqueId
std::string anonymousUniqueId() const
anonymous unique id
Definition: Target.cc:132
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
ReferenceCounted.h
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:101
zypp::LocaleSet
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:27
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:44
zypp::Target::Target
Target(const Pathname &root="/", bool doRebuild_r=false)
Ctor.
Definition: Target.cc:32
zypp::Target::updateAutoInstalled
void updateAutoInstalled()
Update the database of autoinstalled packages.
Definition: Target.cc:99
str
String related utilities and Regular expression matching.
zypp::Target::distributionVersion
std::string distributionVersion() const
This is version attribute of the installed base product.
Definition: Target.cc:122
zypp::Target::PoolItemList
std::list< PoolItem > PoolItemList
Definition: Target.h:54
NonCopyable.h