libzypp  16.20.4
PoolImpl.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <iostream>
13 #include <fstream>
14 #include <boost/mpl/int.hpp>
15 
16 #include "zypp/base/Easy.h"
17 #include "zypp/base/LogTools.h"
18 #include "zypp/base/Gettext.h"
19 #include "zypp/base/Exception.h"
20 #include "zypp/base/Measure.h"
21 #include "zypp/base/WatchFile.h"
22 #include "zypp/base/Sysconfig.h"
23 #include "zypp/base/IOStream.h"
24 
25 #include "zypp/ZConfig.h"
26 
28 #include "zypp/sat/SolvableSet.h"
29 #include "zypp/sat/Pool.h"
30 #include "zypp/Capability.h"
31 #include "zypp/Locale.h"
32 #include "zypp/PoolItem.h"
33 
36 
37 #ifndef JEZYPP_NO_HELIXREPO
38 extern "C"
39 {
40 // Workaround libsolv project not providing a common include
41 // directory. (the -devel package does, but the git repo doesn't).
42 // #include <solv/repo_helix.h>
43 int repo_add_helix( ::Repo *repo, FILE *fp, int flags );
44 }
45 #endif
46 
47 using std::endl;
48 
49 #undef ZYPP_BASE_LOGGER_LOGGROUP
50 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::satpool"
51 
52 // ///////////////////////////////////////////////////////////////////
53 namespace zypp
54 {
56  namespace env
57  {
59  inline int LIBSOLV_DEBUGMASK()
60  {
61  const char * envp = getenv("LIBSOLV_DEBUGMASK");
62  return envp ? str::strtonum<int>( envp ) : 0;
63  }
64  } // namespace env
66  namespace sat
67  {
68 
70  namespace detail
71  {
72 
73  // MPL checks for satlib constants we redefine to avoid
74  // includes and defines.
75  BOOST_MPL_ASSERT_RELATION( noId, ==, STRID_NULL );
76  BOOST_MPL_ASSERT_RELATION( emptyId, ==, STRID_EMPTY );
77 
79  BOOST_MPL_ASSERT_RELATION( systemSolvableId, ==, SYSTEMSOLVABLE );
80 
81  BOOST_MPL_ASSERT_RELATION( solvablePrereqMarker, ==, SOLVABLE_PREREQMARKER );
82  BOOST_MPL_ASSERT_RELATION( solvableFileMarker, ==, SOLVABLE_FILEMARKER );
83 
89 
90  BOOST_MPL_ASSERT_RELATION( namespaceModalias, ==, NAMESPACE_MODALIAS );
91  BOOST_MPL_ASSERT_RELATION( namespaceLanguage, ==, NAMESPACE_LANGUAGE );
92  BOOST_MPL_ASSERT_RELATION( namespaceFilesystem, ==, NAMESPACE_FILESYSTEM );
93 
95 
96  const std::string & PoolImpl::systemRepoAlias()
97  {
98  static const std::string _val( "@System" );
99  return _val;
100  }
101 
103  {
104  static const Pathname _val( "/etc/sysconfig/storage" );
105  return _val;
106  }
107 
109 
110  static void logSat( CPool *, void *data, int type, const char *logString )
111  {
112  // "1234567890123456789012345678901234567890
113  if ( 0 == strncmp( logString, " - no rule created", 19 ) )
114  return;
115  if ( 0 == strncmp( logString, " next rules: 0 0", 19 ) )
116  return;
117 
118  if ( type & (SOLV_FATAL|SOLV_ERROR) ) {
119  L_ERR("libsolv") << logString;
120  } else if ( type & SOLV_DEBUG_STATS ) {
121  L_DBG("libsolv") << logString;
122  } else {
123  L_MIL("libsolv") << logString;
124  }
125  }
126 
128  {
129  // lhs: the namespace identifier, e.g. NAMESPACE:MODALIAS
130  // rhs: the value, e.g. pci:v0000104Cd0000840[01]sv*sd*bc*sc*i*
131  // return: 0 if not supportded
132  // 1 if supported by the system
133  // -1 AFAIK it's also possible to return a list of solvables that support it, but don't know how.
134 
135  static const detail::IdType RET_unsupported = 0;
136  static const detail::IdType RET_systemProperty = 1;
137  switch ( lhs )
138  {
139  case NAMESPACE_LANGUAGE:
140  {
141  const TrackedLocaleIds & localeIds( reinterpret_cast<PoolImpl*>(data)->trackedLocaleIds() );
142  return localeIds.contains( IdString(rhs) ) ? RET_systemProperty : RET_unsupported;
143  }
144  break;
145 
146  case NAMESPACE_MODALIAS:
147  {
148  // modalias strings in capability may be hexencoded because rpm does not allow
149  // ',', ' ' or other special chars.
150  return target::Modalias::instance().query( str::hexdecode( IdString(rhs).c_str() ) )
151  ? RET_systemProperty
152  : RET_unsupported;
153  }
154  break;
155 
156  case NAMESPACE_FILESYSTEM:
157  {
158  const std::set<std::string> & requiredFilesystems( reinterpret_cast<PoolImpl*>(data)->requiredFilesystems() );
159  return requiredFilesystems.find( IdString(rhs).asString() ) != requiredFilesystems.end() ? RET_systemProperty : RET_unsupported;
160  }
161  break;
162 
163  }
164 
165  WAR << "Unhandled " << Capability( lhs ) << " vs. " << Capability( rhs ) << endl;
166  return RET_unsupported;
167  }
168 
170  //
171  // METHOD NAME : PoolMember::myPool
172  // METHOD TYPE : PoolImpl
173  //
175  {
176  static PoolImpl _global;
177  return _global;
178  }
179 
181  //
182  // METHOD NAME : PoolImpl::PoolImpl
183  // METHOD TYPE : Ctor
184  //
186  : _pool( ::pool_create() )
187  {
188  MIL << "Creating sat-pool." << endl;
189  if ( ! _pool )
190  {
191  ZYPP_THROW( Exception( _("Can not create sat-pool.") ) );
192  }
193  // by now we support only a RPM backend
194  ::pool_setdisttype(_pool, DISTTYPE_RPM );
195 
196  // initialialize logging
197  if ( env::LIBSOLV_DEBUGMASK() )
198  {
199  ::pool_setdebugmask(_pool, env::LIBSOLV_DEBUGMASK() );
200  }
201  else
202  {
203  if ( getenv("ZYPP_LIBSOLV_FULLLOG") || getenv("ZYPP_LIBSAT_FULLLOG") )
204  ::pool_setdebuglevel( _pool, 3 );
205  else if ( getenv("ZYPP_FULLLOG") )
206  ::pool_setdebuglevel( _pool, 2 );
207  else
208  ::pool_setdebugmask(_pool, SOLV_DEBUG_JOB|SOLV_DEBUG_STATS );
209  }
210 
211  ::pool_setdebugcallback( _pool, logSat, NULL );
212 
213  // set namespace callback
214  _pool->nscallback = &nsCallback;
215  _pool->nscallbackdata = (void*)this;
216  }
217 
219  //
220  // METHOD NAME : PoolImpl::~PoolImpl
221  // METHOD TYPE : Dtor
222  //
224  {
225  ::pool_free( _pool );
226  }
227 
229 
230  void PoolImpl::setDirty( const char * a1, const char * a2, const char * a3 )
231  {
232  if ( a1 )
233  {
234  if ( a3 ) MIL << a1 << " " << a2 << " " << a3 << endl;
235  else if ( a2 ) MIL << a1 << " " << a2 << endl;
236  else MIL << a1 << endl;
237  }
238  _serial.setDirty(); // pool content change
239  _availableLocalesPtr.reset(); // available locales may change
240  _multiversionListPtr.reset(); // re-evaluate ZConfig::multiversionSpec.
241 
242  depSetDirty(); // invaldate dependency/namespace related indices
243  }
244 
245  void PoolImpl::localeSetDirty( const char * a1, const char * a2, const char * a3 )
246  {
247  if ( a1 )
248  {
249  if ( a3 ) MIL << a1 << " " << a2 << " " << a3 << endl;
250  else if ( a2 ) MIL << a1 << " " << a2 << endl;
251  else MIL << a1 << endl;
252  }
253  _trackedLocaleIdsPtr.reset(); // requested locales changed
254  depSetDirty(); // invaldate dependency/namespace related indices
255  }
256 
257  void PoolImpl::depSetDirty( const char * a1, const char * a2, const char * a3 )
258  {
259  if ( a1 )
260  {
261  if ( a3 ) MIL << a1 << " " << a2 << " " << a3 << endl;
262  else if ( a2 ) MIL << a1 << " " << a2 << endl;
263  else MIL << a1 << endl;
264  }
265  ::pool_freewhatprovides( _pool );
266  }
267 
268  void PoolImpl::prepare() const
269  {
270  // additional /etc/sysconfig/storage check:
271  static WatchFile sysconfigFile( sysconfigStoragePath(), WatchFile::NO_INIT );
272  if ( sysconfigFile.hasChanged() )
273  {
274  _requiredFilesystemsPtr.reset(); // recreated on demand
275  const_cast<PoolImpl*>(this)->depSetDirty( "/etc/sysconfig/storage change" );
276  }
277  if ( _watcher.remember( _serial ) )
278  {
279  // After repo/solvable add/remove:
280  // set pool architecture
281  ::pool_setarch( _pool, ZConfig::instance().systemArchitecture().asString().c_str() );
282  }
283  if ( ! _pool->whatprovides )
284  {
285  MIL << "pool_createwhatprovides..." << endl;
286 
287  ::pool_addfileprovides( _pool );
288  ::pool_createwhatprovides( _pool );
289  }
290  if ( ! _pool->languages )
291  {
292  // initial seting
293  const_cast<PoolImpl*>(this)->setTextLocale( ZConfig::instance().textLocale() );
294  }
295  }
296 
298 
299  CRepo * PoolImpl::_createRepo( const std::string & name_r )
300  {
301  setDirty(__FUNCTION__, name_r.c_str() );
302  CRepo * ret = ::repo_create( _pool, name_r.c_str() );
303  if ( ret && name_r == systemRepoAlias() )
304  ::pool_set_installed( _pool, ret );
305  return ret;
306  }
307 
308  void PoolImpl::_deleteRepo( CRepo * repo_r )
309  {
310  setDirty(__FUNCTION__, repo_r->name );
311  if ( isSystemRepo( repo_r ) )
313  eraseRepoInfo( repo_r );
314  ::repo_free( repo_r, /*resusePoolIDs*/false );
315  // If the last repo is removed clear the pool to actually reuse all IDs.
316  // NOTE: the explicit ::repo_free above asserts all solvables are memset(0)!
317  if ( !_pool->urepos )
318  {
319  _serialIDs.setDirty(); // Indicate resusePoolIDs - ResPool must also invalidate it's PoolItems
320  ::pool_freeallrepos( _pool, /*resusePoolIDs*/true );
321  }
322  }
323 
324  int PoolImpl::_addSolv( CRepo * repo_r, FILE * file_r )
325  {
326  setDirty(__FUNCTION__, repo_r->name );
327  int ret = ::repo_add_solv( repo_r, file_r, 0 );
328  if ( ret == 0 )
329  _postRepoAdd( repo_r );
330  return ret;
331  }
332 
333  int PoolImpl::_addHelix( CRepo * repo_r, FILE * file_r )
334  {
335 #ifndef JEZYPP_NO_HELIXREPO
336  setDirty(__FUNCTION__, repo_r->name );
337  int ret = ::repo_add_helix( repo_r, file_r, 0 );
338  if ( ret == 0 )
339  _postRepoAdd( repo_r );
340 #endif
341  return 0;
342  }
343 
344  void PoolImpl::_postRepoAdd( CRepo * repo_r )
345  {
346  if ( ! isSystemRepo( repo_r ) )
347  {
348  // Filter out unwanted archs
349  std::set<detail::IdType> sysids;
350  {
351  Arch::CompatSet sysarchs( Arch::compatSet( ZConfig::instance().systemArchitecture() ) );
352  for_( it, sysarchs.begin(), sysarchs.end() )
353  sysids.insert( it->id() );
354 
355  // unfortunately libsolv treats src/nosrc as architecture:
356  sysids.insert( ARCH_SRC );
357  sysids.insert( ARCH_NOSRC );
358  }
359 
360  detail::IdType blockBegin = 0;
361  unsigned blockSize = 0;
362  for ( detail::IdType i = repo_r->start; i < repo_r->end; ++i )
363  {
364  CSolvable * s( _pool->solvables + i );
365  if ( s->repo == repo_r && sysids.find( s->arch ) == sysids.end() )
366  {
367  // Remember an unwanted arch entry:
368  if ( ! blockBegin )
369  blockBegin = i;
370  ++blockSize;
371  }
372  else if ( blockSize )
373  {
374  // Free remembered entries
375  ::repo_free_solvable_block( repo_r, blockBegin, blockSize, /*resusePoolIDs*/false );
376  blockBegin = blockSize = 0;
377  }
378  }
379  if ( blockSize )
380  {
381  // Free remembered entries
382  ::repo_free_solvable_block( repo_r, blockBegin, blockSize, /*resusePoolIDs*/false );
383  blockBegin = blockSize = 0;
384  }
385  }
386  }
387 
389  {
390  setDirty(__FUNCTION__, repo_r->name );
391  return ::repo_add_solvable_block( repo_r, count_r );
392  }
393 
394  void PoolImpl::setRepoInfo( RepoIdType id_r, const RepoInfo & info_r )
395  {
396  CRepo * repo( getRepo( id_r ) );
397  if ( repo )
398  {
399  bool dirty = false;
400 
401  // libsolv priority is based on '<', while yum's repoinfo
402  // uses 1(highest)->99(lowest). Thus we use -info_r.priority.
403  if ( repo->priority != int(-info_r.priority()) )
404  {
405  repo->priority = -info_r.priority();
406  dirty = true;
407  }
408 
409  // subpriority is used to e.g. prefer http over dvd iff
410  // both have same priority.
411  int mediaPriority( media::MediaPriority( info_r.url() ) );
412  if ( repo->subpriority != mediaPriority )
413  {
414  repo->subpriority = mediaPriority;
415  dirty = true;
416  }
417 
418  if ( dirty )
419  setDirty(__FUNCTION__, info_r.alias().c_str() );
420  }
421  _repoinfos[id_r] = info_r;
422  }
423 
425 
426  void PoolImpl::setTextLocale( const Locale & locale_r )
427  {
428  std::vector<std::string> fallbacklist;
429  for ( Locale l( locale_r ); l; l = l.fallback() )
430  {
431  fallbacklist.push_back( l.code() );
432  }
433  dumpRangeLine( MIL << "pool_set_languages: ", fallbacklist.begin(), fallbacklist.end() ) << endl;
434 
435  std::vector<const char *> fallbacklist_cstr;
436  for_( it, fallbacklist.begin(), fallbacklist.end() )
437  {
438  fallbacklist_cstr.push_back( it->c_str() );
439  }
440  ::pool_set_languages( _pool, &fallbacklist_cstr.front(), fallbacklist_cstr.size() );
441  }
442 
443  void PoolImpl::initRequestedLocales( const LocaleSet & locales_r )
444  {
445  if ( _requestedLocalesTracker.setInitial( locales_r ) )
446  {
447  localeSetDirty( "initRequestedLocales" );
448  MIL << "Init RequestedLocales: " << _requestedLocalesTracker << " =" << locales_r << endl;
449  }
450  }
451 
452  void PoolImpl::setRequestedLocales( const LocaleSet & locales_r )
453  {
454  if ( _requestedLocalesTracker.set( locales_r ) )
455  {
456  localeSetDirty( "setRequestedLocales" );
457  MIL << "New RequestedLocales: " << _requestedLocalesTracker << " =" << locales_r << endl;
458  }
459  }
460 
461  bool PoolImpl::addRequestedLocale( const Locale & locale_r )
462  {
463  bool done = _requestedLocalesTracker.add( locale_r );
464  if ( done )
465  {
466  localeSetDirty( "addRequestedLocale", locale_r.code().c_str() );
467  MIL << "New RequestedLocales: " << _requestedLocalesTracker << " +" << locale_r << endl;
468  }
469  return done;
470  }
471 
472  bool PoolImpl::eraseRequestedLocale( const Locale & locale_r )
473  {
474  bool done = _requestedLocalesTracker.remove( locale_r );
475  if ( done )
476  {
477  localeSetDirty( "addRequestedLocale", locale_r.code().c_str() );
478  MIL << "New RequestedLocales: " << _requestedLocalesTracker << " -" << locale_r << endl;
479  }
480  return done;
481  }
482 
483 
485  {
486  if ( ! _trackedLocaleIdsPtr )
487  {
489 
490  const base::SetTracker<LocaleSet> & localesTracker( _requestedLocalesTracker );
491  TrackedLocaleIds & localeIds( *_trackedLocaleIdsPtr );
492 
493  // Add current locales+fallback except for added ones
494  for ( Locale lang: localesTracker.current() )
495  {
496  if ( localesTracker.wasAdded( lang ) )
497  continue;
498  for ( ; lang; lang = lang.fallback() )
499  { localeIds.current().insert( IdString(lang) ); }
500  }
501 
502  // Add added locales+fallback except they are already in current
503  for ( Locale lang: localesTracker.added() )
504  {
505  for ( ; lang && localeIds.current().insert( IdString(lang) ).second; lang = lang.fallback() )
506  { localeIds.added().insert( IdString(lang) ); }
507  }
508 
509  // Add removed locales+fallback except they are still in current
510  for ( Locale lang: localesTracker.removed() )
511  {
512  for ( ; lang && ! localeIds.current().count( IdString(lang) ); lang = lang.fallback() )
513  { localeIds.removed().insert( IdString(lang) ); }
514  }
515 
516  // Assert that TrackedLocaleIds::current is not empty.
517  // If, so fill in LanguageCode::enCode as last resort.
518  if ( localeIds.current().empty() )
519  { localeIds.current().insert( IdString(Locale::enCode) ); }
520  }
521  return *_trackedLocaleIdsPtr;
522  }
523 
524 
525  static void _getLocaleDeps( const Capability & cap_r, LocaleSet & store_r )
526  {
527  // Collect locales from any 'namespace:language(lang)' dependency
528  CapDetail detail( cap_r );
529  if ( detail.kind() == CapDetail::EXPRESSION )
530  {
531  switch ( detail.capRel() )
532  {
533  case CapDetail::CAP_AND:
534  case CapDetail::CAP_OR:
535  // expand
536  _getLocaleDeps( detail.lhs(), store_r );
537  _getLocaleDeps( detail.rhs(), store_r );
538  break;
539 
541  if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
542  {
543  store_r.insert( Locale( IdString(detail.rhs().id()) ) );
544  }
545  break;
546 
547  case CapDetail::REL_NONE:
548  case CapDetail::CAP_WITH:
549  case CapDetail::CAP_ARCH:
550  break; // unwanted
551  }
552  }
553  }
554 
556  {
557  if ( !_availableLocalesPtr )
558  {
559  _availableLocalesPtr.reset( new LocaleSet );
560  LocaleSet & localeSet( *_availableLocalesPtr );
561 
562  for ( const Solvable & pi : Pool::instance().solvables() )
563  {
564  for ( const Capability & cap : pi.supplements() )
565  {
566  _getLocaleDeps( cap, localeSet );
567  }
568  }
569  }
570  return *_availableLocalesPtr;
571  }
572 
574 
576  {
579 
581  for ( const std::string & spec : ZConfig::instance().multiversionSpec() )
582  {
583  static const std::string prefix( "provides:" );
584  bool provides = str::hasPrefix( spec, prefix );
585 
586  for ( Solvable solv : WhatProvides( Capability( provides ? spec.c_str() + prefix.size() : spec.c_str() ) ) )
587  {
588  if ( provides || solv.ident() == spec )
589  multiversionList.insert( solv );
590  }
591 
593  MIL << "Multiversion install " << spec << ": " << (nsize-size) << " matches" << endl;
594  size = nsize;
595  }
596  }
597 
599  { _multiversionListPtr.reset(); }
600 
602  {
603  if ( ! _multiversionListPtr )
605  return *_multiversionListPtr;
606  }
607 
608  bool PoolImpl::isMultiversion( const Solvable & solv_r ) const
609  { return multiversionList().contains( solv_r ); }
610 
612 
613  const std::set<std::string> & PoolImpl::requiredFilesystems() const
614  {
615  if ( ! _requiredFilesystemsPtr )
616  {
617  _requiredFilesystemsPtr.reset( new std::set<std::string> );
618  std::set<std::string> & requiredFilesystems( *_requiredFilesystemsPtr );
620  std::inserter( requiredFilesystems, requiredFilesystems.end() ) );
621  }
622  return *_requiredFilesystemsPtr;
623  }
624 
626  } // namespace detail
629  } // namespace sat
632 } // namespace zypp
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
static const IdType namespaceModalias(18)
bool contains(const TSolv &solv_r) const
Definition: SolvableSet.h:68
bool contains(const key_type &key_r) const
Whether val_r is in the set.
Definition: SetTracker.h:129
unsigned priority() const
Repository priority for solver.
Definition: RepoInfo.cc:355
Interface to gettext.
#define MIL
Definition: Logger.h:64
const Pathname & sysconfigStoragePath()
Definition: PoolImpl.cc:102
CapRel capRel() const
Definition: Capability.h:353
int IdType
Generic Id type.
Definition: PoolMember.h:130
A Solvable object within the sat Pool.
Definition: Solvable.h:53
Container of Solvable providing a Capability (read only).
Definition: WhatProvides.h:87
Capability lhs() const
Definition: Capability.h:352
bool eraseRequestedLocale(const Locale &locale_r)
User change (tracked).
Definition: PoolImpl.cc:472
scoped_ptr< LocaleSet > _availableLocalesPtr
Definition: PoolImpl.h:331
std::string code() const
Return the locale code asString.
Definition: Locale.h:88
Track added/removed set items based on an initial set.
Definition: SetTracker.h:37
std::string asString(const DefaultIntegral< Tp, TInitial > &obj)
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition: Exception.h:350
static ZConfig & instance()
Singleton ctor.
Definition: Resolver.cc:125
void multiversionListInit() const
Definition: PoolImpl.cc:575
static const Locale enCode
Last resort "en".
Definition: Locale.h:77
bool remember(unsigned serial_r) const
Return isDirty, storing serial_r as new value.
Definition: SerialNumber.h:160
Locale textLocale() const
The locale for translated texts zypp uses.
Definition: ZConfig.cc:857
Helper providing more detailed information about a Capability.
Definition: Capability.h:298
int _addSolv(CRepo *repo_r, FILE *file_r)
Adding solv file to a repo.
Definition: PoolImpl.cc:324
base::SetTracker< LocaleSet > _requestedLocalesTracker
Definition: PoolImpl.h:328
#define L_MIL(GROUP)
Definition: Logger.h:73
::_Repo CRepo
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:88
bool addRequestedLocale(const Locale &locale_r)
User change (tracked).
Definition: PoolImpl.cc:461
#define L_ERR(GROUP)
Definition: Logger.h:75
void setDirty(const char *a1=0, const char *a2=0, const char *a3=0)
Invalidate housekeeping data (e.g.
Definition: PoolImpl.cc:230
bool set(set_type new_r)
Set a new_r set and track changes.
Definition: SetTracker.h:78
const std::set< std::string > & requiredFilesystems() const
accessor for etc/sysconfig/storage reading file on demand
Definition: PoolImpl.cc:613
bool hasChanged()
Definition: WatchFile.h:68
bool setInitial()
(Re-)Start tracking the current set (discards previously tracked changes).
Definition: SetTracker.h:57
const MultiversionList & multiversionList() const
Definition: PoolImpl.cc:601
void _deleteRepo(CRepo *repo_r)
Delete repo repo_r from pool.
Definition: PoolImpl.cc:308
std::set< Arch, CompareByGT< Arch > > CompatSet
Reversed arch order, best Arch first.
Definition: Arch.h:117
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
Definition: Locale.cc:208
::_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:86
bool wasAdded(const key_type &key_r) const
Whether val_r is tracked as added.
Definition: SetTracker.h:132
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition: PoolMember.h:151
void eraseRepoInfo(RepoIdType id_r)
Definition: PoolImpl.h:210
What is known about a repository.
Definition: RepoInfo.h:71
CRepo * RepoIdType
Id type to connect Repo and sat-repo.
Definition: PoolMember.h:159
Access to the sat-pools string space.
Definition: IdString.h:41
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \)
Split line_r into words.
Definition: String.h:519
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
detail::SolvableIdType _addSolvables(CRepo *repo_r, unsigned count_r)
Adding Solvables to a repo.
Definition: PoolImpl.cc:388
void localeSetDirty(const char *a1=0, const char *a2=0, const char *a3=0)
Invalidate locale related housekeeping data.
Definition: PoolImpl.cc:245
::_Solvable CSolvable
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:89
static const IdType solvableFileMarker(16)
map< string, string > read(const Pathname &_path)
Read sysconfig file path_r and return (key,valye) pairs.
Definition: Sysconfig.cc:34
CRepo * getRepo(RepoIdType id_r) const
Definition: PoolImpl.h:168
Remember a files attributes to detect content changes.
Definition: WatchFile.h:49
const set_type & removed() const
Return the set of removed items.
Definition: SetTracker.h:145
sat::detail::IdType id() const
Expert backdoor.
Definition: Capability.h:253
bool isSystemRepo(CRepo *repo_r) const
Definition: PoolImpl.h:99
int repo_add_helix(::Repo *repo, FILE *fp, int flags)
PoolImpl()
Default ctor.
Definition: PoolImpl.cc:185
Url url() const
Pars pro toto: The first repository url.
Definition: RepoInfo.h:131
static detail::IdType nsCallback(CPool *, void *data, detail::IdType lhs, detail::IdType rhs)
Callback to resolve namespace dependencies (language, modalias, filesystem, etc.).
Definition: PoolImpl.cc:127
static Pool instance()
Singleton ctor.
Definition: Pool.h:53
static const IdType emptyId(1)
void setRepoInfo(RepoIdType id_r, const RepoInfo &info_r)
Also adjust repo priority and subpriority accordingly.
Definition: PoolImpl.cc:394
const TrackedLocaleIds & trackedLocaleIds() const
Expanded _requestedLocalesTracker for solver.
Definition: PoolImpl.cc:484
SerialNumberWatcher _watcher
Watch serial number.
Definition: PoolImpl.h:323
std::string alias() const
unique identifier for this source.
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
void setRequestedLocales(const LocaleSet &locales_r)
User change (tracked).
Definition: PoolImpl.cc:452
const set_type & current() const
Return the current set.
Definition: SetTracker.h:139
#define WAR
Definition: Logger.h:65
bool add(const value_type &val_r)
Add an element to the set and track changes.
Definition: SetTracker.h:100
sat::StringQueue _autoinstalled
Definition: PoolImpl.h:338
const set_type & added() const
Return the set of added items.
Definition: SetTracker.h:142
#define _(MSG)
Definition: Gettext.h:29
SerialNumber _serialIDs
Serial number of IDs - changes whenever resusePoolIDs==true - ResPool must also invalidate it&#39;s PoolI...
Definition: PoolImpl.h:321
static PoolImpl & myPool()
Definition: PoolImpl.cc:174
static const IdType namespaceFilesystem(21)
bool query(IdString cap_r) const
Checks if a device on the system matches a modalias pattern.
Definition: Modalias.h:69
BOOST_MPL_ASSERT_RELATION(noId,==, STRID_NULL)
Kind kind() const
Definition: Capability.h:334
static CompatSet compatSet(const Arch &targetArch_r)
Return a set of all Arch&#39;s compatibleWith a targetArch_r.
Definition: Arch.cc:550
void prepare() const
Update housekeeping data (e.g.
Definition: PoolImpl.cc:268
bool isMultiversion(const Solvable &solv_r) const
Definition: PoolImpl.cc:608
&#39;Language[_Country]&#39; codes.
Definition: Locale.h:49
void _postRepoAdd(CRepo *repo_r)
Helper postprocessing the repo after adding solv or helix files.
Definition: PoolImpl.cc:344
SerialNumber _serial
Serial number - changes with each Pool content change.
Definition: PoolImpl.h:319
scoped_ptr< MultiversionList > _multiversionListPtr
Definition: PoolImpl.h:335
#define L_DBG(GROUP)
Definition: Logger.h:72
static Modalias & instance()
Singleton access.
Definition: Modalias.cc:198
void depSetDirty(const char *a1=0, const char *a2=0, const char *a3=0)
Invalidate housekeeping data (e.g.
Definition: PoolImpl.cc:257
static void logSat(CPool *, void *data, int type, const char *logString)
Definition: PoolImpl.cc:110
Base class for Exception.
Definition: Exception.h:143
scoped_ptr< std::set< std::string > > _requiredFilesystemsPtr
filesystems mentioned in /etc/sysconfig/storage
Definition: PoolImpl.h:341
void setTextLocale(const Locale &locale_r)
Definition: PoolImpl.cc:426
void clear()
Clear the queue.
Definition: Queue.cc:94
static const IdType namespaceLanguage(20)
std::map< RepoIdType, RepoInfo > _repoinfos
Additional RepoInfo.
Definition: PoolImpl.h:325
int LIBSOLV_DEBUGMASK()
Definition: PoolImpl.cc:59
A sat capability.
Definition: Capability.h:59
void initRequestedLocales(const LocaleSet &locales_r)
Start tracking changes based on this locales_r.
Definition: PoolImpl.cc:443
static const std::string & systemRepoAlias()
Reserved system repository alias .
Definition: PoolImpl.cc:96
static void _getLocaleDeps(const Capability &cap_r, LocaleSet &store_r)
Definition: PoolImpl.cc:525
static const IdType noId(0)
CPool * _pool
sat-pool.
Definition: PoolImpl.h:317
std::ostream & dumpRangeLine(std::ostream &str, TIterator begin, TIterator end)
Print range defined by iterators (single line style).
Definition: LogTools.h:114
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
const LocaleSet & getAvailableLocales() const
All Locales occurring in any repo.
Definition: PoolImpl.cc:555
bool remove(const value_type &val_r)
Remove an element from the set and track changes.
Definition: SetTracker.h:114
scoped_ptr< TrackedLocaleIds > _trackedLocaleIdsPtr
Definition: PoolImpl.h:329
Derive a numeric priority from Url scheme according to zypp.conf(download.media_preference).
Definition: MediaPriority.h:43
Container::size_type size_type
Definition: SolvableSet.h:42
Capability rhs() const
Definition: Capability.h:354
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
size_type size() const
Size of the set.
Definition: SolvableSet.h:63
int _addHelix(CRepo *repo_r, FILE *file_r)
Adding helix file to a repo.
Definition: PoolImpl.cc:333
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition: String.h:1037
CRepo * _createRepo(const std::string &name_r)
Creating a new repo named name_r.
Definition: PoolImpl.cc:299
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:27
std::string hexdecode(const C_Str &str_r)
Decode hexencoded XX sequences.
Definition: String.cc:143
bool insert(const TSolv &solv_r)
Insert a Solvable.
Definition: SolvableSet.h:88
Solvable set wrapper to allow adding additional convenience iterators.
Definition: SolvableSet.h:35