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