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