libzypp: zypp/sat/detail/PoolImpl.cc Source File

libzypp 17.25.10

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