20#include <solv/repo_helix.h>
21#include <solv/testcase.h>
25#undef ZYPP_BASE_LOGGER_LOGGROUP
26#define ZYPP_BASE_LOGGER_LOGGROUP "zyppng::satpool"
33 const char * envp = getenv(
"LIBSOLV_DEBUGMASK");
42 static_assert(
noId == STRID_NULL );
43 static_assert(
emptyId == STRID_EMPTY );
66 static void logSat(
CPool *,
void *data,
int type,
const char *logString )
68 if ( 0 == strncmp( logString,
"job: drop orphaned", 18 ) )
70 if ( 0 == strncmp( logString,
"job: user installed", 19 ) )
72 if ( 0 == strncmp( logString,
"job: multiversion", 17 ) )
74 if ( 0 == strncmp( logString,
" - no rule created", 19 ) )
76 if ( 0 == strncmp( logString,
" next rules: 0 0", 19 ) )
79 if ( type & (SOLV_FATAL|SOLV_ERROR) ) {
80 L_ERR(
"libsolv") << logString;
81 }
else if ( type & SOLV_DEBUG_STATS ) {
82 L_DBG(
"libsolv") << logString;
84 L_MIL(
"libsolv") << logString;
92 ZYPP_PRECONDITION(
_pool->appdata ==
nullptr,
"Only one zyppng::sat::Pool instance per CPool is permitted" );
93 _pool->appdata =
this;
100 _pool->appdata =
nullptr;
104 {
return _pool->nsolvables; }
125 const bool indexRebuilt = (
_pool->whatprovides == nullptr );
126 if ( indexRebuilt ) {
127 MIL <<
"pool_createwhatprovides..." << std::endl;
128 ::pool_addfileprovides(
_pool );
129 ::pool_createwhatprovides(
_pool );
133 if ( !serialDirty && !indexRebuilt )
146 ::pool_freewhatprovides(
_pool );
147 ::pool_freeallrepos(
_pool,
true );
157 if ( reasons.size() ) {
159 for ( std::string_view r : reasons ) {
175 ::pool_freewhatprovides(
_pool );
180 static const std::string _val(
"@System" );
188 if ( alias_r ==
repo.alias() )
203 {
return _pool->urepos == 0; }
206 {
return _pool->urepos; }
213 for(
auto it =
_pool->repos+1; it !=
_pool->repos+
_pool->nrepos; it++ )
227 if ( !
_pool->installed )
239 if ( !
repo.solvablesEmpty() )
253 ret +=
repo.solvablesSize();
271 ::pool_set_installed(
_pool, ret );
283 ::repo_free( repo_r,
false );
284 if ( !
_pool->urepos )
287 ::pool_freeallrepos(
_pool,
true );
294 int ret = ::repo_add_solv( repo_r, file_r, 0 );
321 return ::repo_add_solvable_block( repo_r, count_r );
@ CAP_ARCH
Used internally.
Assign a vaiable a certain value when going out of scope.
size_type reposSize() const
Number of repos in Pool.
Iterable< RepositoryIterator > repos() const
Iterate the repositories.
bool solvablesEmpty() const
Whether Pool contains solvables.
Repository findSystemRepo() const
Return the system repository if it is on the pool.
size_type capacity() const
Internal array size for stats only.
Iterable< SolvableIterator > solvables() const
Iterate the solvables.
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
size_type solvablesSize() const
Number of solvables in Pool.
static const std::string & systemRepoAlias()
Reserved system repository alias @System .
Repository reposInsert(const std::string &alias_r)
Return a Repository named alias_r.
void prepare() const
Update housekeeping data if necessary (e.g.
Repository systemRepo()
Return the system repository, create it if missing.
bool reposEmpty() const
Whether Pool contains repos.
void _postRepoAdd(detail::CRepo *repo_r)
Helper postprocessing the repo after adding solv or helix files.
bool _preparing
True while prepare() is running — setDirty() is illegal in this window.
detail::CRepo * _createRepo(const std::string &name_r)
Creating a new repo named name_r.
void _deleteRepo(detail::CRepo *repo_r)
Delete repo repo_r from pool.
SerialNumber _serialIDs
Serial number of IDs - changes whenever resusePoolIDs==true - ResPool must also invalidate its PoolIt...
zypp::Iterable< detail::RepositoryIterator > RepositoryIterable
int _addTesttags(detail::CRepo *repo_r, FILE *file_r)
Adding testtags file to a repo.
zypp::Iterable< detail::SolvableIterator > SolvableIterable
SerialNumberWatcher _watcher
Watch serial number.
void clear()
Reset the pool by removing all repositories and solvables.
int _addHelix(detail::CRepo *repo_r, FILE *file_r)
Adding helix file to a repo.
PoolComponentSet _componentsSet
Component set managing modular pool logic.
detail::SolvableIdType getFirstId() const
Get id of the first valid Solvable.
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
int _addSolv(detail::CRepo *repo_r, FILE *file_r)
Adding solv file to a repo.
void setDirty(PoolInvalidation invalidation, std::initializer_list< std::string_view > reasons)
Invalidate everything.
detail::CPool * getPool() const
detail::CPool * _pool
sat-pool.
SerialNumber _serial
Serial number - changes with each Pool content change.
RepositoryIterable repos() const
Iteratable to the repositories.
static const std::string & systemRepoAlias()
Reserved system repository alias @System .
detail::SolvableIdType _addSolvables(detail::CRepo *repo_r, unsigned count_r)
Adding Solvables to a repo.
A move-only, non-owning view of a Pool that guarantees the whatprovides index is valid.
Singleton manager for the underlying libsolv string pool.
Iterate over valid Solvables in the pool.
TInt strtonum(const C_Str &str)
Parsing numbers from string.
static const IdType namespaceLanguage(20)
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
static void logSat(CPool *, void *data, int type, const char *logString)
static const IdType solvableFileMarker(16)
zypp::sat::detail::CPool CPool
static const IdType emptyId(1)
zypp::sat::detail::SolvableIdType SolvableIdType
static const IdType namespaceModalias(18)
static const IdType namespaceFilesystem(21)
static const IdType noId(0)
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
zypp::sat::detail::CRepo CRepo
This file contains private API, this might break at any time between releases.
PoolInvalidation
Defines the scope of an invalidation request for the Pool.
@ Data
Structural or data change (e.g., Rootfs, Arch, or Repo content).
Always-on precondition checking for NG code.
#define ZYPP_PRECONDITION(EXPR,...)
Always-on precondition check — fires in debug AND release builds.
int repo_add_helix(::Repo *repo, FILE *fp, int flags)
int testcase_add_testtags(Repo *repo, FILE *fp, int flags)