Go to the documentation of this file.
14 #include <boost/mpl/int.hpp>
49 #undef ZYPP_BASE_LOGGER_LOGGROUP
50 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::satpool"
61 const char * envp = getenv(
"LIBSOLV_DEBUGMASK");
62 return envp ? str::strtonum<int>( envp ) : 0;
98 static const std::string _val(
"@System" );
104 static const Pathname _val(
"/etc/sysconfig/storage" );
110 static void logSat(
CPool *,
void *data,
int type,
const char *logString )
113 if ( 0 == strncmp( logString,
"job: user installed", 19 ) )
115 if ( 0 == strncmp( logString,
"job: multiversion", 17 ) )
117 if ( 0 == strncmp( logString,
" - no rule created", 19 ) )
119 if ( 0 == strncmp( logString,
" next rules: 0 0", 19 ) )
122 if ( type & (SOLV_FATAL|SOLV_ERROR) ) {
123 L_ERR(
"libsolv") << logString;
124 }
else if ( type & SOLV_DEBUG_STATS ) {
125 L_DBG(
"libsolv") << logString;
127 L_MIL(
"libsolv") << logString;
143 case NAMESPACE_LANGUAGE:
146 return localeIds.
contains(
IdString(rhs) ) ? RET_systemProperty : RET_unsupported;
150 case NAMESPACE_MODALIAS:
160 case NAMESPACE_FILESYSTEM:
170 return RET_unsupported;
190 : _pool( ::pool_create() )
192 MIL <<
"Creating sat-pool." << endl;
198 ::pool_setdisttype(
_pool, DISTTYPE_RPM );
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 );
212 ::pool_setdebugmask(
_pool, SOLV_DEBUG_JOB|SOLV_DEBUG_STATS );
219 _pool->nscallbackdata = (
void*)
this;
229 ::pool_free(
_pool );
238 if ( a3 )
MIL << a1 <<
" " << a2 <<
" " << a3 << endl;
239 else if ( a2 )
MIL << a1 <<
" " << a2 << endl;
240 else MIL << a1 << endl;
254 if ( a3 )
MIL << a1 <<
" " << a2 <<
" " << a3 << endl;
255 else if ( a2 )
MIL << a1 <<
" " << a2 << endl;
256 else MIL << a1 << endl;
266 if ( a3 )
MIL << a1 <<
" " << a2 <<
" " << a3 << endl;
267 else if ( a2 )
MIL << a1 <<
" " << a2 << endl;
268 else MIL << a1 << endl;
270 ::pool_freewhatprovides(
_pool );
288 if ( !
_pool->whatprovides )
290 MIL <<
"pool_createwhatprovides..." << endl;
292 ::pool_addfileprovides(
_pool );
293 ::pool_createwhatprovides(
_pool );
295 if ( !
_pool->languages )
306 setDirty(__FUNCTION__, name_r.c_str() );
307 CRepo * ret = ::repo_create(
_pool, name_r.c_str() );
309 ::pool_set_installed(
_pool, ret );
315 setDirty(__FUNCTION__, repo_r->name );
319 ::repo_free( repo_r,
false );
322 if ( !
_pool->urepos )
325 ::pool_freeallrepos(
_pool,
true );
331 setDirty(__FUNCTION__, repo_r->name );
332 int ret = ::repo_add_solv( repo_r, file_r, 0 );
340 setDirty(__FUNCTION__, repo_r->name );
349 setDirty(__FUNCTION__, repo_r->name );
361 std::set<detail::IdType> sysids;
364 for_( it, sysarchs.begin(), sysarchs.end() )
365 sysids.insert( it->id() );
368 sysids.insert( ARCH_SRC );
369 sysids.insert( ARCH_NOSRC );
373 unsigned blockSize = 0;
377 if ( s->repo == repo_r && sysids.find( s->arch ) == sysids.end() )
384 else if ( blockSize )
387 ::repo_free_solvable_block( repo_r, blockBegin, blockSize,
false );
388 blockBegin = blockSize = 0;
394 ::repo_free_solvable_block( repo_r, blockBegin, blockSize,
false );
395 blockBegin = blockSize = 0;
402 setDirty(__FUNCTION__, repo_r->name );
403 return ::repo_add_solvable_block( repo_r, count_r );
415 if ( repo->priority !=
int(-info_r.
priority()) )
417 repo->priority = -info_r.
priority();
424 if ( repo->subpriority != mediaPriority )
426 repo->subpriority = mediaPriority;
443 const char *needone[] {
"en" };
444 ::pool_set_languages(
_pool, needone, 1 );
448 std::vector<std::string> fallbacklist;
451 fallbacklist.push_back( l.code() );
453 dumpRangeLine(
MIL <<
"pool_set_languages: ", fallbacklist.begin(), fallbacklist.end() ) << endl;
455 std::vector<const char *> fallbacklist_cstr;
456 for_( it, fallbacklist.begin(), fallbacklist.end() )
458 fallbacklist_cstr.push_back( it->c_str() );
460 ::pool_set_languages(
_pool, &fallbacklist_cstr.front(), fallbacklist_cstr.size() );
516 if ( localesTracker.
wasAdded( lang ) )
518 for ( ; lang; lang = lang.fallback() )
525 for ( ; lang && localeIds.
current().insert(
IdString(lang) ).second; lang = lang.fallback() )
532 for ( ; lang && ! localeIds.
current().count(
IdString(lang) ); lang = lang.fallback() )
551 switch ( detail.
capRel() )
561 if ( detail.
lhs().
id() == NAMESPACE_LANGUAGE )
584 for (
const Capability & cap : pi.supplements() )
603 static const std::string prefix(
"provides:" );
608 if ( provides || solv.ident() == spec )
613 MIL <<
"Multiversion install " << spec <<
": " << (nsize-size) <<
" matches" << endl;
Remember a files attributes to detect content changes.
sat::detail::IdType id() const
Expert backdoor.
sat::StringQueue _autoinstalled
static Pool instance()
Singleton ctor.
void multiversionSpecChanged()
std::string code() const
Return the locale code asString.
void setDirty(const char *a1=0, const char *a2=0, const char *a3=0)
Invalidate housekeeping data (e.g.
static const std::string & systemRepoAlias()
Reserved system repository alias @System .
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
std::map< std::string, std::string > read(const Pathname &_path)
Read sysconfig file path_r and return (key,valye) pairs.
Solvable set wrapper to allow adding additional convenience iterators.
A Solvable object within the sat Pool.
const Pathname & sysconfigStoragePath()
Container of Solvable providing a Capability (read only).
static void _getLocaleDeps(const Capability &cap_r, LocaleSet &store_r)
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
BOOST_MPL_ASSERT_RELATION(noId,==, STRID_NULL)
bool remember(unsigned serial_r) const
Return isDirty, storing serial_r as new value.
Base class for Exception.
What is known about a repository.
static const IdType noId(0)
bool remove(const value_type &val_r)
Remove an element from the set and track changes.
bool insert(const TSolv &solv_r)
Insert a Solvable.
::s_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
Container::size_type size_type
static const IdType namespaceLanguage(20)
int _addHelix(CRepo *repo_r, FILE *file_r)
Adding helix file to a repo.
int _addSolv(CRepo *repo_r, FILE *file_r)
Adding solv file to a repo.
static const IdType namespaceModalias(18)
sat::SolvableSpec _needrebootSpec
Solvables which should trigger the reboot-needed hint if installed/updated.
size_type size() const
Size of the set.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
static PoolImpl & myPool()
const set_type & added() const
Return the set of added items.
CRepo * _createRepo(const std::string &name_r)
Creating a new repo named name_r.
unsigned priority() const
Repository priority for solver.
void prepare() const
Update housekeeping data (e.g.
const set_type & current() const
Return the current set.
bool add(const value_type &val_r)
Add an element to the set and track changes.
SerialNumber _serial
Serial number - changes with each Pool content change.
bool contains(const key_type &key_r) const
Whether val_r is in the set.
void eraseRepoInfo(RepoIdType id_r)
scoped_ptr< TrackedLocaleIds > _trackedLocaleIdsPtr
bool wasAdded(const key_type &key_r) const
Whether val_r is tracked as added.
static CompatSet compatSet(const Arch &targetArch_r)
Return a set of all Arch's compatibleWith a targetArch_r.
int repo_add_helix(::Repo *repo, FILE *fp, int flags)
void depSetDirty(const char *a1=0, const char *a2=0, const char *a3=0)
Invalidate housekeeping data (e.g.
bool setInitial()
(Re-)Start tracking the current set (discards previously tracked changes).
void setDirty() const
Explicitly flag the cache as dirty, so it will be rebuilt on the next request.
Locale textLocale() const
The locale for translated texts zypp uses.
static const IdType emptyId(1)
bool addRequestedLocale(const Locale &locale_r)
User change (tracked).
Access to the sat-pools string space.
SerialNumber _serialIDs
Serial number of IDs - changes whenever resusePoolIDs==true - ResPool must also invalidate it's PoolI...
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.
std::ostream & dumpRangeLine(std::ostream &str, TIterator begin, TIterator end)
Print range defined by iterators (single line style).
static detail::IdType nsCallback(CPool *, void *data, detail::IdType lhs, detail::IdType rhs)
Callback to resolve namespace dependencies (language, modalias, filesystem, etc.).
void _deleteRepo(CRepo *repo_r)
Delete repo repo_r from pool.
const LocaleSet & getAvailableLocales() const
All Locales occurring in any repo.
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
std::string alias() const
unique identifier for this source.
const std::set< std::string > & requiredFilesystems() const
accessor for etc/sysconfig/storage reading file on demand
CRepo * RepoIdType
Id type to connect Repo and sat-repo.
int IdType
Generic Id type.
void setRepoInfo(RepoIdType id_r, const RepoInfo &info_r)
Also adjust repo priority and subpriority accordingly.
static ZConfig & instance()
Singleton ctor.
int _addTesttags(CRepo *repo_r, FILE *file_r)
Adding testtags file to a repo.
void setRequestedLocales(const LocaleSet &locales_r)
User change (tracked).
Easy-to use interface to the ZYPP dependency resolver.
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
SerialNumberWatcher _watcher
Watch serial number.
bool query(IdString cap_r) const
Checks if a device on the system matches a modalias pattern.
void localeSetDirty(const char *a1=0, const char *a2=0, const char *a3=0)
Invalidate locale related housekeeping data.
void multiversionListInit() const
static void logSat(CPool *, void *data, int type, const char *logString)
base::SetTracker< LocaleSet > _requestedLocalesTracker
std::string asString(const DefaultIntegral< Tp, TInitial > &obj)
bool eraseRequestedLocale(const Locale &locale_r)
User change (tracked).
const MultiversionList & multiversionList() const
::s_Solvable CSolvable
Wrapped libsolv C data type exposed as backdoor.
Url url() const
Pars pro toto: The first repository url.
bool isSystemRepo(CRepo *repo_r) const
bool isMultiversion(const Solvable &solv_r) const
std::set< Arch, CompareByGT< Arch > > CompatSet
Reversed arch order, best Arch first.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
std::map< RepoIdType, RepoInfo > _repoinfos
Additional RepoInfo.
scoped_ptr< MultiversionList > _multiversionListPtr
void initRequestedLocales(const LocaleSet &locales_r)
Start tracking changes based on this locales_r.
std::unordered_set< Locale > LocaleSet
void setTextLocale(const Locale &locale_r)
const TrackedLocaleIds & trackedLocaleIds() const
Expanded _requestedLocalesTracker for solver.
scoped_ptr< std::set< std::string > > _requiredFilesystemsPtr
filesystems mentioned in /etc/sysconfig/storage
std::string hexdecode(const C_Str &str_r)
Decode hexencoded XX sequences.
CRepo * getRepo(RepoIdType id_r) const
scoped_ptr< LocaleSet > _availableLocalesPtr
bool set(set_type new_r)
Set a new_r set and track changes.
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
detail::SolvableIdType _addSolvables(CRepo *repo_r, unsigned count_r)
Adding Solvables to a repo.
const set_type & removed() const
Return the set of removed items.
Track added/removed set items based on an initial set.
static Modalias & instance()
Singleton access.
'Language[_Country]' codes.
static const IdType solvableFileMarker(16)
::s_Repo CRepo
Wrapped libsolv C data type exposed as backdoor.
int testcase_add_testtags(Repo *repo, FILE *fp, int flags)
void _postRepoAdd(CRepo *repo_r)
Helper postprocessing the repo after adding solv or helix files.
static const IdType namespaceFilesystem(21)
bool contains(const TSolv &solv_r) const
Helper providing more detailed information about a Capability.
void clear()
Clear the queue.