14 #include <boost/mpl/int.hpp>
47 #undef ZYPP_BASE_LOGGER_LOGGROUP
48 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::satpool"
59 const char * envp = getenv(
"LIBSOLV_DEBUGMASK");
60 return envp ? str::strtonum<int>( envp ) : 0;
96 static const std::string _val(
"@System" );
102 static const Pathname _val(
"/etc/sysconfig/storage" );
108 static void logSat(
CPool *,
void *data,
int type,
const char *logString )
111 if ( 0 == strncmp( logString,
"job: user installed", 19 ) )
113 if ( 0 == strncmp( logString,
"job: multiversion", 17 ) )
115 if ( 0 == strncmp( logString,
" - no rule created", 19 ) )
117 if ( 0 == strncmp( logString,
" next rules: 0 0", 19 ) )
120 if ( type & (SOLV_FATAL|SOLV_ERROR) ) {
121 L_ERR(
"libsolv") << logString;
122 }
else if ( type & SOLV_DEBUG_STATS ) {
123 L_DBG(
"libsolv") << logString;
125 L_MIL(
"libsolv") << logString;
141 case NAMESPACE_LANGUAGE:
144 return localeIds.
contains(
IdString(rhs) ) ? RET_systemProperty : RET_unsupported;
148 case NAMESPACE_MODALIAS:
158 case NAMESPACE_FILESYSTEM:
161 return requiredFilesystems.find(
IdString(rhs).
asString() ) != requiredFilesystems.end() ? RET_systemProperty : RET_unsupported;
168 return RET_unsupported;
188 : _pool( ::pool_create() )
190 MIL <<
"Creating sat-pool." << endl;
196 ::pool_setdisttype(
_pool, DISTTYPE_RPM );
205 if ( getenv(
"ZYPP_LIBSOLV_FULLLOG") || getenv(
"ZYPP_LIBSAT_FULLLOG") )
206 ::pool_setdebuglevel(
_pool, 3 );
207 else if ( getenv(
"ZYPP_FULLLOG") )
208 ::pool_setdebuglevel(
_pool, 2 );
210 ::pool_setdebugmask(
_pool, SOLV_DEBUG_JOB|SOLV_DEBUG_STATS );
217 _pool->nscallbackdata = (
void*)
this;
227 ::pool_free(
_pool );
236 if ( a3 )
MIL << a1 <<
" " << a2 <<
" " << a3 << endl;
237 else if ( a2 )
MIL << a1 <<
" " << a2 << endl;
238 else MIL << a1 << endl;
252 if ( a3 )
MIL << a1 <<
" " << a2 <<
" " << a3 << endl;
253 else if ( a2 )
MIL << a1 <<
" " << a2 << endl;
254 else MIL << a1 << endl;
264 if ( a3 )
MIL << a1 <<
" " << a2 <<
" " << a3 << endl;
265 else if ( a2 )
MIL << a1 <<
" " << a2 << endl;
266 else MIL << a1 << endl;
268 ::pool_freewhatprovides(
_pool );
286 if ( !
_pool->whatprovides )
288 MIL <<
"pool_createwhatprovides..." << endl;
290 ::pool_addfileprovides(
_pool );
291 ::pool_createwhatprovides(
_pool );
293 if ( !
_pool->languages )
304 setDirty(__FUNCTION__, name_r.c_str() );
305 CRepo * ret = ::repo_create(
_pool, name_r.c_str() );
307 ::pool_set_installed(
_pool, ret );
313 setDirty(__FUNCTION__, repo_r->name );
317 ::repo_free( repo_r,
false );
320 if ( !
_pool->urepos )
323 ::pool_freeallrepos(
_pool,
true );
329 setDirty(__FUNCTION__, repo_r->name );
330 int ret = ::repo_add_solv( repo_r, file_r, 0 );
338 setDirty(__FUNCTION__, repo_r->name );
350 std::set<detail::IdType> sysids;
353 for_( it, sysarchs.begin(), sysarchs.end() )
354 sysids.insert( it->id() );
357 sysids.insert( ARCH_SRC );
358 sysids.insert( ARCH_NOSRC );
362 unsigned blockSize = 0;
366 if ( s->repo == repo_r && sysids.find( s->arch ) == sysids.end() )
373 else if ( blockSize )
376 ::repo_free_solvable_block( repo_r, blockBegin, blockSize,
false );
377 blockBegin = blockSize = 0;
383 ::repo_free_solvable_block( repo_r, blockBegin, blockSize,
false );
384 blockBegin = blockSize = 0;
391 setDirty(__FUNCTION__, repo_r->name );
392 return ::repo_add_solvable_block( repo_r, count_r );
404 if ( repo->priority !=
int(-info_r.
priority()) )
406 repo->priority = -info_r.
priority();
413 if ( repo->subpriority != mediaPriority )
415 repo->subpriority = mediaPriority;
432 const char *needone[] {
"en" };
433 ::pool_set_languages(
_pool, needone, 1 );
437 std::vector<std::string> fallbacklist;
440 fallbacklist.push_back( l.code() );
442 dumpRangeLine(
MIL <<
"pool_set_languages: ", fallbacklist.begin(), fallbacklist.end() ) << endl;
444 std::vector<const char *> fallbacklist_cstr;
445 for_( it, fallbacklist.begin(), fallbacklist.end() )
447 fallbacklist_cstr.push_back( it->c_str() );
449 ::pool_set_languages(
_pool, &fallbacklist_cstr.front(), fallbacklist_cstr.size() );
505 if ( localesTracker.
wasAdded( lang ) )
507 for ( ; lang; lang = lang.fallback() )
514 for ( ; lang && localeIds.
current().insert(
IdString(lang) ).second; lang = lang.fallback() )
521 for ( ; lang && ! localeIds.
current().count(
IdString(lang) ); lang = lang.fallback() )
527 if ( localeIds.
current().empty() )
540 switch ( detail.
capRel() )
550 if ( detail.
lhs().
id() == NAMESPACE_LANGUAGE )
573 for (
const Capability & cap : pi.supplements() )
592 static const std::string prefix(
"provides:" );
597 if ( provides || solv.ident() == spec )
598 multiversionList.
insert( solv );
602 MIL <<
"Multiversion install " << spec <<
": " << (nsize-size) <<
" matches" << endl;
629 std::inserter( requiredFilesystems, requiredFilesystems.end() ) );