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