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 );
45 static_assert( noSolvableId == ID_NULL );
46 static_assert( systemSolvableId == SYSTEMSOLVABLE );
48 static_assert( solvablePrereqMarker == SOLVABLE_PREREQMARKER );
49 static_assert( solvableFileMarker == SOLVABLE_FILEMARKER );
61 static_assert( namespaceModalias == NAMESPACE_MODALIAS );
62 static_assert( namespaceLanguage == NAMESPACE_LANGUAGE );
63 static_assert( namespaceFilesystem == NAMESPACE_FILESYSTEM );
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.
bool remember(unsigned serial_r) const
Return isDirty, storing serial_r as new value.
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 notifyRepoAdded(Pool &pool, detail::RepoIdType id)
void notifyPrepareWithIndex(PreparedPool &pp)
Pass 3 of prepare(): post-index component work (stage/priority order).
void notifyPrepare(Pool &pool)
Pass 2 of prepare(): pre-index component work (stage/priority order).
void notifyReset(Pool &pool)
void notifyInvalidate(Pool &pool, PoolInvalidation invalidation)
void notifyCheckDirty(Pool &pool)
Pass 1 of prepare(): probe external state.
void notifyRepoRemoved(Pool &pool, detail::RepoIdType id)
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.
Repository()
Default ctor creates noRepository.
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 void logSat(CPool *, void *data, int type, const char *logString)
zypp::sat::detail::CPool CPool
zypp::sat::detail::SolvableIdType SolvableIdType
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)