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");
34 return envp ? zypp::str::strtonum<int>( envp ) : 0;
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" );
186 for(
const auto &repo :
repos() )
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 )
237 for(
const auto &repo :
repos() )
239 if ( ! repo.solvablesEmpty() )
251 for(
const auto &repo :
repos() )
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 );
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
static const IdType namespaceModalias(18)
int testcase_add_testtags(Repo *repo, FILE *fp, int flags)
SerialNumberWatcher _watcher
Watch serial number.
RepositoryIterable repos() const
Iteratable to the repositories.
detail::size_type solvablesSize() const
Number of solvables in Pool.
detail::size_type reposSize() const
Number of repos in Pool.
int _addTesttags(detail::CRepo *repo_r, FILE *file_r)
Adding testtags file to a repo.
bool _preparing
True while prepare() is running — setDirty() is illegal in this window.
Namespace intended to collect all environment variables we use.
void notifyCheckDirty(Pool &pool)
Pass 1 of prepare(): probe external state.
bool remember(unsigned serial_r) const
Return isDirty, storing serial_r as new value.
zypp::Iterable< detail::SolvableIterator > SolvableIterable
static void logSat(CPool *, void *data, int type, const char *logString)
Repository findSystemRepo() const
Return the system repository if it is on the pool.
void _postRepoAdd(detail::CRepo *repo_r)
Helper postprocessing the repo after adding solv or helix files.
static const IdType solvableFileMarker(16)
PreparedPool prepare()
Update housekeeping data (e.g.
zypp::sat::detail::CPool CPool
zypp::sat::detail::SolvableIdType SolvableIdType
detail::SolvableIdType _addSolvables(detail::CRepo *repo_r, unsigned count_r)
Adding Solvables to a repo.
PoolComponentSet _componentsSet
Component set managing modular pool logic.
void notifyRepoAdded(Pool &pool, detail::RepoIdType id)
Structural or data change (e.g., Rootfs, Arch, or Repo content).
A move-only, non-owning view of a Pool that guarantees the whatprovides index is valid.
bool solvablesEmpty() const
Whether Pool contains solvables.
SerialNumber _serialIDs
Serial number of IDs - changes whenever resusePoolIDs==true - ResPool must also invalidate its PoolIt...
Assign a vaiable a certain value when going out of scope.
int repo_add_helix(::Repo *repo, FILE *fp, int flags)
Repository systemRepo()
Return the system repository, create it if missing.
Singleton manager for the underlying libsolv string pool.
static const IdType emptyId(1)
Iterate over valid Solvables in the pool.
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
This file contains private API, this might break at any time between releases.
detail::CPool * _pool
sat-pool.
void notifyRepoRemoved(Pool &pool, detail::RepoIdType id)
void notifyReset(Pool &pool)
void setDirty(PoolInvalidation invalidation, std::initializer_list< std::string_view > reasons)
Invalidate everything.
zypp::Iterable< detail::RepositoryIterator > RepositoryIterable
static const IdType namespaceFilesystem(21)
zypp::sat::detail::CRepo CRepo
constexpr std::string_view FILE("file")
static const IdType namespaceLanguage(20)
detail::CRepo * _createRepo(const std::string &name_r)
Creating a new repo named name_r.
bool reposEmpty() const
Whether Pool contains repos.
PoolInvalidation
Defines the scope of an invalidation request for the Pool.
static const IdType noId(0)
#define ZYPP_PRECONDITION(EXPR,...)
Always-on precondition check — fires in debug AND release builds.
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
SerialNumber _serial
Serial number - changes with each Pool content change.
void notifyInvalidate(Pool &pool, PoolInvalidation invalidation)
int _addHelix(detail::CRepo *repo_r, FILE *file_r)
Adding helix file to a repo.
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
SolvableIterable solvables() const
Iterator to the first Solvable.
detail::size_type capacity() const
void notifyPrepare(Pool &pool)
Pass 2 of prepare(): pre-index component work (stage/priority order).
void _deleteRepo(detail::CRepo *repo_r)
Delete repo repo_r from pool.
detail::SolvableIdType getFirstId() const
Get id of the first valid Solvable.
Repository reposInsert(const std::string &alias_r)
Return a Repository named alias_r.
void notifyPrepareWithIndex(PreparedPool &pp)
Pass 3 of prepare(): post-index component work (stage/priority order).
int _addSolv(detail::CRepo *repo_r, FILE *file_r)
Adding solv file to a repo.
void clear()
Reset the pool by removing all repositories and solvables.
static const std::string & systemRepoAlias()
Reserved system repository alias .
Always-on precondition checking for NG code.