libzypp  13.10.6
Target.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <cassert>
13 
14 #include <iostream>
15 
16 #include "zypp/Target.h"
17 #include "zypp/target/TargetImpl.h"
18 
19 using namespace std;
20 
22 namespace zypp
23 {
24 
25  IMPL_PTR_TYPE(Target);
26 
28  //
29  // METHOD NAME : Target::Target
30  // METHOD TYPE : Ctor
31  //
32  Target::Target( const Pathname & root, bool doRebuild_r )
33  : _pimpl( new Impl(root,doRebuild_r) )
34  {
35  }
36 
38  //
39  // METHOD NAME : Target::Target
40  // METHOD TYPE : Ctor
41  //
42  Target::Target( const Impl_Ptr & impl_r )
43  : _pimpl( impl_r )
44  {
45  assert( impl_r );
46  }
47 
48  Target_Ptr Target::_nullimpl;
49 
51  Target_Ptr Target::nullimpl()
52  {
53  if (! _nullimpl)
54  {
56  }
57  return _nullimpl;
58  }
59 
60  std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj )
61  {
62  str << "summary=" << obj.summary << endl;
63  str << "shortName=" << obj.shortName << endl;
64  return str;
65  }
66 
68  //
69  // Forward to TargetImpl:
70  //
72 
74  { _pimpl->buildCache(); }
75 
77  { _pimpl->clearCache(); }
78 
79  void Target::load()
80  { _pimpl->load(); }
81 
83  { _pimpl->reload(); }
84 
86  { _pimpl->unload(); }
87 
89  { return _pimpl->rpm(); }
90 
91  Pathname Target::root() const
92  { return _pimpl->root(); }
93 
94  bool Target::providesFile (const std::string & name_str, const std::string & path_str) const
95  { return _pimpl->providesFile (name_str, path_str); }
96 
97  std::string Target::whoOwnsFile (const std::string & path_str) const
98  { return _pimpl->whoOwnsFile (path_str); }
99 
100  std::ostream & Target::dumpOn( std::ostream & str ) const
101  { return _pimpl->dumpOn( str ); }
102 
104  { return _pimpl->timestamp(); }
105 
107  { return _pimpl->baseProduct(); }
108 
110  { return _pimpl->requestedLocales(); }
111  LocaleSet Target::requestedLocales( const Pathname & root_r )
112  { return target::TargetImpl::requestedLocales( root_r ); }
113 
114  std::string Target::targetDistribution() const
115  { return _pimpl->targetDistribution(); }
116  std::string Target::targetDistribution( const Pathname & root_r )
117  { return target::TargetImpl::targetDistribution( root_r ); }
118 
120  { return _pimpl->targetDistributionRelease(); }
121  std::string Target::targetDistributionRelease( const Pathname & root_r )
123 
125  { return _pimpl->distributionLabel(); }
127  { return target::TargetImpl::distributionLabel( root_r ); }
128 
129  std::string Target::distributionVersion() const
130  { return _pimpl->distributionVersion(); }
131  std::string Target::distributionVersion( const Pathname & root_r )
132  { return target::TargetImpl::distributionVersion( root_r ); }
133 
134  std::string Target::distributionFlavor() const
135  { return _pimpl->distributionFlavor(); }
136  std::string Target::distributionFlavor( const Pathname & root_r )
137  { return target::TargetImpl::distributionFlavor( root_r ); }
138 
139  std::string Target::anonymousUniqueId() const
140  { return _pimpl->anonymousUniqueId(); }
141  std::string Target::anonymousUniqueId( const Pathname & root_r )
142  { return target::TargetImpl::anonymousUniqueId( root_r ); }
143 
145 } // namespace zypp
Interface to the rpm program.
Definition: RpmDb.h:47
Target::DistributionLabel distributionLabel() const
This is version attribute of the installed base product.
Definition: TargetImpl.cc:1635
static Target_Ptr nullimpl()
Null implementation.
Definition: Target.cc:51
void cleanCache()
cleans the target cache (.solv files)
Definition: Target.cc:76
static Target_Ptr _nullimpl
Definition: Target.h:218
DistributionLabel distributionLabel() const
This is shortName and summary attribute of the installed base product.
Definition: Target.cc:124
std::string distributionVersion() const
This is version attribute of the installed base product.
Definition: Target.cc:129
void reload()
Definition: Target.cc:82
static TargetImpl_Ptr nullimpl()
Null implementation.
Definition: TargetImpl.cc:620
TraitsType::constPtrType constPtr
Definition: Product.h:38
std::string targetDistribution() const
This is register.target attribute of the installed base product.
Definition: Target.cc:114
target::rpm::RpmDb & rpmDb()
Refference to the RPM database.
Definition: Target.cc:88
LocaleSet requestedLocales() const
Languages to be supported by the system.
Definition: TargetImpl.h:163
std::string distributionVersion() const
This is version attribute of the installed base product.
Definition: TargetImpl.cc:1653
Pathname root() const
Return the root set for this target.
Definition: Target.cc:91
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:94
std::string anonymousUniqueId() const
anonymous unique id
Definition: Target.cc:139
Store and operate on date (time_t).
Definition: Date.h:31
Base class for concrete Target implementations.
Definition: TargetImpl.h:53
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:120
RW_pointer< Impl, rw_pointer::Intrusive< Impl > > _pimpl
Pointer to implementation.
Definition: Target.h:216
std::string targetDistributionRelease() const
This is register.release attribute of the installed base product.
Definition: Target.cc:119
intrusive_ptr< Impl > Impl_Ptr
Definition: Target.h:53
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:97
void buildCache()
builds or refreshes the target cache
Definition: Target.cc:73
std::tr1::unordered_set< Locale > LocaleSet
Definition: Locale.h:28
std::string anonymousUniqueId() const
anonymous unique id
Definition: TargetImpl.cc:1706
void load()
load resolvables into the pool
Definition: Target.cc:79
void unload()
unload target resolvables from the pool
Definition: Target.cc:85
std::string targetDistribution() const
This is register.target attribute of the installed base product.
Definition: TargetImpl.cc:1623
Date timestamp() const
return the last modification date of the target
Definition: Target.cc:103
std::string distributionFlavor() const
This is flavor attribute of the installed base product but does not require the target to be loaded a...
Definition: TargetImpl.cc:1694
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:106
std::ostream & dumpOn(std::ostream &str) const
Stream output.
Definition: Target.cc:100
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:134
LocaleSet requestedLocales() const
Languages to be supported by the system.
Definition: Target.cc:109
std::string targetDistributionRelease() const
This is register.release attribute of the installed base product.
Definition: TargetImpl.cc:1629
#define IMPL_PTR_TYPE(NAME)