libzypp: zypp/ng/repomanager.h Source File

libzypp 17.36.6

repomanager.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_NG_REPOMANAGER_INCLUDED
13#define ZYPP_NG_REPOMANAGER_INCLUDED
14
15#include <utility>
16
17#include <zypp/RepoManagerFlags.h>
18#include <zypp/RepoManagerOptions.h>
19#include <zypp/RepoStatus.h>
20
21#include <zypp/repo/RepoException.h>
22#include <zypp/repo/PluginRepoverification.h>
23#include <zypp/ng/workflows/logichelpers.h>
24
25#include <zypp-core/base/Gettext.h>
26#include <zypp-core/base/DefaultIntegral>
27#include <zypp-core/base/NonCopyable.h>
28#include <zypp-core/fs/PathInfo.h>
29#include <zypp-core/ui/progressdata.h>
30#include <zypp-core/zyppng/base/Base>
31#include <zypp-core/zyppng/base/zyppglobal.h>
32#include <zypp-core/zyppng/pipelines/expected.h>
33
34namespace zyppng {
35
36 using RepoInfo = zypp::RepoInfo;
37 using RepoStatus = zypp::RepoStatus;
38 using RepoInfoList = zypp::RepoInfoList;
39 using ServiceInfo = zypp::ServiceInfo;
40 using RepoManagerOptions = zypp::RepoManagerOptions;
41 using PluginRepoverification = zypp_private::repo::PluginRepoverification;
42
43 ZYPP_FWD_DECL_TYPE_WITH_REFS( Context );
44 ZYPP_FWD_DECL_TYPE_WITH_REFS( SyncContext );
45 ZYPP_FWD_DECL_TYPE_WITH_REFS( ProgressObserver );
46 ZYPP_FWD_DECL_TEMPL_TYPE_WITH_REFS_ARG1 ( RepoManager, ZyppContextRefType );
47
48 using SyncRepoManager = RepoManager<SyncContextRef>;
49 using SyncRepoManagerRef = RepoManagerRef<SyncContextRef>;
50
51 using AsyncRepoManager = RepoManager<ContextRef>;
52 using AsyncRepoManagerRef = RepoManagerRef<ContextRef>;
53
55 inline bool isTmpRepo( const RepoInfo & info_r )
56 { return( info_r.filepath().empty() && info_r.usesAutoMetadataPaths() ); }
57
58 inline expected<void> assert_alias(const RepoInfo &info)
59 {
60 if ( info.alias().empty() )
61 return expected<void>::error( ZYPP_EXCPT_PTR(zypp::repo::RepoNoAliasException( info ) ) );
62 // bnc #473834. Maybe we can match the alias against a regex to define
63 // and check for valid aliases
64 if ( info.alias()[0] == '.')
65 return expected<void>::error( ZYPP_EXCPT_PTR( zypp::repo::RepoInvalidAliasException(
66 info, _("Repository alias cannot start with dot."))) );
67
68 return expected<void>::success();
69 }
70
71 inline expected<void> assert_alias(const ServiceInfo &info) {
72 if (info.alias().empty())
73 return expected<void>::error( ZYPP_EXCPT_PTR(zypp::repo::ServiceNoAliasException(info)));
74 // bnc #473834. Maybe we can match the alias against a regex to define
75 // and check for valid aliases
76 if (info.alias()[0] == '.')
77 return expected<void>::error( ZYPP_EXCPT_PTR(zypp::repo::ServiceInvalidAliasException(
78 info, _("Service alias cannot start with dot."))));
79
80 return expected<void>::success();
81 }
82
84 template <class Iterator>
85 inline bool foundAliasIn( const std::string & alias_r, Iterator begin_r, Iterator end_r )
86 {
87 for_( it, begin_r, end_r )
88 if ( it->alias() == alias_r )
89 return true;
90 return false;
91 }
92
93 template <class Container>
94 inline bool foundAliasIn( const std::string & alias_r, const Container & cont_r )
95 { return foundAliasIn( alias_r, cont_r.begin(), cont_r.end() ); }
96
98 template <class Iterator>
99 inline Iterator findAlias( const std::string & alias_r, Iterator begin_r, Iterator end_r )
100 {
101 for_( it, begin_r, end_r )
102 if ( it->alias() == alias_r )
103 return it;
104 return end_r;
105 }
106
107 template <class Container>
108 inline typename Container::iterator findAlias( const std::string & alias_r, Container & cont_r )
109 { return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
110
111 template <class Container>
112 inline typename Container::const_iterator findAlias( const std::string & alias_r, const Container & cont_r )
113 { return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
114
115
117 std::string filenameFromAlias( const std::string & alias_r, const std::string & stem_r );
118
134 struct RepoCollector : private zypp::base::NonCopyable
135 {
136 RepoCollector()
137 {}
138
139 RepoCollector(std::string targetDistro_)
140 : targetDistro(std::move(targetDistro_))
141 {}
142
143 bool collect( const RepoInfo &repo );
144
145 RepoInfoList repos;
146 std::string targetDistro;
147 };
148
149
155 expected<std::list<RepoInfo>> repositories_in_file( const zypp::Pathname & file );
156
158
159 expected<void> assert_urls( const RepoInfo & info );
160
161 inline expected<void> assert_url( const ServiceInfo & info )
162 {
163 if ( ! info.url().isValid() )
164 return expected<void>::error( ZYPP_EXCPT_PTR ( zypp::repo::ServiceNoUrlException( info ) ) );
165 return expected<void>::success();
166 }
167
172 inline expected<zypp::Pathname> rawcache_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
173 {
174 using namespace zyppng::operators;
175 return assert_alias(info) | and_then( [&](){ return make_expected_success( isTmpRepo( info ) ? info.metadataPath() : opt.repoRawCachePath / info.escaped_alias()); });
176 }
177
186 inline expected<zypp::Pathname> rawproductdata_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
187 {
188 using namespace zyppng::operators;
189 return rawcache_path_for_repoinfo( opt, info ) | and_then( [&]( zypp::Pathname p ) { return make_expected_success( p / info.path() ); } );
190 }
191
195 inline expected<zypp::Pathname> packagescache_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
196 {
197 using namespace zyppng::operators;
198 return assert_alias(info) |
199 and_then([&](){ return make_expected_success(isTmpRepo( info ) ? info.packagesPath() : opt.repoPackagesCachePath / info.escaped_alias()); });
200 }
201
205 inline expected<zypp::Pathname> solv_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
206 {
207 using namespace zyppng::operators;
208 return assert_alias(info) |
209 and_then([&](){ return make_expected_success(isTmpRepo( info ) ? info.metadataPath().dirname() / "%SLV%" : opt.repoSolvCachePath / info.escaped_alias()); });
210 }
211
213
215 class ServiceCollector
216 {
217 public:
218 using ServiceSet = std::set<ServiceInfo>;
219
220 ServiceCollector( ServiceSet & services_r )
221 : _services( services_r )
222 {}
223
224 bool operator()( const ServiceInfo & service_r ) const
225 {
226 _services.insert( service_r );
227 return true;
228 }
229
230 private:
231 ServiceSet & _services;
232 };
233
234
236 bool autoPruneInDir( const zypp::Pathname & path_r );
237
246 template <typename ZyppContextRefType>
247 class RepoManager : public Base, private MaybeAsyncMixin<std::is_same_v<ZyppContextRefType, ContextRef>>
248 {
249 ZYPP_ADD_PRIVATE_CONSTR_HELPER ();
250 ZYPP_ENABLE_MAYBE_ASYNC_MIXIN( (std::is_same_v<ZyppContextRefType, ContextRef>) );
251
252 public:
253
254 using ContextRefType = ZyppContextRefType;
255 using ContextType = typename ZyppContextRefType::element_type;
256
257 using RawMetadataRefreshPolicy = zypp::RepoManagerFlags::RawMetadataRefreshPolicy;
258 using CacheBuildPolicy = zypp::RepoManagerFlags::CacheBuildPolicy;
259
260
261 using RefreshCheckStatus = zypp::RepoManagerFlags::RefreshCheckStatus;
262
264 using RefreshServiceBit = zypp::RepoManagerFlags::RefreshServiceBit;
265 using RefreshServiceOptions = zypp::RepoManagerFlags::RefreshServiceOptions;
266
267
268 ZYPP_DECL_PRIVATE_CONSTR_ARGS (RepoManager, ZyppContextRefType zyppCtx, RepoManagerOptions opt );
269
270 template < typename ...Args >
271 inline static expected<std::shared_ptr<RepoManager<ZyppContextRefType>>> create ( Args && ...args ) {
272 using namespace zyppng::operators;
273 auto mgr = std::make_shared< RepoManager<ZyppContextRefType> >( private_constr_t{}, std::forward<Args>(args)... );
274 return mgr->initialize() | and_then( [mgr](){ return make_expected_success(mgr); } );
275 }
276
277 public:
278
282 struct MatchServiceAlias
283 {
284 public:
285 MatchServiceAlias( std::string alias_ ) : alias(std::move(alias_)) {}
286 bool operator()( const RepoInfo & info ) const
287 { return info.service() == alias; }
288 private:
289 std::string alias;
290 };
291
293 using ServiceSet = std::set<ServiceInfo>;
294 using ServiceConstIterator = ServiceSet::const_iterator;
295 using ServiceSizeType = ServiceSet::size_type;
296
298 using RepoSet = std::set<RepoInfo>;
299 using RepoConstIterator = RepoSet::const_iterator;
300 using RepoSizeType = RepoSet::size_type;
301
302
303 virtual ~RepoManager();
304
305 public:
306
307 expected<void> initialize ();
308
309 ContextRefType zyppContext() const {
310 return _zyppContext;
311 }
312
313 const RepoManagerOptions &options() const;
314
315 bool repoEmpty() const { return repos().empty(); }
316 RepoSizeType repoSize() const { return repos().size(); }
317 RepoConstIterator repoBegin() const { return repos().begin(); }
318 RepoConstIterator repoEnd() const { return repos().end(); }
319
320 bool hasRepo( const std::string & alias ) const
321 { return foundAliasIn( alias, repos() ); }
322
323 RepoInfo getRepo( const std::string & alias ) const
324 {
325 RepoConstIterator it( findAlias( alias, repos() ) );
326 return it == repos().end() ? RepoInfo::noRepo : *it;
327 }
328
329 public:
330 expected<zypp::Pathname> metadataPath( const RepoInfo & info ) const
331 { return rawcache_path_for_repoinfo( _options, info ); }
332
333 expected<zypp::Pathname> packagesPath( const RepoInfo & info ) const
334 { return packagescache_path_for_repoinfo( _options, info ); }
335
336 static expected<RepoStatus> metadataStatus( const RepoInfo & info, const RepoManagerOptions &options );
337 expected<RepoStatus> metadataStatus( const RepoInfo & info ) const;
338
339 expected<void> cleanMetadata( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
340
341 expected<void> cleanPackages( const RepoInfo & info, ProgressObserverRef myProgress = nullptr , bool isAutoClean = false );
342
343 static zypp::repo::RepoType probeCache( const zypp::Pathname & path_r );
344
345 expected<void> cleanCacheDirGarbage( ProgressObserverRef myProgress = nullptr );
346
347 expected<void> cleanCache( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
348
349 expected<bool> isCached( const RepoInfo & info ) const
350 {
351 using namespace zyppng::operators;
352 return solv_path_for_repoinfo( _options, info )
353 | and_then( [&]( zypp::Pathname solvPath) { return make_expected_success( zypp::PathInfo(solvPath / "solv").isExist()); } );
354 }
355
356 expected<RepoStatus> cacheStatus( const RepoInfo & info ) const
357 { return cacheStatus( info, _options ); }
358
359 static expected<RepoStatus> cacheStatus( const RepoInfo & info, const RepoManagerOptions &options )
360 {
361 using namespace zyppng::operators;
362 return solv_path_for_repoinfo( options, info )
363 | and_then( [&]( zypp::Pathname solvPath) {
364 return make_expected_success ( RepoStatus::fromCookieFile(solvPath / "cookie") );
365 });
366 }
367
368 expected<void> loadFromCache( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
369
370 expected<RepoInfo> addProbedRepository( RepoInfo info, zypp::repo::RepoType probedType );
371
372 expected<void> removeRepository( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
373
374 expected<RepoInfo> modifyRepository( const std::string & alias, const RepoInfo & newinfo_r, ProgressObserverRef myProgress = nullptr );
375
376 expected<RepoInfo> getRepositoryInfo( const std::string & alias );
377 expected<RepoInfo> getRepositoryInfo( const zypp::Url & url, const zypp::url::ViewOption &urlview );
378
379 expected<RefreshCheckStatus> checkIfToRefreshMetadata( const RepoInfo & info, const zypp::Url & url, RawMetadataRefreshPolicy policy );
380
398 expected<void> refreshMetadata( const RepoInfo & info, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress = nullptr );
399
400 std::vector<std::pair<RepoInfo, expected<void> > > refreshMetadata(std::vector<RepoInfo> infos, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress = nullptr );
401
402 expected<zypp::repo::RepoType> probe( const zypp::Url & url, const zypp::Pathname & path = zypp::Pathname() ) const;
403
404 expected<void> buildCache( const RepoInfo & info, CacheBuildPolicy policy, ProgressObserverRef myProgress = nullptr );
405
409 expected<RepoInfo> addRepository( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
410
411 expected<void> addRepositories( const zypp::Url & url, ProgressObserverRef myProgress = nullptr );
412
413 public:
414 bool serviceEmpty() const { return _services.empty(); }
415 ServiceSizeType serviceSize() const { return _services.size(); }
416 ServiceConstIterator serviceBegin() const { return _services.begin(); }
417 ServiceConstIterator serviceEnd() const { return _services.end(); }
418
419 bool hasService( const std::string & alias ) const
420 { return foundAliasIn( alias, _services ); }
421
422 ServiceInfo getService( const std::string & alias ) const
423 {
424 ServiceConstIterator it( findAlias( alias, _services ) );
425 return it == _services.end() ? ServiceInfo::noService : *it;
426 }
427
428 public:
429
430 expected<zypp::repo::ServiceType> probeService( const zypp::Url & url ) const;
431
432 expected<void> addService( const ServiceInfo & service );
433 expected<void> addService( const std::string & alias, const zypp::Url & url )
434 { return addService( ServiceInfo( alias, url ) ); }
435
436 expected<void> removeService( const std::string & alias );
437 expected<void> removeService( const ServiceInfo & service )
438 { return removeService( service.alias() ); }
439
440 expected<void> refreshService( const std::string & alias, const RefreshServiceOptions & options_r );
441 expected<void> refreshService( const ServiceInfo & service, const RefreshServiceOptions & options_r )
442 { return refreshService( service.alias(), options_r ); }
443
444 expected<void> refreshServices( const RefreshServiceOptions & options_r );
445
446 expected<void> modifyService( const std::string & oldAlias, const ServiceInfo & newService );
447
448 static expected<void> touchIndexFile( const RepoInfo & info, const RepoManagerOptions &options );
449
450 expected<void> setCacheStatus( const RepoInfo & info, const RepoStatus & status )
451 {
452 using namespace zyppng::operators;
453 return solv_path_for_repoinfo( _options, info )
454 | and_then( [&]( zypp::Pathname base ){
455 try {
456 zypp::filesystem::assert_dir(base);
457 status.saveToCookieFile( base / "cookie" );
458 } catch ( const zypp::Exception &e ) {
459 return expected<void>::error( std::make_exception_ptr(e) );
460 }
461 return expected<void>::success();
462 });
463 }
464
469 expected<void> refreshGeoIp ( const RepoInfo::url_set &urls );
470
471 template<typename OutputIterator>
472 void getRepositoriesInService( const std::string & alias, OutputIterator out ) const
473 {
474 MatchServiceAlias filter( alias );
475 std::copy( boost::make_filter_iterator( filter, repos().begin(), repos().end() ),
476 boost::make_filter_iterator( filter, repos().end(), repos().end() ),
477 out);
478 }
479
480 zypp::Pathname generateNonExistingName( const zypp::Pathname & dir, const std::string & basefilename ) const;
481
482 std::string generateFilename( const RepoInfo & info ) const
483 { return filenameFromAlias( info.alias(), "repo" ); }
484
485 std::string generateFilename( const ServiceInfo & info ) const
486 { return filenameFromAlias( info.alias(), "service" ); }
487
488
489 protected:
490 expected<void> saveService( ServiceInfo & service ) const;
491 expected<void> touchIndexFile( const RepoInfo & info );
492
493 protected:
494 expected<void> init_knownServices();
495 expected<void> init_knownRepositories();
496
497 public:
498 const RepoSet & repos() const { return _reposX; }
499 RepoSet & reposManip() { if ( ! _reposDirty ) _reposDirty = true; return _reposX; }
500
501 public:
502 PluginRepoverification pluginRepoverification() const
503 { return _pluginRepoverification; }
504
505 protected:
506 ContextRefType _zyppContext;
507 RepoManagerOptions _options;
508 RepoSet _reposX;
509 ServiceSet _services;
510 PluginRepoverification _pluginRepoverification;
511 zypp::DefaultIntegral<bool,false> _reposDirty;
512 };
513}
514
515#endif //ZYPP_NG_REPOMANAGER_INCLUDED
PluginRepoverification.h
RepoException.h
RepoManagerFlags.h
RepoManagerOptions.h
RepoStatus.h
zypp::DefaultIntegral
Integral type with defined initial value when default constructed.
Definition defaultintegral.h:42
zypp::Exception
Base class for Exception.
Definition Exception.h:147
zypp::RepoInfo
What is known about a repository.
Definition RepoInfo.h:72
zypp::RepoInfo::metadataPath
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition RepoInfo.cc:615
zypp::RepoInfo::usesAutoMetadataPaths
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
Definition RepoInfo.cc:621
zypp::RepoInfo::noRepo
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition RepoInfo.h:85
zypp::RepoInfo::path
Pathname path() const
Repository path.
Definition RepoInfo.cc:657
zypp::RepoInfo::service
std::string service() const
Gets name of the service to which this repository belongs or empty string if it has been added manual...
Definition RepoInfo.cc:660
zypp::RepoInfo::packagesPath
Pathname packagesPath() const
Path where this repo packages are cached.
Definition RepoInfo.cc:618
zypp::RepoInfo::url_set
std::list< Url > url_set
Definition RepoInfo.h:108
zypp::RepoStatus
Track changing files or directories.
Definition RepoStatus.h:41
zypp::RepoStatus::fromCookieFile
static RepoStatus fromCookieFile(const Pathname &path)
Reads the status from a cookie file.
Definition RepoStatus.cc:210
zypp::RepoStatus::saveToCookieFile
void saveToCookieFile(const Pathname &path_r) const
Save the status information to a cookie file.
Definition RepoStatus.cc:224
zypp::ServiceInfo
Service data.
Definition ServiceInfo.h:37
zypp::ServiceInfo::url
Url url() const
The service url.
Definition ServiceInfo.cc:102
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::Url::isValid
bool isValid() const
Verifies the Url.
Definition Url.cc:507
zypp::filesystem::PathInfo
Wrapper class for stat/lstat.
Definition PathInfo.h:226
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
zypp::filesystem::Pathname::dirname
Pathname dirname() const
Return all but the last component od this path.
Definition Pathname.h:126
zypp::filesystem::Pathname::empty
bool empty() const
Test for an empty path.
Definition Pathname.h:116
zypp::repo::RepoInfoBase::escaped_alias
std::string escaped_alias() const
Same as alias(), just escaped in a way to be a valid file name.
Definition RepoInfoBase.cc:114
zypp::repo::RepoInfoBase::filepath
Pathname filepath() const
File where this repo was read from.
Definition RepoInfoBase.cc:134
zypp::repo::RepoInfoBase::alias
std::string alias() const
unique identifier for this source.
Definition RepoInfoBase.cc:111
zypp::repo::RepoInvalidAliasException
Thrown when the repo alias is found to be invalid.
Definition RepoException.h:104
zypp::repo::RepoNoAliasException
thrown when it was impossible to determine an alias for this repo.
Definition RepoException.h:92
zypp::repo::ServiceInvalidAliasException
Thrown when the repo alias is found to be invalid.
Definition RepoException.h:226
zypp::repo::ServiceNoAliasException
Service without alias was used in an operation.
Definition RepoException.h:214
zypp::repo::ServiceNoUrlException
Service has no or invalid url defined.
Definition RepoException.h:248
zypp_private::repo::PluginRepoverification
Repository metadata verification beyond GPG.
Definition PluginRepoverification.h:53
zyppng::Base::Base
Base()
Definition base.cc:20
zyppng::Context
Definition context.h:39
zyppng::ProgressObserver
Definition progressobserver.h:28
zyppng::RepoManager
The RepoManager class Provides knowledge and methods to maintain repo settings and metadata for a giv...
Definition repomanager.h:248
zyppng::RepoManager< SyncContextRef >::RefreshCheckStatus
zypp::RepoManagerFlags::RefreshCheckStatus RefreshCheckStatus
Definition repomanager.h:261
zyppng::RepoManager< SyncContextRef >::RepoSizeType
RepoSet::size_type RepoSizeType
Definition repomanager.h:300
zyppng::RepoManager::getService
ServiceInfo getService(const std::string &alias) const
Definition repomanager.h:422
zyppng::RepoManager::refreshServices
expected< void > refreshServices(const RefreshServiceOptions &options_r)
Definition repomanager.cc:1041
zyppng::RepoManager::create
static expected< std::shared_ptr< RepoManager< ZyppContextRefType > > > create(Args &&...args)
Definition repomanager.h:271
zyppng::RepoManager::cacheStatus
expected< RepoStatus > cacheStatus(const RepoInfo &info) const
Definition repomanager.h:356
zyppng::RepoManager< SyncContextRef >::ServiceSet
std::set< ServiceInfo > ServiceSet
Definition repomanager.h:293
zyppng::RepoManager::getRepo
RepoInfo getRepo(const std::string &alias) const
Definition repomanager.h:323
zyppng::RepoManager::refreshMetadata
expected< void > refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress=nullptr)
Refresh local raw cache.
Definition repomanager.cc:843
zyppng::RepoManager::modifyService
expected< void > modifyService(const std::string &oldAlias, const ServiceInfo &newService)
Definition repomanager.cc:1125
zyppng::RepoManager::~RepoManager
virtual ~RepoManager()
Definition repomanager.cc:249
zyppng::RepoManager< SyncContextRef >::RefreshServiceBit
zypp::RepoManagerFlags::RefreshServiceBit RefreshServiceBit
Definition repomanager.h:264
zyppng::RepoManager::cacheStatus
static expected< RepoStatus > cacheStatus(const RepoInfo &info, const RepoManagerOptions &options)
Definition repomanager.h:359
zyppng::RepoManager::packagesPath
expected< zypp::Pathname > packagesPath(const RepoInfo &info) const
Definition repomanager.h:333
zyppng::RepoManager::serviceBegin
ServiceConstIterator serviceBegin() const
Definition repomanager.h:416
zyppng::RepoManager::addService
expected< void > addService(const ServiceInfo &service)
Definition repomanager.cc:1003
zyppng::RepoManager::refreshGeoIp
expected< void > refreshGeoIp(const RepoInfo::url_set &urls)
Definition repomanager.cc:1307
zyppng::RepoManager::removeService
expected< void > removeService(const std::string &alias)
Definition repomanager.cc:1063
zyppng::RepoManager::ZYPP_ENABLE_MAYBE_ASYNC_MIXIN
ZYPP_ENABLE_MAYBE_ASYNC_MIXIN((std::is_same_v< ZyppContextRefType, ContextRef >))
zyppng::RepoManager::cleanPackages
expected< void > cleanPackages(const RepoInfo &info, ProgressObserverRef myProgress=nullptr, bool isAutoClean=false)
Definition repomanager.cc:398
zyppng::RepoManager::removeService
expected< void > removeService(const ServiceInfo &service)
Definition repomanager.h:437
zyppng::RepoManager::serviceEmpty
bool serviceEmpty() const
Definition repomanager.h:414
zyppng::RepoManager::touchIndexFile
static expected< void > touchIndexFile(const RepoInfo &info, const RepoManagerOptions &options)
Definition repomanager.cc:1265
zyppng::RepoManager::getRepositoryInfo
expected< RepoInfo > getRepositoryInfo(const std::string &alias)
Definition repomanager.cc:790
zyppng::RepoManager::metadataStatus
expected< RepoStatus > metadataStatus(const RepoInfo &info) const
Definition repomanager.cc:373
zyppng::RepoManager::refreshService
expected< void > refreshService(const ServiceInfo &service, const RefreshServiceOptions &options_r)
Definition repomanager.h:441
zyppng::RepoManager::getRepositoryInfo
expected< RepoInfo > getRepositoryInfo(const zypp::Url &url, const zypp::url::ViewOption &urlview)
Definition repomanager.cc:806
zyppng::RepoManager::modifyRepository
expected< RepoInfo > modifyRepository(const std::string &alias, const RepoInfo &newinfo_r, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:701
zyppng::RepoManager::getRepositoriesInService
void getRepositoriesInService(const std::string &alias, OutputIterator out) const
Definition repomanager.h:472
zyppng::RepoManager< SyncContextRef >::RawMetadataRefreshPolicy
zypp::RepoManagerFlags::RawMetadataRefreshPolicy RawMetadataRefreshPolicy
Definition repomanager.h:257
zyppng::RepoManager::serviceEnd
ServiceConstIterator serviceEnd() const
Definition repomanager.h:417
zyppng::RepoManager::probeCache
static zypp::repo::RepoType probeCache(const zypp::Pathname &path_r)
Probe Metadata in a local cache directory.
Definition repomanager.cc:425
zyppng::RepoManager::addService
expected< void > addService(const std::string &alias, const zypp::Url &url)
Definition repomanager.h:433
zyppng::RepoManager::init_knownServices
expected< void > init_knownServices()
Definition repomanager.cc:1319
zyppng::RepoManager< SyncContextRef >::ContextRefType
SyncContextRef ContextRefType
Definition repomanager.h:254
zyppng::RepoManager::addProbedRepository
expected< RepoInfo > addProbedRepository(RepoInfo info, zypp::repo::RepoType probedType)
Definition repomanager.cc:572
zyppng::RepoManager::setCacheStatus
expected< void > setCacheStatus(const RepoInfo &info, const RepoStatus &status)
Definition repomanager.h:450
zyppng::RepoManager::probe
expected< zypp::repo::RepoType > probe(const zypp::Url &url, const zypp::Pathname &path=zypp::Pathname()) const
Probe the metadata type of a repository located at url.
Definition repomanager.cc:959
zyppng::RepoManager::repos
const RepoSet & repos() const
Definition repomanager.h:498
zyppng::RepoManager< SyncContextRef >::ServiceSizeType
ServiceSet::size_type ServiceSizeType
Definition repomanager.h:295
zyppng::RepoManager::cleanCacheDirGarbage
expected< void > cleanCacheDirGarbage(ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:443
zyppng::RepoManager::checkIfToRefreshMetadata
expected< RefreshCheckStatus > checkIfToRefreshMetadata(const RepoInfo &info, const zypp::Url &url, RawMetadataRefreshPolicy policy)
Definition repomanager.cc:828
zyppng::RepoManager::isCached
expected< bool > isCached(const RepoInfo &info) const
Definition repomanager.h:349
zyppng::RepoManager::addRepository
expected< RepoInfo > addRepository(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:984
zyppng::RepoManager::probeService
expected< zypp::repo::ServiceType > probeService(const zypp::Url &url) const
Definition repomanager.cc:997
zyppng::RepoManager::serviceSize
ServiceSizeType serviceSize() const
Definition repomanager.h:415
zyppng::RepoManager::generateFilename
std::string generateFilename(const ServiceInfo &info) const
Definition repomanager.h:485
zyppng::RepoManager::initialize
expected< void > initialize()
Definition repomanager.cc:294
zyppng::RepoManager::generateNonExistingName
zypp::Pathname generateNonExistingName(const zypp::Pathname &dir, const std::string &basefilename) const
Generate a non existing filename in a directory, using a base name.
Definition repomanager.cc:1251
zyppng::RepoManager::buildCache
expected< void > buildCache(const RepoInfo &info, CacheBuildPolicy policy, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:971
zyppng::RepoManager::touchIndexFile
expected< void > touchIndexFile(const RepoInfo &info)
Definition repomanager.cc:1313
zyppng::RepoManager< SyncContextRef >::RepoConstIterator
RepoSet::const_iterator RepoConstIterator
Definition repomanager.h:299
zyppng::RepoManager::metadataPath
expected< zypp::Pathname > metadataPath(const RepoInfo &info) const
Definition repomanager.h:330
zyppng::RepoManager::repoSize
RepoSizeType repoSize() const
Definition repomanager.h:316
zyppng::RepoManager::pluginRepoverification
PluginRepoverification pluginRepoverification() const
Definition repomanager.h:502
zyppng::RepoManager::addRepositories
expected< void > addRepositories(const zypp::Url &url, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:990
zyppng::RepoManager< SyncContextRef >::_pluginRepoverification
PluginRepoverification _pluginRepoverification
Definition repomanager.h:510
zyppng::RepoManager::ZYPP_ADD_PRIVATE_CONSTR_HELPER
ZYPP_ADD_PRIVATE_CONSTR_HELPER()
zyppng::RepoManager< SyncContextRef >::_reposX
RepoSet _reposX
Definition repomanager.h:508
zyppng::RepoManager< SyncContextRef >::ServiceConstIterator
ServiceSet::const_iterator ServiceConstIterator
Definition repomanager.h:294
zyppng::RepoManager::zyppContext
ContextRefType zyppContext() const
Definition repomanager.h:309
zyppng::RepoManager< SyncContextRef >::_options
RepoManagerOptions _options
Definition repomanager.h:507
zyppng::RepoManager< SyncContextRef >::_services
ServiceSet _services
Definition repomanager.h:509
zyppng::RepoManager::init_knownRepositories
expected< void > init_knownRepositories()
Definition repomanager.cc:1393
zyppng::RepoManager::cleanCache
expected< void > cleanCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:500
zyppng::RepoManager< SyncContextRef >::_reposDirty
zypp::DefaultIntegral< bool, false > _reposDirty
Definition repomanager.h:511
zyppng::RepoManager::loadFromCache
expected< void > loadFromCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:520
zyppng::RepoManager< SyncContextRef >::RepoSet
std::set< RepoInfo > RepoSet
Definition repomanager.h:298
zyppng::RepoManager::cleanMetadata
expected< void > cleanMetadata(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:379
zyppng::RepoManager::metadataStatus
static expected< RepoStatus > metadataStatus(const RepoInfo &info, const RepoManagerOptions &options)
Definition repomanager.cc:309
zyppng::RepoManager::removeRepository
expected< void > removeRepository(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:612
zyppng::RepoManager::hasService
bool hasService(const std::string &alias) const
Definition repomanager.h:419
zyppng::RepoManager::repoBegin
RepoConstIterator repoBegin() const
Definition repomanager.h:317
zyppng::RepoManager::saveService
expected< void > saveService(ServiceInfo &service) const
Definition repomanager.cc:1208
zyppng::RepoManager::repoEmpty
bool repoEmpty() const
Definition repomanager.h:315
zyppng::RepoManager::hasRepo
bool hasRepo(const std::string &alias) const
Definition repomanager.h:320
zyppng::RepoManager::generateFilename
std::string generateFilename(const RepoInfo &info) const
Definition repomanager.h:482
zyppng::RepoManager::ZYPP_DECL_PRIVATE_CONSTR_ARGS
ZYPP_DECL_PRIVATE_CONSTR_ARGS(RepoManager, ZyppContextRefType zyppCtx, RepoManagerOptions opt)
zyppng::RepoManager< SyncContextRef >::ContextType
typename SyncContextRef::element_type ContextType
Definition repomanager.h:255
zyppng::RepoManager::repoEnd
RepoConstIterator repoEnd() const
Definition repomanager.h:318
zyppng::RepoManager::refreshMetadata
std::vector< std::pair< RepoInfo, expected< void > > > refreshMetadata(std::vector< RepoInfo > infos, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:883
zyppng::RepoManager< SyncContextRef >::RefreshServiceOptions
zypp::RepoManagerFlags::RefreshServiceOptions RefreshServiceOptions
Definition repomanager.h:265
zyppng::RepoManager::refreshService
expected< void > refreshService(const std::string &alias, const RefreshServiceOptions &options_r)
Definition repomanager.cc:1032
zyppng::RepoManager::options
const RepoManagerOptions & options() const
Definition repomanager.cc:303
zyppng::RepoManager< SyncContextRef >::CacheBuildPolicy
zypp::RepoManagerFlags::CacheBuildPolicy CacheBuildPolicy
Definition repomanager.h:258
zyppng::RepoManager< SyncContextRef >::_zyppContext
ContextRefType _zyppContext
Definition repomanager.h:506
zyppng::RepoManager::reposManip
RepoSet & reposManip()
Definition repomanager.h:499
zyppng::ServiceCollector::ServiceCollector
ServiceCollector(ServiceSet &services_r)
Definition repomanager.h:220
zyppng::ServiceCollector::operator()
bool operator()(const ServiceInfo &service_r) const
Definition repomanager.h:224
zyppng::ServiceCollector::_services
ServiceSet & _services
Definition repomanager.h:231
zyppng::ServiceCollector::ServiceSet
std::set< ServiceInfo > ServiceSet
Definition repomanager.h:218
zyppng::SyncContext
Definition contextfacade.h:27
zyppng::expected
Definition expected.h:27
zyppng::expected::success
static expected success(ConsParams &&...params)
Definition expected.h:115
zyppng::expected::error
E & error()
Definition expected.h:225
expected.h
logichelpers.h
std
Definition Arch.h:364
zypp::RepoManagerFlags::RefreshCheckStatus
RefreshCheckStatus
Possibly return state of RepoManager::checkIfToRefreshMetadata function.
Definition RepoManagerFlags.h:47
zypp::RepoManagerFlags::RefreshServiceOptions
RefreshServiceFlags RefreshServiceOptions
Options tuning RefreshService.
Definition RepoManagerFlags.h:42
zypp::RepoManagerFlags::CacheBuildPolicy
CacheBuildPolicy
Definition RepoManagerFlags.h:28
zypp::RepoManagerFlags::RawMetadataRefreshPolicy
RawMetadataRefreshPolicy
Definition RepoManagerFlags.h:21
zypp::RepoManagerFlags::RefreshServiceBit
RefreshServiceBit
Flags for tuning RefreshService.
Definition RepoManagerFlags.h:35
zypp::base
Definition Random.cc:7
zypp::base::NonCopyable
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition NonCopyable.h:26
zypp::filesystem::assert_dir
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
Definition PathInfo.cc:324
zypp::filter
Definition Filter.h:29
zypp::url
Url details namespace.
Definition UrlBase.cc:58
zyppng::operators
Definition asyncresult.h:279
zyppng::operators::collect
detail::collect_helper collect()
Definition expected.h:650
zyppng::repo
Definition downloader.cc:25
zyppng
Definition MediaCurl2.h:22
zyppng::isTmpRepo
bool isTmpRepo(const RepoInfo &info_r)
Whether repo is not under RM control and provides its own methadata paths.
Definition repomanager.h:55
zyppng::assert_url
expected< void > assert_url(const ServiceInfo &info)
Definition repomanager.h:161
zyppng::assert_urls
expected< void > assert_urls(const RepoInfo &info)
Definition repomanager.cc:227
zyppng::SyncRepoManager
RepoManager< SyncContextRef > SyncRepoManager
Definition repomanager.h:48
zyppng::filenameFromAlias
std::string filenameFromAlias(const std::string &alias_r, const std::string &stem_r)
Generate a related filename from a repo/service infos alias.
Definition repomanager.cc:137
zyppng::make_expected_success
static expected< std::decay_t< Type >, Err > make_expected_success(Type &&t)
Definition expected.h:397
zyppng::AsyncRepoManager
RepoManager< ContextRef > AsyncRepoManager
Definition repomanager.h:51
zyppng::rawcache_path_for_repoinfo
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.
Definition repomanager.h:172
zyppng::assert_alias
expected< void > assert_alias(const RepoInfo &info)
Definition repomanager.h:58
zyppng::and_then
ResultType and_then(const expected< T, E > &exp, Function &&f)
Definition expected.h:423
zyppng::ServiceInfo
zypp::ServiceInfo ServiceInfo
Definition repomanager.h:39
zyppng::SyncRepoManagerRef
RepoManagerRef< SyncContextRef > SyncRepoManagerRef
Definition repomanager.h:49
zyppng::solv_path_for_repoinfo
expected< zypp::Pathname > solv_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the solv cache path for a repository.
Definition repomanager.h:205
zyppng::repositories_in_file
expected< std::list< RepoInfo > > repositories_in_file(const zypp::Pathname &file)
Reads RepoInfo's from a repo file.
Definition repomanager.cc:167
zyppng::AsyncRepoManagerRef
RepoManagerRef< ContextRef > AsyncRepoManagerRef
Definition repomanager.h:52
zyppng::findAlias
Iterator findAlias(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Find alias_r in repo/service container.
Definition repomanager.h:99
zyppng::PluginRepoverification
zypp_private::repo::PluginRepoverification PluginRepoverification
Definition repomanager.h:41
zyppng::foundAliasIn
bool foundAliasIn(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Check if alias_r is present in repo/service container.
Definition repomanager.h:85
zyppng::packagescache_path_for_repoinfo
expected< zypp::Pathname > packagescache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the packages cache path for a repository.
Definition repomanager.h:195
zyppng::rawproductdata_path_for_repoinfo
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,...
Definition repomanager.h:186
zyppng::RepoInfoList
zypp::RepoInfoList RepoInfoList
Definition repomanager.h:38
zyppng::autoPruneInDir
bool autoPruneInDir(const zypp::Pathname &path_r)
bsc#1204956: Tweak to prevent auto pruning package caches.
Definition repomanager.cc:234
progressdata.h
zypp::RepoManagerOptions
Repo manager settings.
Definition RepoManagerOptions.h:26
zypp::RepoManagerOptions::repoSolvCachePath
Pathname repoSolvCachePath
Definition RepoManagerOptions.h:53
zypp::RepoManagerOptions::repoRawCachePath
Pathname repoRawCachePath
Definition RepoManagerOptions.h:52
zypp::RepoManagerOptions::repoPackagesCachePath
Pathname repoPackagesCachePath
Definition RepoManagerOptions.h:54
zypp::repo::RepoType
Repository type enumeration.
Definition RepoType.h:29
zypp::url::ViewOption
Url::asString() view options.
Definition UrlBase.h:41
zyppng::MaybeAsyncMixin
Definition logichelpers.h:36
zyppng::RepoCollector::RepoCollector
RepoCollector(std::string targetDistro_)
Definition repomanager.h:139
zyppng::RepoCollector::targetDistro
std::string targetDistro
Definition repomanager.h:146
zyppng::RepoCollector::repos
RepoInfoList repos
Definition repomanager.h:145
zyppng::RepoCollector::RepoCollector
RepoCollector()
Definition repomanager.h:136
zyppng::RepoManager::MatchServiceAlias::alias
std::string alias
Definition repomanager.h:289
zyppng::RepoManager::MatchServiceAlias::MatchServiceAlias
MatchServiceAlias(std::string alias_)
Definition repomanager.h:285
zyppng::RepoManager::MatchServiceAlias::operator()
bool operator()(const RepoInfo &info) const
Definition repomanager.h:286
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
ZYPP_EXCPT_PTR
#define ZYPP_EXCPT_PTR(EXCPT)
Drops a logline and returns Exception as a std::exception_ptr.
Definition Exception.h:428
Gettext.h
_
#define _(MSG)
Definition Gettext.h:39
NonCopyable.h
PathInfo.h
zyppglobal.h
ZYPP_FWD_DECL_TEMPL_TYPE_WITH_REFS_ARG1
#define ZYPP_FWD_DECL_TEMPL_TYPE_WITH_REFS_ARG1(T, TArg1)
Definition zyppglobal.h:130
ZYPP_FWD_DECL_TYPE_WITH_REFS
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)
Definition zyppglobal.h:126