libzypp  17.25.1
Pool.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_SAT_POOL_H
13 #define ZYPP_SAT_POOL_H
14 
15 #include <iosfwd>
16 
17 #include <zypp/Pathname.h>
18 
20 #include <zypp/Repository.h>
21 #include <zypp/sat/WhatProvides.h>
22 #include <zypp/sat/SolvableSet.h>
23 #include <zypp/sat/Queue.h>
24 
26 namespace zypp
27 {
28 
29  class SerialNumber;
30  class RepoInfo;
31 
33  namespace sat
34  {
35 
36  class SolvableSpec;
37 
39  //
40  // CLASS NAME : Pool
41  //
46  class Pool : protected detail::PoolMember
47  {
48  public:
52 
53  public:
55  static Pool instance()
56  { return Pool(); }
57 
60  {}
61 
62  public:
64  size_type capacity() const;
65 
67  const SerialNumber & serial() const;
68 
70  const SerialNumber & serialIDs() const;
71 
73  void prepare() const;
74 
76  Pathname rootDir() const;
77 
79  void rootDir( const Pathname & root_r );
80 
81  public:
83  bool reposEmpty() const;
84 
86  size_type reposSize() const;
87 
90 
93 
96  { return makeIterable( reposBegin(), reposEnd() ); }
97 
102  Repository reposInsert( const std::string & alias_r );
103 
107  Repository reposFind( const std::string & alias_r ) const;
108 
112  void reposErase( const std::string & alias_r )
113  { reposFind( alias_r ).eraseFromPool(); }
114 
120  { while ( ! reposEmpty() ) reposErase( reposBegin()->alias() ); }
121 
122  public:
124  static const std::string & systemRepoAlias();
125 
127  Repository findSystemRepo() const;
128 
131 
132  public:
138  Repository addRepoSolv( const Pathname & file_r, const std::string & name_r );
140  Repository addRepoSolv( const Pathname & file_r );
144  Repository addRepoSolv( const Pathname & file_r, const RepoInfo & info_r );
145 
146  public:
153  Repository addRepoHelix( const Pathname & file_r, const std::string & name_r );
155  Repository addRepoHelix( const Pathname & file_r );
159  Repository addRepoHelix( const Pathname & file_r, const RepoInfo & info_r );
160 
161  public:
163  bool solvablesEmpty() const;
164 
166  size_type solvablesSize() const;
167 
170 
173 
176  { return makeIterable( solvablesBegin(), solvablesEnd() ); }
177 
178  public:
181  template<class TFilter>
182  filter_iterator<TFilter,SolvableIterator> filterBegin( const TFilter & filter_r ) const
183  { return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); }
184 
185  template<class TFilter>
186  filter_iterator<TFilter,SolvableIterator> filterEnd( const TFilter & filter_r ) const
187  { return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); }
189 
190  public:
193  { return WhatProvides( cap_r ); }
194 
195  Queue whatMatchesDep( const SolvAttr &attr, const Capability &cap ) const;
196  Queue whatMatchesSolvable ( const SolvAttr &attr, const Solvable &solv ) const;
197  Queue whatContainsDep ( const SolvAttr &attr, const Capability &cap ) const;
198 
199  public:
205  void setTextLocale( const Locale & locale_r );
206 
211  void setRequestedLocales( const LocaleSet & locales_r );
212 
216  bool addRequestedLocale( const Locale & locale_r );
217 
221  bool eraseRequestedLocale( const Locale & locale_r );
222 
226  const LocaleSet & getRequestedLocales() const;
227 
229  bool isRequestedLocale( const Locale & locale_r ) const;
230 
231 
233  void initRequestedLocales( const LocaleSet & locales_r );
234 
236  const LocaleSet & getAddedRequestedLocales() const;
237 
239  const LocaleSet & getRemovedRequestedLocales() const;
240 
241 
246  const LocaleSet & getAvailableLocales() const;
247 
249  bool isAvailableLocale( const Locale & locale_r ) const;
251 
252  public:
260  const MultiversionList & multiversion() const;
262  ZYPP_DEPRECATED bool multiversionEmpty() const { return multiversion().empty(); }
264 
265  public:
269  Queue autoInstalled() const;
271  void setAutoInstalled( const Queue & autoInstalled_r );
273 
274  public:
278  void setNeedrebootSpec( sat::SolvableSpec needrebootSpec_r );
280 
281  public:
283  detail::CPool * get() const;
284  private:
286  Pool() {}
287  };
289 
291  std::ostream & operator<<( std::ostream & str, const Pool & obj );
292 
294  inline bool operator==( const Pool & lhs, const Pool & rhs )
295  { return lhs.get() == rhs.get(); }
296 
298  inline bool operator!=( const Pool & lhs, const Pool & rhs )
299  { return lhs.get() != rhs.get(); }
300 
302  void updateSolvFileIndex( const Pathname & solvfile_r );
303 
305  } // namespace sat
308 } // namespace zypp
310 #endif // ZYPP_SAT_POOL_H
zypp::sat::Pool::instance
static Pool instance()
Singleton ctor.
Definition: Pool.h:55
zypp::sat::Pool::solvablesEmpty
bool solvablesEmpty() const
Whether Pool contains solvables.
Definition: Pool.cc:90
zypp::sat::Pool::filterEnd
filter_iterator< TFilter, SolvableIterator > filterEnd(const TFilter &filter_r) const
Definition: Pool.h:186
zypp::sat::Pool::operator==
bool operator==(const Pool &lhs, const Pool &rhs)
Definition: Pool.h:294
zypp::sat::SolvableSet
Solvable set wrapper to allow adding additional convenience iterators.
Definition: SolvableSet.h:35
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition: Solvable.h:53
zypp::sat::WhatProvides
Container of Solvable providing a Capability (read only).
Definition: WhatProvides.h:87
zypp::sat::Pool::autoInstalled
Queue autoInstalled() const
Get ident list of all autoinstalled solvables.
Definition: Pool.cc:264
zypp::sat::Pool::solvablesBegin
SolvableIterator solvablesBegin() const
Iterator to the first Solvable.
Definition: Pool.cc:116
zypp::sat::Pool::isAvailableLocale
bool isAvailableLocale(const Locale &locale_r) const
Whether this Locale is in the set of available locales.
Definition: Pool.cc:258
zypp::sat::Pool::Pool
Pool()
Default ctor.
Definition: Pool.h:286
zypp::sat::Pool::reposErase
void reposErase(const std::string &alias_r)
Remove a Repository named alias_r.
Definition: Pool.h:112
zypp::sat::Pool::capacity
size_type capacity() const
Internal array size for stats only.
Definition: Pool.cc:52
zypp::RepoInfo
What is known about a repository.
Definition: RepoInfo.h:71
zypp::sat::Pool::getAvailableLocales
const LocaleSet & getAvailableLocales() const
Get the set of available locales.
Definition: Pool.cc:255
zypp::sat::Pool::initRequestedLocales
void initRequestedLocales(const LocaleSet &locales_r)
Start tracking changes based on this locales_r.
Definition: Pool.cc:251
zypp::sat::Pool::reposEnd
RepositoryIterator reposEnd() const
Iterator behind the last Repository.
Definition: Pool.cc:87
zypp::sat::detail::CPool
::s_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:61
zypp::sat::Pool::setNeedrebootSpec
void setNeedrebootSpec(sat::SolvableSpec needrebootSpec_r)
Solvables which should trigger the reboot-needed hint if installed/updated.
Definition: Pool.cc:267
zypp::sat::Pool::whatMatchesDep
Queue whatMatchesDep(const SolvAttr &attr, const Capability &cap) const
Definition: Pool.cc:122
attr
sat::SolvAttr attr
Definition: PoolQuery.cc:311
zypp::sat::Pool::systemRepoAlias
static const std::string & systemRepoAlias()
Reserved system repository alias @System .
Definition: Pool.cc:46
zypp::detail::RepositoryIterator
Definition: Repository.h:453
zypp::sat::Pool::filterBegin
filter_iterator< TFilter, SolvableIterator > filterBegin(const TFilter &filter_r) const
Definition: Pool.h:182
zypp::sat::Pool::rootDir
Pathname rootDir() const
Get rootdir (for file conflicts check)
Definition: Pool.cc:64
PoolMember.h
zypp::sat::Pool::getRemovedRequestedLocales
const LocaleSet & getRemovedRequestedLocales() const
Removed since last initRequestedLocales.
Definition: Pool.cc:253
Pathname.h
zypp::sat::SolvableSpec
Define a set of Solvables by ident and provides.
Definition: SolvableSpec.h:44
zypp::sat::Pool::solvablesEnd
SolvableIterator solvablesEnd() const
Iterator behind the last Solvable.
Definition: Pool.cc:119
zypp::sat::Pool::findSystemRepo
Repository findSystemRepo() const
Return the system repository if it is on the pool.
Definition: Pool.cc:173
zypp::sat::Pool::solvablesSize
size_type solvablesSize() const
Number of solvables in Pool.
Definition: Pool.cc:103
SolvableSet.h
zypp::sat::Pool::solvables
Iterable< SolvableIterator > solvables() const
Iterate the solvables.
Definition: Pool.h:175
zypp::sat::Pool::SolvableIterator
detail::SolvableIterator SolvableIterator
Definition: Pool.h:49
zypp::sat::Pool::reposBegin
RepositoryIterator reposBegin() const
Iterator to the first Repository.
Definition: Pool.cc:76
zypp::sat::Pool::setAutoInstalled
void setAutoInstalled(const Queue &autoInstalled_r)
Set ident list of all autoinstalled solvables.
Definition: Pool.cc:265
zypp::sat::Pool
Global sat-pool.
Definition: Pool.h:46
zypp::sat::SolvableSet::empty
bool empty() const
Whether the set is epmty.
Definition: SolvableSet.h:59
WhatProvides.h
zypp::sat::Pool::multiversion
const MultiversionList & multiversion() const
Definition: Pool.cc:261
zypp::sat::Pool::prepare
void prepare() const
Update housekeeping data if necessary (e.g.
Definition: Pool.cc:61
zypp::sat::SolvAttr
Solvable attribute keys.
Definition: SolvAttr.h:40
zypp::sat::Pool::addRequestedLocale
bool addRequestedLocale(const Locale &locale_r)
Add one Locale to the set of requested locales.
Definition: Pool.cc:239
zypp::sat::Pool::reposEmpty
bool reposEmpty() const
Whether Pool contains repos.
Definition: Pool.cc:70
zypp::sat::Pool::addRepoHelix
Repository addRepoHelix(const Pathname &file_r, const std::string &name_r)
Load Solvables from a helix-file into a Repository named name_r.
Definition: Pool.cc:209
zypp::sat::Pool::multiversionEmpty
ZYPP_DEPRECATED bool multiversionEmpty() const
Definition: Pool.h:262
zypp::sat::Pool::setTextLocale
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
Definition: Pool.cc:233
zypp::sat::operator<<
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
Definition: FileConflicts.cc:109
zypp::sat::Pool::eraseRequestedLocale
bool eraseRequestedLocale(const Locale &locale_r)
Erase one Locale from the set of requested locales.
Definition: Pool.cc:242
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
Queue.h
zypp::sat::Queue
Libsolv Id queue wrapper.
Definition: Queue.h:34
zypp::sat::Pool::operator!=
bool operator!=(const Pool &lhs, const Pool &rhs)
Definition: Pool.h:298
zypp::sat::Pool::getAddedRequestedLocales
const LocaleSet & getAddedRequestedLocales() const
Added since last initRequestedLocales.
Definition: Pool.cc:252
zypp::sat::Pool::serialIDs
const SerialNumber & serialIDs() const
Serial number changing whenever resusePoolIDs==true was used.
Definition: Pool.cc:58
zypp::sat::detail::SolvableIterator
Definition: Solvable.h:479
zypp::sat::Pool::isRequestedLocale
bool isRequestedLocale(const Locale &locale_r) const
Whether this Locale is in the set of requested locales.
Definition: Pool.cc:248
zypp::sat::Pool::whatContainsDep
Queue whatContainsDep(const SolvAttr &attr, const Capability &cap) const
Definition: Pool.cc:136
zypp::Capability
A sat capability.
Definition: Capability.h:59
zypp::sat::Pool::reposEraseAll
void reposEraseAll()
Remove all repos from the pool.
Definition: Pool.h:119
zypp::sat::Pool::MultiversionList
SolvableSet MultiversionList
Definition: Pool.h:259
zypp::sat::Pool::reposSize
size_type reposSize() const
Number of repos in Pool.
Definition: Pool.cc:73
zypp::sat::Pool::whatMatchesSolvable
Queue whatMatchesSolvable(const SolvAttr &attr, const Solvable &solv) const
Definition: Pool.cc:129
zypp::SerialNumber
Simple serial number provider.
Definition: SerialNumber.h:44
zypp::sat::Pool::size_type
detail::size_type size_type
Definition: Pool.h:51
zypp::sat::updateSolvFileIndex
void updateSolvFileIndex(const Pathname &solvfile_r)
Create solv file content digest for zypper bash completion.
Definition: Pool.cc:285
zypp::LocaleSet
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:27
zypp::Repository::eraseFromPool
void eraseFromPool()
Remove this Repository from it's Pool.
Definition: Repository.cc:297
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:44
zypp::sat::Pool::Pool
Pool(const detail::PoolMember &)
Ctor from PoolMember.
Definition: Pool.h:59
zypp::sat::detail::size_type
SolvableIdType size_type
Definition: PoolMember.h:126
zypp::sat::detail::PoolMember
Backlink to the associated PoolImpl.
Definition: PoolMember.h:88
Repository.h
zypp::sat::Pool::addRepoSolv
Repository addRepoSolv(const Pathname &file_r, const std::string &name_r)
Load Solvables from a solv-file into a Repository named name_r.
Definition: Pool.cc:185
zypp::sat::Pool::setRequestedLocales
void setRequestedLocales(const LocaleSet &locales_r)
Set the requested locales.
Definition: Pool.cc:236
zypp::sat::Pool::repos
Iterable< RepositoryIterator > repos() const
Iterate the repositories.
Definition: Pool.h:95
str
String related utilities and Regular expression matching.
zypp::sat::Pool::reposInsert
Repository reposInsert(const std::string &alias_r)
Return a Repository named alias_r.
Definition: Pool.cc:143
zypp::sat::Pool::whatProvides
WhatProvides whatProvides(Capability cap_r) const
Conainer of all Solvable providing cap_r.
Definition: Pool.h:192
zypp::sat::Pool::RepositoryIterator
zypp::detail::RepositoryIterator RepositoryIterator
Definition: Pool.h:50
zypp::Repository
Definition: Repository.h:39
zypp::Locale
'Language[_Country]' codes.
Definition: Locale.h:49
zypp::sat::Pool::reposFind
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
Definition: Pool.cc:163
zypp::sat::Pool::get
detail::CPool * get() const
Expert backdoor.
Definition: Pool.cc:49
zypp::sat::Pool::serial
const SerialNumber & serial() const
Housekeeping data serial number.
Definition: Pool.cc:55
zypp::sat::Pool::systemRepo
Repository systemRepo()
Return the system repository, create it if missing.
Definition: Pool.cc:178
zypp::Iterable
Definition: Iterable.h:36
zypp::sat::Pool::getRequestedLocales
const LocaleSet & getRequestedLocales() const
Return the requested locales.
Definition: Pool.cc:245