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