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