13 #include <solv/solvversion.h> 18 #include <zypp-core/ng/pipelines/MTry> 19 #include <zypp-core/ng/pipelines/Transform> 21 #include <zypp-core/ng/ui/ProgressObserver> 42 #undef ZYPP_BASE_LOGGER_LOGGROUP 43 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::repomanager" 57 const char *
env = getenv(
"ZYPP_PLUGIN_APPDATA_FORCE_COLLECT");
68 inline void cleanupNonRepoMetadataFolders(
const zypp::Pathname & cachePath_r,
70 const std::list<std::string> & repoEscAliases_r )
72 if ( cachePath_r != defaultCachePath_r )
75 std::list<std::string> entries;
79 std::set<std::string> oldfiles;
80 set_difference( entries.begin(), entries.end(), repoEscAliases_r.begin(), repoEscAliases_r.end(),
81 std::inserter( oldfiles, oldfiles.end() ) );
87 for (
const std::string & old : oldfiles )
91 pi( cachePath_r/old );
104 #define OUTS(V) case zypp::RepoManagerFlags::V: str << #V; break 116 #define OUTS(V) case zypp::RepoManagerFlags::V: str << #V; break 128 #define OUTS(V) case zypp::RepoManagerFlags::V: str << #V; break 139 std::string filename( alias_r );
144 MIL <<
"generating filename for " << stem_r <<
" [" << alias_r <<
"] : '" << filename <<
"'" << std::endl;
157 <<
"' distribution (current distro is '" 163 repos.push_back(repo);
170 MIL <<
"repo file: " << file << std::endl;
188 template <
typename ZContextRef>
191 MIL <<
"directory " << dir << std::endl;
192 std::list<RepoInfo> repos;
193 bool nonroot( geteuid() != 0 );
200 std::list<zypp::Pathname> entries;
208 for ( std::list<zypp::Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
219 repos.insert( repos.end(), tmp.begin(), tmp.end() );
241 , _pluginRepoverification(
_options.pluginsPath /
"repoverification",
251 && geteuid() == 0 && (
_options.rootDir.empty() ||
_options.rootDir ==
"/" ) )
254 std::list<zypp::Pathname> entries;
256 if ( ! entries.empty() )
259 cmd.push_back(
"<" );
260 cmd.push_back(
">" );
261 cmd.push_back(
"PROGRAM" );
262 for (
const auto & rinfo :
repos() )
264 if ( ! rinfo.enabled() )
266 cmd.push_back(
"-R" );
267 cmd.push_back( rinfo.alias() );
268 cmd.push_back(
"-t" );
269 cmd.push_back( rinfo.type().asString() );
270 cmd.push_back(
"-p" );
271 cmd.push_back( (rinfo.metadataPath()/rinfo.path()).
asString() );
274 for_( it, entries.begin(), entries.end() )
297 |
and_then( [
this](){
return init_knownRepositories(); } );
320 mediarootpath = std::move(mrPath);
327 repokind = probeCache( productdatapath );
334 switch ( repokind.
toEnum() )
337 status =
RepoStatus( productdatapath/
"repodata/repomd.xml");
339 status = status &&
RepoStatus( mediarootpath/
"media.1/media" );
343 status =
RepoStatus( productdatapath/
"content" ) &&
RepoStatus( mediarootpath/
"media.1/media" );
360 if ( ! status.
empty() )
381 ProgressObserver::setup( myProgress,
_(
"Cleaning metadata"), 100 );
382 ProgressObserver::start( myProgress );
384 ProgressObserver::setCurrent ( myProgress, 50 );
386 ProgressObserver::finish ( myProgress );
399 ProgressObserver::setup( myProgress,
_(
"Cleaning packages"), 100 );
400 ProgressObserver::start( myProgress );
407 ProgressObserver::finish ( myProgress );
425 MIL <<
"going to probe the cached repo at " << path_r << std::endl;
436 MIL <<
"Probed cached type " << ret <<
" at " << path_r << std::endl;
444 MIL <<
"Going to clean up garbage in cache dirs" << std::endl;
446 std::list<zypp::Pathname> cachedirs;
447 cachedirs.push_back(
_options.repoRawCachePath);
448 cachedirs.push_back(
_options.repoPackagesCachePath);
449 cachedirs.push_back(
_options.repoSolvCachePath);
451 ProgressObserver::setup( myProgress,
_(
"Cleaning up cache dirs"), cachedirs.size() );
452 ProgressObserver::start( myProgress );
454 for(
const auto &dir : cachedirs )
458 ProgressObserver::increase( myProgress );
463 std::list<zypp::Pathname> entries;
468 if ( !entries.size() )
471 auto dirProgress = ProgressObserver::makeSubTask( myProgress, 1.0,
zypp::str::Format(
_(
"Cleaning up directory: %1%") ) % dir, entries.size() );
472 for(
const auto &subdir : entries )
477 if ( subdir.basename() == r->escaped_alias() )
478 { found =
true;
break; }
483 ProgressObserver::increase( dirProgress );
485 ProgressObserver::finish( dirProgress );
493 ProgressObserver::finish ( myProgress );
501 ProgressObserver::setup( myProgress,
_(
"Cleaning cache"), 100 );
502 ProgressObserver::start( myProgress );
504 MIL <<
"Removing raw metadata cache for " << info.
alias() << std::endl;
507 ProgressObserver::finish( myProgress );
522 ProgressObserver::setup( myProgress,
_(
"Loading from cache"), 3 );
523 ProgressObserver::start( myProgress );
533 ProgressObserver::increase ( myProgress );
537 ProgressObserver::increase ( myProgress );
542 if ( toolversion != LIBSOLV_TOOLVERSION ) {
547 |
or_else( [
this, info, myProgress]( std::exception_ptr exp ) {
549 MIL <<
"Try to handle exception by rebuilding the solv-file" << std::endl;
550 return cleanCache( info, ProgressObserver::makeSubTask( myProgress ) )
551 |
and_then([
this, info, myProgress]{
559 ProgressObserver::finish ( myProgress );
562 |
or_else([myProgress](
auto ex ){
579 _options.knownReposPath, generateFilename(tosave));
581 MIL <<
"Saving repo in " << repofile << std::endl;
583 std::ofstream file(repofile.
c_str());
590 tosave.dumpAsIniOn(file);
591 tosave.setFilepath(repofile);
594 reposManip().insert(tosave);
613 ProgressObserver::setup( myProgress,
zypp::str::form(
_(
"Removing repository '%s'"), info.
label().c_str()), 1 );
614 ProgressObserver::start( myProgress );
616 MIL <<
"Going to delete repo " << info.
alias() << std::endl;
618 for(
const auto &repo :
repos() )
623 if ( (!info.
alias().empty()) && ( info.
alias() != repo.alias() ) )
639 if ( filerepos.size() == 0
640 ||(filerepos.size() == 1 && filerepos.front().alias() == todelete.
alias() ) )
644 if ( ! ( ret == 0 || ret == ENOENT ) )
649 MIL << todelete.
alias() <<
" successfully deleted." << std::endl;
667 for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
668 fit != filerepos.end();
671 if ( (*fit).alias() != todelete.
alias() )
672 (*fit).dumpAsIniOn(file);
678 cleanCache( todelete, ProgressObserver::makeSubTask( myProgress, 0.2 )).unwrap();
680 cleanMetadata( todelete, ProgressObserver::makeSubTask( myProgress, 0.4 )).unwrap();
681 cleanPackages( todelete, ProgressObserver::makeSubTask( myProgress, 0.4 ),
true ).unwrap();
682 reposManip().erase(todelete);
683 MIL << todelete.
alias() <<
" successfully deleted." << std::endl;
686 ProgressObserver::finish(myProgress);
703 ProgressObserver::setup( myProgress,
_(
"Modifying repository"), 5 );
704 ProgressObserver::start( myProgress );
721 ProgressObserver::increase( myProgress );
739 for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
740 fit != filerepos.end();
745 if ( (*fit).alias() != toedit.
alias() )
746 (*fit).dumpAsIniOn(file);
751 ProgressObserver::increase( myProgress );
765 ProgressObserver::increase( myProgress );
767 reposManip().erase(toedit);
768 reposManip().insert(newinfo);
770 ProgressObserver::increase( myProgress );
775 MIL <<
"repo " << alias <<
" modified" << std::endl;
777 ProgressObserver::finish ( myProgress );
792 if ( it !=
repos().end() )
810 for(
const auto &origin : it->repoOrigins() )
832 |
and_then( [
this, origin, policy]( zyppng::repo::RefreshContextRef &&refCtx ) {
833 refCtx->setPolicy ( static_cast<zyppng::repo::RawMetadataRefreshPolicy>( policy ) );
849 for(
const auto &repo :
repos() ) {
850 if ( info.
alias() == repo.alias() )
853 modifiedrepo.
setType( repokind );
870 |
and_then( [policy, myProgress, cb = updateProbedType]( repo::RefreshContextRef refCtx ) {
871 refCtx->setPolicy( static_cast<repo::RawMetadataRefreshPolicy>( policy ) );
873 refCtx->connectFunc( &repo::RefreshContext::sigProbedTypeChanged, cb );
877 |
and_then([rMgr = shared_this<RepoManager>()]( repo::RefreshContextRef ctx ) {
891 ProgressObserver::setup( myProgress,
"Refreshing repositories" , 1 );
893 auto r = std::move(infos)
896 auto subProgress = ProgressObserver::makeSubTask( myProgress, 1.0,
zypp::str::Str() <<
_(
"Refreshing Repository: ") << info.
alias(), 3 );
902 for(
const auto &repo :
repos() ) {
903 if ( info.
alias() == repo.alias() )
906 modifiedrepo.
setType( repokind );
914 auto sharedThis = shared_this<RepoManager>();
921 |
and_then( [policy, subProgress, cb = updateProbedType]( repo::RefreshContextRef refCtx ) {
922 refCtx->setPolicy( static_cast<repo::RawMetadataRefreshPolicy>( policy ) );
924 refCtx->connectFunc( &repo::RefreshContext::sigProbedTypeChanged, cb );
929 |
and_then([subProgress]( repo::RefreshContextRef ctx ) {
932 ctx->repoManager()->reposManip();
947 | [myProgress](
auto res ) {
973 |
and_then( [
this, path = path](
auto mediaHandle ) {
984 |
and_then( [policy, myProgress]( repo::RefreshContextRef refCtx ) {
1024 saveService( toSave ).unwrap();
1025 _services.insert( toSave );
1030 MIL <<
"added service " << toSave.
alias() << std::endl;
1057 std::vector<ServiceInfo> servicesVec;
1058 std::copy( std::make_move_iterator(servicesCopy.begin()), std::make_move_iterator(servicesCopy.end()), std::back_inserter(servicesVec));
1061 std::move(servicesVec)
1074 MIL <<
"Going to delete service " << alias << std::endl;
1079 if( location.
empty() )
1088 if ( tmpSet.size() == 1 )
1095 MIL << alias <<
" successfully deleted." << std::endl;
1101 std::ofstream file(location.
c_str());
1108 for_(it, tmpSet.begin(), tmpSet.end())
1110 if( it->alias() != alias )
1111 it->dumpAsIniOn(file);
1114 MIL << alias <<
" successfully deleted from file " << location << std::endl;
1120 boost::make_function_output_iterator( std::bind( &
RepoCollector::collect, &rcollector, std::placeholders::_1 ) ) );
1137 MIL <<
"Going to modify service " << oldAlias << std::endl;
1143 if ( service.
type() == zypp::repo::ServiceType::PLUGIN )
1151 if( location.
empty() )
1161 std::ofstream file(location.
c_str());
1162 for_(it, tmpSet.begin(), tmpSet.end())
1164 if( *it != oldAlias )
1165 it->dumpAsIniOn(file);
1171 _services.erase(oldAlias);
1172 _services.insert(service);
1178 if ( oldAlias != service.
alias()
1181 std::vector<RepoInfo> toModify;
1183 for_( it, toModify.begin(), toModify.end() )
1190 const auto & last = service.
repoStates().find( it->alias() );
1192 it->setEnabled( last->second.enabled );
1195 it->setEnabled(
false );
1198 if ( oldAlias != service.
alias() )
1199 it->setService(service.
alias());
1222 generateFilename( service ) );
1225 MIL <<
"saving service in " << servfile << std::endl;
1227 std::ofstream file( servfile.
c_str() );
1234 MIL <<
"done" << std::endl;
1260 const std::string & basefilename )
const 1262 std::string final_filename = basefilename;
1281 repokind = probeCache( productdatapath );
1287 switch ( repokind.
toEnum() )
1321 return touchIndexFile( info,
_options );
1329 std::list<zypp::Pathname> entries;
1339 for_(it, entries.begin(), entries.end() )
1362 inline void cleanupNonRepoMetadtaFolders(
const zypp::Pathname & cachePath_r,
1364 const std::list<std::string> & repoEscAliases_r )
1369 if ( cachePath_r != defaultCachePath_r )
1372 std::list<std::string> entries;
1376 std::set<std::string> oldfiles;
1377 set_difference( entries.begin(), entries.end(), repoEscAliases_r.begin(), repoEscAliases_r.end(),
1378 std::inserter( oldfiles, oldfiles.end() ) );
1384 for (
const std::string & old : oldfiles )
1388 pi( cachePath_r/old );
1403 MIL <<
"start construct known repos" << std::endl;
1407 std::list<std::string> repoEscAliases;
1408 std::list<RepoInfo> orphanedRepos;
1416 _reposX.insert( repoInfo );
1419 const std::string & serviceAlias( repoInfo.service() );
1420 if ( ! ( serviceAlias.empty() ||
hasService( serviceAlias ) ) )
1422 WAR <<
"Schedule orphaned service repo for deletion: " << repoInfo << std::endl;
1423 orphanedRepos.push_back( repoInfo );
1427 repoEscAliases.push_back(repoInfo.escaped_alias());
1431 if ( ! orphanedRepos.empty() )
1433 for (
const auto & repoInfo : orphanedRepos )
1435 MIL <<
"Delete orphaned service repo " << repoInfo.alias() << std::endl;
1440 % repoInfo.service()
1441 % repoInfo.alias() );
1459 repoEscAliases.sort();
1460 cleanupNonRepoMetadtaFolders(
_options.repoRawCachePath,
1463 cleanupNonRepoMetadtaFolders(
_options.repoSolvCachePath,
1468 cleanupNonRepoMetadtaFolders(
_options.repoPackagesCachePath,
1473 MIL <<
"end construct known repos" << std::endl;
Pathname filepath() const
File where this repo was read from.
static const ValueType day
void setBaseUrl(Url url)
Clears current base URL list and adds url.
bool error(std::string msg_r, UserData userData_r=UserData())
send error text
void loadFromCache(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Load resolvables into the pool.
std::ostream & dumpAsIniOn(std::ostream &str) const override
Writes ServiceInfo to stream in ".service" format.
thrown when it was impossible to match a repository
zypp::RepoStatus RepoStatus
MaybeAwaitable< expected< repo::RefreshContextRef > > refreshMetadata(repo::RefreshContextRef refCtx, LazyMediaHandle< Provide > medium, ProgressObserverRef progressObserver)
bool empty() const
Whether the status is empty (empty checksum)
void getRepositoriesInService(const std::string &alias, OutputIterator out) const
fill to output iterator repositories in service name.
Namespace intended to collect all environment variables we use.
bool hasRepo(const std::string &alias) const
Return whether there is a known repository for alias.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
repo::RepoType probe(const Url &url, const Pathname &path) const
Probe repo metadata type.
const Pathname & path() const
Return current Pathname.
Read service data from a .service file.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
std::enable_if_t<!std::is_same_v< void, T >, expected< Container< T >, E > > collect(Container< expected< T, E >, CArgs... > &&in)
auto joinPipeline(ContextRef ctx, T &&val)
MirroredOriginSet repoOrigins() const
The repodata origins.
std::string asString(const Patch::Category &obj)
relates: Patch::Category string representation.
expected< T, E > inspect(expected< T, E > exp, Function &&f)
void removeService(const std::string &alias)
Removes service specified by its name.
std::set< ServiceInfo > ServiceSet
ServiceInfo typedefs.
MaybeAwaitable< expected< repo::RefreshContextRef > > buildCache(repo::RefreshContextRef refCtx, zypp::RepoManagerFlags::CacheBuildPolicy policy, ProgressObserverRef progressObserver)
Service plugin is immutable.
void cleanCache(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
clean local cache
ServiceInfo getService(const std::string &alias) const
Finds ServiceInfo by alias or return ServiceInfo::noService.
expected< std::list< RepoInfo > > repositories_in_file(const zypp::Pathname &file)
Reads RepoInfo's from a repo file.
MaybeAwaitable< expected< void > > refreshService(RepoManagerRef repoMgr, ServiceInfo info, zypp::RepoManagerFlags::RefreshServiceOptions options)
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
RefreshCheckStatus checkIfToRefreshMetadata(const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy=RefreshIfNeeded)
Checks whether to refresh metadata for specified repository and url.
const char * c_str() const
String representation.
void setAlias(const std::string &alias)
set the repository alias
std::list< RepoInfo > repositories_in_dir(ZContextRef zyppContext, const zypp::Pathname &dir)
List of RepoInfo's from a directory.
String related utilities and Regular expression matching.
Collector< TOutputIterator > collector(TOutputIterator iter_r)
relates: Collector Convenience constructor.
MaybeAwaitable< expected< RepoInfo > > addRepository(RepoManagerRef mgr, RepoInfo info, ProgressObserverRef myProgress, const zypp::TriBool &forcedProbe)
void setFilepath(const Pathname &filename)
set the path to the .repo file
bool isTmpRepo(const RepoInfo &info_r)
Whether repo is not under RM control and provides its own methadata paths.
MaybeAwaitable< expected< zypp::repo::ServiceType > > probeServiceType(ContextRef ctx, const zypp::Url &url)
What is known about a repository.
static expected< std::decay_t< Type >, Err > make_expected_success(Type &&t)
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Service already exists and some unique attribute can't be duplicated.
void buildCache(const RepoInfo &info, CacheBuildPolicy policy=BuildIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Refresh local cache.
static expected error(ConsParams &&...params)
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
bool enabled() const
If enabled is false, then this repository must be ignored as if does not exists, except when checking...
repo::ServiceType probeService(const Url &url) const
Probe the type or the service.
#define ZYPP_EXCPT_PTR(EXCPT)
Drops a logline and returns Exception as a std::exception_ptr.
Url::asString() view options.
int recursive_rmdir(const Pathname &path)
Like 'rm -r DIR'.
expected< zypp::Pathname > packagescache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the packages cache path for a repository.
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
void cleanCacheDirGarbage(const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Remove any subdirectories of cache directories which no longer belong to any of known repositories...
void refreshService(const std::string &alias, const RefreshServiceOptions &options_r=RefreshServiceOptions())
Refresh specific service.
void refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy=RefreshIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Refresh local raw cache.
ResultType or_else(const expected< T, E > &exp, Function &&f)
Simple callback to collect the results.
Url mirrorListUrl() const
Url of a file which contains a list of repository urls.
void modifyRepository(const std::string &alias, const RepoInfo &newinfo, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Modify repository attributes.
bool empty() const
Test for an empty path.
std::string asString() const
Returns a default string representation of the Url object.
expected< zypp::Pathname > rawproductdata_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the raw product metadata path for a repository, this is inside the raw cache dir...
static RepoStatus fromCookieFileUseMtime(const Pathname &path)
Reads the status from a cookie file but uses the files mtime.
void refreshServices(const RefreshServiceOptions &options_r=RefreshServiceOptions())
Refreshes all enabled services.
void cleanPackages(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Clean local package cache.
RepoInfo getRepositoryInfo(const std::string &alias, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Find a matching repository info.
bool collect(const RepoInfo &repo)
void removeRepository(const RepoInfo &repo)
Log recently removed repository.
int touch(const Pathname &path)
Change file's modification and access times.
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Lightweight repository attribute value lookup.
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
thrown when it was impossible to determine one url for this repo.
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
const std::string & asString() const
String representation.
std::string alias() const
unique identifier for this source.
bool isExist() const
Return whether valid stat info exists.
void addService(const std::string &alias, const Url &url)
Adds a new service by its alias and URL.
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
static const SolvAttr repositoryToolVersion
expected< void > assert_alias(const RepoInfo &info)
Pathname dirname() const
Return all but the last component od this path.
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Return path_r prefixed with root_r, unless it is already prefixed.
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
void setType(const repo::RepoType &t)
set the repository type
MaybeAwaitable< expected< repo::RefreshCheckStatus > > checkIfToRefreshMetadata(repo::RefreshContextRef refCtx, LazyMediaHandle< Provide > medium, ProgressObserverRef progressObserver)
bool ZYPP_PLUGIN_APPDATA_FORCE_COLLECT()
To trigger appdata refresh unconditionally.
bool repoOriginsEmpty() const
whether repo origins are available
MaybeAwaitable< expected< void > > refreshGeoIPData(ContextRef ctx, RepoInfo::url_set urls)
void addRepository(const RepoInfo &repo)
Log a newly added repository.
Iterable< RepoConstIterator > repos() const
Iterate the known repositories.
static expected< repo::RefreshContextRef > create(ContextRef zyppContext, zypp::RepoInfo info, RepoManagerRef repoManager)
Writing the zypp history fileReference counted signleton for writhing the zypp history file...
Read repository data from a .repo file.
void modifyService(const std::string &oldAlias, const ServiceInfo &service)
Modifies service file (rewrites it with new values) and underlying repositories if needed...
bool isCached(const RepoInfo &info) const
Whether a repository exists in cache.
int readdir(std::list< std::string > &retlist_r, const Pathname &path_r, bool dots_r)
Return content of directory via retlist.
Base Exception for service handling.
bool isValid() const
Verifies the Url.
MaybeAwaitable< expected< zypp::repo::RepoType > > probeRepoType(ContextRef ctx, Provide::LazyMediaHandle medium, zypp::Pathname path, std::optional< zypp::Pathname > targetPath)
ServiceConstIterator serviceBegin() const
Iterator to first service in internal storage.
bool requireStatusWithMediaFile() const
Returns true if this repository requires the media.1/media file to be included in the metadata status...
std::vector< std::string > Arguments
const std::string & asString() const
Return current Pathname as String.
RepoSet::const_iterator RepoConstIterator
std::string numstring(char n, int w=0)
int unlink(const Pathname &path)
Like 'unlink'.
static const RepoType NONE
static expected success(ConsParams &&...params)
ServiceConstIterator serviceEnd() const
Iterator to place behind last service in internal storage.
Url url() const
The service url.
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
std::ostream & copy(std::istream &from_r, std::ostream &to_r)
Copy istream to ostream.
static const RepoType RPMMD
bool autoPruneInDir(const zypp::Pathname &path_r)
bsc#1204956: Tweak to prevent auto pruning package caches.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
#define ZYPP_PRIVATE_CONSTR_ARG
static const RepoType YAST2
expected< void > assert_urls(const RepoInfo &info)
void addRepository(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Adds a repository to the list of known repositories.
const RepoStates & repoStates() const
Access the remembered repository states.
Base class for Exception.
std::ostream & dumpAsIniOn(std::ostream &str) const override
Write this RepoInfo object into str in a .repo file format.
Exception for repository handling.
RepoConstIterator repoBegin() const
refresh is delayed due to settings
bool any_of(const Container &c, Fnc &&cb)
static Date now()
Return the current time.
MaybeAwaitable< expected< void > > addRepositories(RepoManagerRef mgr, zypp::Url url, ProgressObserverRef myProgress)
bool strToBool(const C_Str &str, bool default_r)
Parse str into a bool depending on the default value.
Iterator findAlias(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Find alias_r in repo/service container.
The repository cache is not built yet so you can't create the repostories from the cache...
void eraseFromPool()
Remove this Repository from its Pool.
std::string targetDistribution() const
Distribution for which is this repository meant.
Wrapper class for ::stat/::lstat.
void removeRepository(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Remove the best matching repository from known repos list.
bool regex_match(const char *s, smatch &matches, const regex ®ex) ZYPP_API
Regular expression matching.
RefreshCheckStatus
Possibly return state of RepoManager::checkIfToRefreshMetadata function.
ResultType and_then(const expected< T, E > &exp, Function &&f)
auto mtry(F &&f, Args &&...args)
static const RepoType RPMPLAINDIR
static const std::string & systemRepoAlias()
Reserved system repository alias .
expected< zypp::Pathname > rawcache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the raw cache path for a repository, this is usually /var/cache/zypp/alias.
RepoStatus metadataStatus(const RepoInfo &info) const
Status of local metadata.
Track changing files or directories.
std::string join(const Tltext <ext, const Trtext &rtext, const char *sep=" ")
Simple join of two string types.
Repository already exists and some unique attribute can't be duplicated.
std::string filenameFromAlias(const std::string &alias_r, const std::string &stem_r)
Generate a related filename from a repo/service infos alias.
std::string & replaceAll(std::string &str_r, const std::string &from_r, const std::string &to_r)
Replace all occurrences of from_r with to_r in str_r (inplace).
void modifyRepository(const RepoInfo &oldrepo, const RepoInfo &newrepo)
Log certain modifications to a repository.
#define ZYPP_FWD_CURRENT_EXCPT()
Drops a logline and returns the current Exception as a std::exception_ptr.
zypp::RepoManagerFlags::RefreshServiceOptions RefreshServiceOptions
std::ostream & operator<<(std::ostream &str, zypp::RepoManagerFlags::RawMetadataRefreshPolicy obj)
RepoConstIterator repoEnd() const
Represents a single, configurable network endpoint, combining a URL with specific access settings...
void refreshGeoIp(const RepoInfo::url_set &urls)
repo::ServiceType type() const
Service type.
endpoint_iterator begin()
std::string label() const
Label for use in messages for the user interface.
url_set baseUrls() const
The complete set of repository urls as configured.
repo::RepoType type() const
Type of repository,.
auto incProgress(ProgressObserverRef progressObserver, double progrIncrease=1.0, std::optional< std::string > newStr={})
void cleanMetadata(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Clean local metadata.
Functor collecting ServiceInfos into a ServiceSet.
bool hasService(const std::string &alias) const
Return whether there is a known service for alias.
expected< zypp::Pathname > solv_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the solv cache path for a repository.
auto transform(Container< Msg, CArgs... > &&val, Transformation &&transformation)
Repository type enumeration.
bool warning(std::string msg_r, UserData userData_r=UserData())
send warning text
RepoManager::RefreshServiceOptions _options
void addRepositories(const Url &url, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Adds repositores from a repo file to the list of known repositories.