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;
94 const std::string & PoolImpl::systemRepoAlias()
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,
" - no rule created", 19 ) )
113 if ( 0 == strncmp( logString,
" next rules: 0 0", 19 ) )
116 if ( type & (SOLV_FATAL|SOLV_ERROR) ) {
117 L_ERR(
"libsolv") << logString;
118 }
else if ( type & SOLV_DEBUG_STATS ) {
119 L_DBG(
"libsolv") << logString;
121 L_MIL(
"libsolv") << logString;
137 case NAMESPACE_LANGUAGE:
139 const TrackedLocaleIds & localeIds( reinterpret_cast<PoolImpl*>(data)->trackedLocaleIds() );
140 return localeIds.
contains(
IdString(rhs) ) ? RET_systemProperty : RET_unsupported;
144 case NAMESPACE_MODALIAS:
154 case NAMESPACE_FILESYSTEM:
156 const std::set<std::string> & requiredFilesystems( reinterpret_cast<PoolImpl*>(data)->requiredFilesystems() );
157 return requiredFilesystems.find(
IdString(rhs).
asString() ) != requiredFilesystems.end() ? RET_systemProperty : RET_unsupported;
164 return RET_unsupported;
184 : _pool( ::pool_create() )
186 MIL <<
"Creating sat-pool." << endl;
192 ::pool_setdisttype(
_pool, DISTTYPE_RPM );
201 if ( getenv(
"ZYPP_LIBSOLV_FULLLOG") || getenv(
"ZYPP_LIBSAT_FULLLOG") )
202 ::pool_setdebuglevel(
_pool, 3 );
203 else if ( getenv(
"ZYPP_FULLLOG") )
204 ::pool_setdebuglevel(
_pool, 2 );
206 ::pool_setdebugmask(
_pool, SOLV_DEBUG_JOB|SOLV_DEBUG_STATS );
213 _pool->nscallbackdata = (
void*)
this;
223 ::pool_free(
_pool );
232 if ( a3 )
MIL << a1 <<
" " << a2 <<
" " << a3 << endl;
233 else if ( a2 )
MIL << a1 <<
" " << a2 << endl;
234 else MIL << a1 << endl;
247 if ( a3 )
MIL << a1 <<
" " << a2 <<
" " << a3 << endl;
248 else if ( a2 )
MIL << a1 <<
" " << a2 << endl;
249 else MIL << a1 << endl;
259 if ( a3 )
MIL << a1 <<
" " << a2 <<
" " << a3 << endl;
260 else if ( a2 )
MIL << a1 <<
" " << a2 << endl;
261 else MIL << a1 << endl;
263 ::pool_freewhatprovides(
_pool );
281 if ( !
_pool->whatprovides )
283 MIL <<
"pool_createwhatprovides..." << endl;
285 ::pool_addfileprovides(
_pool );
286 ::pool_createwhatprovides(
_pool );
288 if ( !
_pool->languages )
299 setDirty(__FUNCTION__, name_r.c_str() );
300 CRepo * ret = ::repo_create(
_pool, name_r.c_str() );
302 ::pool_set_installed(
_pool, ret );
308 setDirty(__FUNCTION__, repo_r->name );
312 ::repo_free( repo_r,
false );
315 if ( !
_pool->urepos )
316 ::pool_freeallrepos(
_pool,
true );
321 setDirty(__FUNCTION__, repo_r->name );
322 int ret = ::repo_add_solv( repo_r, file_r, 0 );
330 setDirty(__FUNCTION__, repo_r->name );
342 std::set<detail::IdType> sysids;
345 for_( it, sysarchs.begin(), sysarchs.end() )
346 sysids.insert( it->id() );
349 sysids.insert( ARCH_SRC );
350 sysids.insert( ARCH_NOSRC );
354 unsigned blockSize = 0;
358 if ( s->repo == repo_r && sysids.find( s->arch ) == sysids.end() )
365 else if ( blockSize )
368 ::repo_free_solvable_block( repo_r, blockBegin, blockSize,
false );
369 blockBegin = blockSize = 0;
375 ::repo_free_solvable_block( repo_r, blockBegin, blockSize,
false );
376 blockBegin = blockSize = 0;
383 setDirty(__FUNCTION__, repo_r->name );
384 return ::repo_add_solvable_block( repo_r, count_r );
396 if ( repo->priority !=
int(-info_r.
priority()) )
398 repo->priority = -info_r.
priority();
405 if ( repo->subpriority != mediaPriority )
407 repo->subpriority = mediaPriority;
421 std::vector<std::string> fallbacklist;
424 fallbacklist.push_back( l.code() );
426 dumpRangeLine(
MIL <<
"pool_set_languages: ", fallbacklist.begin(), fallbacklist.end() ) << endl;
428 std::vector<const char *> fallbacklist_cstr;
429 for_( it, fallbacklist.begin(), fallbacklist.end() )
431 fallbacklist_cstr.push_back( it->c_str() );
433 ::pool_set_languages(
_pool, &fallbacklist_cstr.front(), fallbacklist_cstr.size() );
489 if ( localesTracker.
wasAdded( lang ) )
491 for ( ; lang; lang = lang.fallback() )
498 for ( ; lang && localeIds.
current().insert(
IdString(lang) ).second; lang = lang.fallback() )
505 for ( ; lang && ! localeIds.
current().count(
IdString(lang) ); lang = lang.fallback() )
511 if ( localeIds.
current().empty() )
524 switch ( detail.
capRel() )
534 if ( detail.
lhs().
id() == NAMESPACE_LANGUAGE )
557 for (
const Capability & cap : pi.supplements() )
576 static const std::string prefix(
"provides:" );
581 if ( provides || solv.ident() == spec )
582 multiversionList.
insert( solv );
586 MIL <<
"Multiversion install " << spec <<
": " << (nsize-size) <<
" matches" << endl;
613 std::inserter( requiredFilesystems, requiredFilesystems.end() ) );
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
static const IdType namespaceModalias(18)
const Pathname & sysconfigStoragePath()
int IdType
Generic Id type.
A Solvable object within the sat Pool.
std::string alias() const
unique identifier for this source.
Container of Solvable providing a Capability (read only).
bool eraseRequestedLocale(const Locale &locale_r)
User change (tracked).
scoped_ptr< LocaleSet > _availableLocalesPtr
Track added/removed set items based on an initial set.
std::string asString(const DefaultIntegral< Tp, TInitial > &obj)
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
static ZConfig & instance()
Singleton ctor.
bool contains(const TSolv &solv_r) const
static const Locale enCode
Last resort "en".
Helper providing more detailed information about a Capability.
bool query(IdString cap_r) const
Checks if a device on the system matches a modalias pattern.
int _addSolv(CRepo *repo_r, FILE *file_r)
Adding solv file to a repo.
base::SetTracker< LocaleSet > _requestedLocalesTracker
const set_type & removed() const
Return the set of removed items.
::_Repo CRepo
Wrapped libsolv C data type exposed as backdoor.
bool addRequestedLocale(const Locale &locale_r)
User change (tracked).
void setDirty(const char *a1=0, const char *a2=0, const char *a3=0)
Invalidate housekeeping data (e.g.
bool set(set_type new_r)
Set a new_r set and track changes.
::_Repo * RepoIdType
Id type to connect Repo and sat-repo.
bool setInitial()
(Re-)Start tracking the current set (discards previously tracked changes).
void _deleteRepo(CRepo *repo_r)
Delete repo repo_r from pool.
std::set< Arch, CompareByGT< Arch > > CompatSet
Reversed arch order, best Arch first.
::_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
void eraseRepoInfo(RepoIdType id_r)
const set_type & current() const
Return the current set.
What is known about a repository.
const std::set< std::string > & requiredFilesystems() const
accessor for etc/sysconfig/storage reading file on demand
Access to the sat-pools string space.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
detail::SolvableIdType _addSolvables(CRepo *repo_r, unsigned count_r)
Adding Solvables to a repo.
void localeSetDirty(const char *a1=0, const char *a2=0, const char *a3=0)
Invalidate locale related housekeeping data.
::_Solvable CSolvable
Wrapped libsolv C data type exposed as backdoor.
static const IdType solvableFileMarker(16)
const MultiversionList & multiversionList() const
map< string, string > read(const Pathname &_path)
Read sysconfig file path_r and return (key,valye) pairs.
unsigned priority() const
Repository priority for solver.
size_type size() const
Size of the set.
const TrackedLocaleIds & trackedLocaleIds() const
Expanded _requestedLocalesTracker for solver.
Remember a files attributes to detect content changes.
void multiversionListInit() const
CRepo * getRepo(RepoIdType id_r) const
const LocaleSet & getAvailableLocales() const
All Locales occurring in any repo.
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.).
static Pool instance()
Singleton ctor.
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t")
Split line_r into words.
static const IdType emptyId(1)
void setRepoInfo(RepoIdType id_r, const RepoInfo &info_r)
Also adjust repo priority and subpriority accordingly.
SerialNumberWatcher _watcher
Watch serial number.
bool wasAdded(const key_type &key_r) const
Whether val_r is tracked as added.
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
void setRequestedLocales(const LocaleSet &locales_r)
User change (tracked).
bool add(const value_type &val_r)
Add an element to the set and track changes.
sat::StringQueue _autoinstalled
bool contains(const key_type &key_r) const
Whether val_r is in the set.
static const IdType namespaceFilesystem(21)
static CompatSet compatSet(const Arch &targetArch_r)
Return a set of all Arch's compatibleWith a targetArch_r.
'Language[_Country]' codes.
void _postRepoAdd(CRepo *repo_r)
Helper postprocessing the repo after adding solv or helix files.
SerialNumber _serial
Serial number.
const set_type & added() const
Return the set of added items.
scoped_ptr< MultiversionList > _multiversionListPtr
std::string code() const
Return the locale code asString.
static Modalias & instance()
Singleton access.
void depSetDirty(const char *a1=0, const char *a2=0, const char *a3=0)
Invalidate housekeeping data (e.g.
static void logSat(CPool *, void *data, int type, const char *logString)
Base class for Exception.
scoped_ptr< std::set< std::string > > _requiredFilesystemsPtr
filesystems mentioned in /etc/sysconfig/storage
void setTextLocale(const Locale &locale_r)
void clear()
Clear the queue.
static const IdType namespaceLanguage(20)
std::map< RepoIdType, RepoInfo > _repoinfos
Additional RepoInfo.
void prepare() const
Update housekeeping data (e.g.
bool isSystemRepo(CRepo *repo_r) const
void initRequestedLocales(const LocaleSet &locales_r)
Start tracking changes based on this locales_r.
static const std::string & systemRepoAlias()
Reserved system repository alias .
static void _getLocaleDeps(const Capability &cap_r, LocaleSet &store_r)
static const IdType noId(0)
Url url() const
Pars pro toto: The first repository url.
std::ostream & dumpRangeLine(std::ostream &str, TIterator begin, TIterator end)
Print range defined by iterators (single line style).
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
bool remove(const value_type &val_r)
Remove an element from the set and track changes.
Locale textLocale() const
The locale for translated texts zypp uses.
scoped_ptr< TrackedLocaleIds > _trackedLocaleIdsPtr
Container::size_type size_type
BOOST_MPL_ASSERT_RELATION(namespaceFilesystem,==, NAMESPACE_FILESYSTEM)
Easy-to use interface to the ZYPP dependency resolver.
int _addHelix(CRepo *repo_r, FILE *file_r)
Adding helix file to a repo.
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
CRepo * _createRepo(const std::string &name_r)
Creating a new repo named name_r.
std::unordered_set< Locale > LocaleSet
std::string hexdecode(const C_Str &str_r)
Decode hexencoded XX sequences.
void multiversionSpecChanged()
bool isMultiversion(const Solvable &solv_r) const
sat::detail::IdType id() const
Expert backdoor.
bool remember(unsigned serial_r) const
Return isDirty, storing serial_r as new value.
bool insert(const TSolv &solv_r)
Insert a Solvable.
Solvable set wrapper to allow adding additional convenience iterators.