12 #include <sys/types.h>
18 #include <solv/pool.h>
19 #include <solv/repo.h>
20 #include <solv/solvable.h>
53 {
return myPool()->nsolvables; }
71 {
return !
myPool()->urepos; }
74 {
return myPool()->urepos; }
97 if ( ! it->solvablesEmpty() )
111 ret += it->solvablesSize();
146 if ( alias_r == it->alias() )
169 tmprepo->addSolv( file_r );
177 {
return addRepoSolv( file_r, file_r.basename() ); }
193 tmprepo->addHelix( file_r );
253 return str <<
"sat::pool(" << obj.
serial() <<
")["
260 #undef ZYPP_BASE_LOGGER_LOGGROUP
261 #define ZYPP_BASE_LOGGER_LOGGROUP "solvidx"
269 ERR <<
"Can't open solv-file: " << solv << endl;
273 std::string solvidxfile( solvfile_r.extend(
".idx").asString() );
274 if ( ::
unlink( solvidxfile.c_str() ) == -1 && errno != ENOENT )
276 ERR <<
"Can't unlink solv-idx: " <<
Errno() << endl;
280 int fd = ::open( solvidxfile.c_str(), O_CREAT|O_EXCL|O_WRONLY|O_TRUNC, 0644 );
283 ERR <<
"Can't create solv-idx: " <<
Errno() << endl;
288 std::ofstream idx( solvidxfile.c_str() );
293 if ( ::repo_add_solv( _repo, solv, 0 ) == 0 )
297 FOR_REPO_SOLVABLES( _repo, _id, _solv )
302 #define idstr(V) pool_id2str( _pool, _solv->V )
303 if ( _solv->arch == ARCH_SRC || _solv->arch == ARCH_NOSRC )
304 idx <<
"srcpackage:" <<
idstr(name) <<
SEP <<
idstr(evr) <<
SEP <<
"noarch" << endl;
312 ERR <<
"Can't read solv-file: " << ::pool_errstr( _pool ) << endl;
314 ::repo_free( _repo, 0 );
315 ::pool_free( _pool );
Repository reposInsert(const std::string &alias_r)
Return a Repository named alias_r.
Pathname rootDir() const
Get rootdir (for file conflicts check)
std::string alias() const
unique identifier for this source.
bool eraseRequestedLocale(const Locale &locale_r)
User change (tracked).
void setRequestedLocales(const LocaleSet &locales_r)
Set the requested locales.
void setAutorefresh(bool autorefresh)
enable or disable autorefresh
size_type reposSize() const
Number of repos in Pool.
Convenience errno wrapper.
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
SolvableIterator solvablesEnd() const
Iterator behind the last Solvable.
::_Repo CRepo
Wrapped libsolv C data type exposed as backdoor.
bool addRequestedLocale(const Locale &locale_r)
User change (tracked).
void prepareForSolving() const
prepare plus some expensive checks done before solving only.
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
void setEnabled(bool enabled)
enable or disable the repository
::_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
void setAlias(const std::string &alias)
set the repository alias
void setAutoInstalled(const Queue &autoInstalled_r)
Set ident list of all autoinstalled solvables.
bool isRequestedLocale(const Locale &locale_r) const
Whether this Locale is in the set of requested locales.
detail::CPool * get() const
Expert backdoor.
What is known about a repository.
bool isAvailableLocale(const Locale &locale_r) const
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
const MultiversionList & multiversion() const
const LocaleSet & getAddedRequestedLocales() const
Added since last initRequestedLocales.
Repository addRepoHelix(const Pathname &file_r, const std::string &name_r)
Load Solvables from a helix-file into a Repository named name_r.
::_Solvable CSolvable
Wrapped libsolv C data type exposed as backdoor.
bool isSystemRepo() const
Return whether this is the system repository.
const MultiversionList & multiversionList() const
const SerialNumber & serial() const
Housekeeping data serial number.
const LocaleSet & getRequestedLocales() const
Current set of requested Locales.
size_type solvablesSize() const
Number of solvables in Pool.
const SerialNumber & serial() const
Serial number changing whenever the content changes.
RepositoryIterator reposEnd() const
Iterator behind the last Repository.
size_type capacity() const
Internal array size for stats only.
const LocaleSet & getAvailableLocales() const
All Locales occurring in any repo.
Repository systemRepo()
Return the system repository, create it if missing.
void initRequestedLocales(const LocaleSet &locales_r)
Start tracking changes based on this locales_r.
Functor removing Repository from it's Pool.
const LocaleSet & getRemovedRequestedLocales() const
Removed since last initRequestedLocales.
const LocaleSet & getRemovedRequestedLocales() const
Removed since last initRequestedLocales.
int unlink(const Pathname &path)
Like 'unlink'.
static const std::string & systemRepoAlias()
Reserved system repository alias .
void setInfo(const RepoInfo &info_r)
Set RepoInfo for this repository.
zypp::detail::RepositoryIterator RepositoryIterator
void setRequestedLocales(const LocaleSet &locales_r)
User change (tracked).
Queue autoInstalled() const
Get ident list of all autoinstalled solvables.
bool reposEmpty() const
Whether Pool contains repos.
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
RepositoryIterator reposBegin() const
Iterator to the first Repository.
Pathname rootDir() const
Get rootdir (for file conflicts check)
void updateSolvFileIndex(const Pathname &solvfile_r)
Create solv file content digest for zypper bash completion.
StringQueue autoInstalled() const
Get ident list of all autoinstalled solvables.
static PoolImpl & myPool()
detail::SolvableIterator SolvableIterator
bool addRequestedLocale(const Locale &locale_r)
Add one Locale to the set of requested locales.
void resetDispose()
Set no dispose function.
Simple serial number provider.
'Language[_Country]' codes.
Libsolv Id queue wrapper.
const LocaleSet & getAddedRequestedLocales() const
Added since last initRequestedLocales.
detail::size_type size_type
void setTextLocale(const Locale &locale_r)
const LocaleSet & getRequestedLocales() const
Return the requested locales.
void prepare() const
Update housekeeping data (e.g.
bool isAvailableLocale(const Locale &locale_r) const
Whether this Locale is in the set of available locales.
void initRequestedLocales(const LocaleSet &locales_r)
Start tracking changes based on this locales_r.
static const std::string & systemRepoAlias()
Reserved system repository alias .
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
void prepare() const
Update housekeeping data if necessary (e.g.
SolvableIterator solvablesBegin() const
Iterator to the first Solvable.
const LocaleSet & getAvailableLocales() const
Get the set of available locales.
bool isRequestedLocale(const Locale &locale_r) const
void setName(const std::string &name)
set the repository name
Repository addRepoSolv(const Pathname &file_r, const std::string &name_r)
Load Solvables from a solv-file into a Repository named name_r.
bool solvablesEmpty() const
Whether Pool contains solvables.
Repository findSystemRepo() const
Return the system repository if it is on the pool.
bool eraseRequestedLocale(const Locale &locale_r)
Erase one Locale from the set of requested locales.
std::unordered_set< Locale > LocaleSet
void prepareForSolving() const
prepare plus some expensive checks done before solving only.
void setAutoInstalled(const StringQueue &autoInstalled_r)
Set ident list of all autoinstalled solvables.
Iterable< RepositoryIterator > repos() const
Iterate the repositories.
Solvable set wrapper to allow adding additioanal convenience iterators.