14 #include <boost/mpl/int.hpp>
46 #undef ZYPP_BASE_LOGGER_LOGGROUP
47 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::satpool"
81 static const std::string _val(
"@System" );
87 static const Pathname _val(
"/etc/sysconfig/storage" );
94 static void logSat(
struct _Pool *,
void *data,
int type,
const char *logString )
96 if ( type & (SOLV_FATAL|SOLV_ERROR) ) {
97 _ERR(
"libsolv") << logString;
98 }
else if ( type & SOLV_DEBUG_STATS ) {
99 _DBG(
"libsolv") << logString;
101 _MIL(
"libsolv") << logString;
117 case NAMESPACE_LANGUAGE:
120 const std::tr1::unordered_set<IdString> & locale2Solver( reinterpret_cast<PoolImpl*>(data)->
_locale2Solver );
121 if ( locale2Solver.empty() )
123 return rhs == en.
id() ? RET_systemProperty : RET_unsupported;
125 return locale2Solver.find(
IdString(rhs) ) != locale2Solver.end() ? RET_systemProperty : RET_unsupported;
129 case NAMESPACE_MODALIAS:
139 case NAMESPACE_FILESYSTEM:
142 return requiredFilesystems.find(
IdString(rhs).
asString() ) != requiredFilesystems.end() ? RET_systemProperty : RET_unsupported;
146 case NAMESPACE_PRODUCTBUDDY:
156 return RET_unsupported;
176 : _pool( ::pool_create() )
178 MIL <<
"Creating sat-pool." << endl;
184 if ( getenv(
"ZYPP_LIBSOLV_FULLLOG") || getenv(
"ZYPP_LIBSAT_FULLLOG") )
185 ::pool_setdebuglevel(
_pool, 4 );
186 else if ( getenv(
"ZYPP_FULLLOG") )
187 ::pool_setdebuglevel(
_pool, 2 );
189 ::pool_setdebugmask(
_pool, SOLV_DEBUG_JOB|SOLV_DEBUG_STATS);
195 _pool->nscallbackdata = (
void*)
this;
205 ::pool_free(
_pool );
214 if ( a3 )
MIL << a1 <<
" " << a2 <<
" " << a3 << endl;
215 else if ( a2 )
MIL << a1 <<
" " << a2 << endl;
216 else MIL << a1 << endl;
230 if ( a3 )
MIL << a1 <<
" " << a2 <<
" " << a3 << endl;
231 else if ( a2 )
MIL << a1 <<
" " << a2 << endl;
232 else MIL << a1 << endl;
234 ::pool_freewhatprovides(
_pool );
245 if ( !
_pool->whatprovides )
247 MIL <<
"pool_createwhatprovides..." << endl;
249 ::pool_addfileprovides(
_pool );
250 ::pool_createwhatprovides(
_pool );
252 if ( !
_pool->languages )
276 setDirty(__FUNCTION__, name_r.c_str() );
277 ::_Repo * ret = ::repo_create(
_pool, name_r.c_str() );
279 ::pool_set_installed(
_pool, ret );
285 setDirty(__FUNCTION__, repo_r->name );
286 ::repo_free( repo_r,
false );
297 setDirty(__FUNCTION__, repo_r->name );
298 int ret = ::repo_add_solv( repo_r, file_r, 0 );
306 setDirty(__FUNCTION__, repo_r->name );
318 std::set<detail::IdType> sysids;
321 for_( it, sysarchs.begin(), sysarchs.end() )
322 sysids.insert( it->id() );
325 sysids.insert( ARCH_SRC );
326 sysids.insert( ARCH_NOSRC );
330 unsigned blockSize = 0;
333 ::_Solvable * s(
_pool->solvables + i );
334 if ( s->repo == repo_r && sysids.find( s->arch ) == sysids.end() )
341 else if ( blockSize )
344 ::repo_free_solvable_block( repo_r, blockBegin, blockSize,
false );
345 blockBegin = blockSize = 0;
351 ::repo_free_solvable_block( repo_r, blockBegin, blockSize,
false );
352 blockBegin = blockSize = 0;
364 setDirty(__FUNCTION__, repo_r->name );
365 return ::repo_add_solvable_block( repo_r, count_r );
370 ::_Repo * repo(
getRepo( id_r ) );
377 if ( repo->priority !=
int(-info_r.
priority()) )
379 repo->priority = -info_r.
priority();
386 if ( repo->subpriority != mediaPriority )
388 repo->subpriority = mediaPriority;
402 std::tr1::unordered_set<IdString> & locale2Solver )
404 std::tr1::unordered_set<IdString>( 2*locales_r.size() ).swap( locale2Solver );
405 for_( it, locales_r.begin(),locales_r.end() )
408 locale2Solver.insert(
IdString( l.code() ) );
410 MIL <<
"New Solver Locales: " << locale2Solver << endl;
415 std::vector<std::string> fallbacklist;
418 fallbacklist.push_back( l.code() );
420 dumpRangeLine(
MIL <<
"pool_set_languages: ", fallbacklist.begin(), fallbacklist.end() ) << endl;
422 std::vector<const char *> fallbacklist_cstr;
423 for_( it, fallbacklist.begin(), fallbacklist.end() )
425 fallbacklist_cstr.push_back( it->c_str() );
427 ::pool_set_languages(
_pool, &fallbacklist_cstr.front(), fallbacklist_cstr.size() );
434 MIL <<
"New RequestedLocales: " << locales_r << endl;
466 switch ( detail.
capRel() )
476 if ( detail.
lhs().
id() == NAMESPACE_LANGUAGE )
478 store_r.insert( detail.
rhs().
id() );
495 std::tr1::unordered_set<sat::detail::IdType> tmp;
500 for_( cit, cap.begin(), cap.end() )
505 #warning immediately build LocaleSet as soon as Loale is an Id based type
507 for_( it, tmp.begin(), tmp.end() )
520 const std::set<std::string> & multiversionSpec(
ZConfig::instance().multiversionSpec() );
521 for_( it, multiversionSpec.begin(), multiversionSpec.end() )
523 static const std::string prefix(
"provides:" );
527 if ( provides.
empty() )
529 MIL <<
"Multiversion install not provided (" << *it <<
")" << endl;
535 if ( multiversionList.insert( pit->ident() ).second )
536 MIL <<
"Multiversion install " << pit->ident() <<
" (" << *it <<
")" << endl;
542 MIL <<
"Multiversion install " << *it << endl;
543 multiversionList.insert(
IdString( *it ) );
556 MIL <<
"Target not initialized." << endl;
560 MIL <<
"onSystemByUserList from history: " << pi << endl;
566 std::ifstream infile( pi.path().c_str() );
569 const char * ch( (*in).c_str() );
571 if ( *ch <
'1' ||
'9' < *ch )
573 const char * sep1 = ::strchr( ch,
'|' );
578 bool installs =
true;
579 if ( ::strncmp( sep1,
"install|", 8 ) )
581 if ( ::strncmp( sep1,
"remove |", 8 ) )
588 const char * sep2 = ::strchr( sep1,
'|' );
589 if ( !sep2 || sep1 == sep2 )
591 (*in)[sep2-ch] =
'\0';
596 onSystemByUserList.erase( pkg );
600 if ( (sep1 = ::strchr( sep2+1,
'|' ))
601 && (sep1 = ::strchr( sep1+1,
'|' ))
602 && (sep2 = ::strchr( sep1+1,
'|' )) )
604 (*in)[sep2-ch] =
'\0';
605 if ( ::strchr( sep1+1,
'@' ) )
608 onSystemByUserList.insert( pkg );
613 MIL <<
"onSystemByUserList found: " << onSystemByUserList.size() << endl;
623 std::inserter( requiredFilesystems, requiredFilesystems.end() ) );