libzypp 17.38.5

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#include <optional>
17
18#include <zypp/RepoManagerFlags.h>
19#include <zypp/RepoManagerOptions.h>
20#include <zypp/RepoStatus.h>
21
22#include <zypp/repo/RepoException.h>
23#include <zypp/repo/PluginRepoverification.h>
24
25#include <zypp/ng/context.h>
26
27#include <zypp-core/base/Gettext.h>
28#include <zypp-core/base/DefaultIntegral>
29#include <zypp-core/base/NonCopyable.h>
30#include <zypp-core/fs/PathInfo.h>
31#include <zypp-core/ui/progressdata.h>
32#include <zypp-core/ng/base/Base>
33#include <zypp-core/ng/base/zyppglobal.h>
34#include <zypp-core/ng/pipelines/expected.h>
35
36 namespace zyppng {
37
38 using RepoInfo = zypp::RepoInfo;
39 using RepoStatus = zypp::RepoStatus;
40 using RepoInfoList = zypp::RepoInfoList;
41 using ServiceInfo = zypp::ServiceInfo;
42 using RepoManagerOptions = zypp::RepoManagerOptions;
43 using PluginRepoverification = zypp_private::repo::PluginRepoverification;
44 ZYPP_FWD_DECL_TYPE_WITH_REFS( SyncContext );
45 ZYPP_FWD_DECL_TYPE_WITH_REFS( ProgressObserver );
46 ZYPP_FWD_DECL_TYPE_WITH_REFS( RepoManager );
47
49 inline bool isTmpRepo( const RepoInfo & info_r )
50 { return( info_r.filepath().empty() && info_r.usesAutoMetadataPaths() ); }
51
52 inline expected<void> assert_alias(const RepoInfo &info)
53 {
54 if ( info.alias().empty() )
55 return expected<void>::error( ZYPP_EXCPT_PTR(zypp::repo::RepoNoAliasException( info ) ) );
56 // bnc #473834. Maybe we can match the alias against a regex to define
57 // and check for valid aliases
58 if ( info.alias()[0] == '.')
59 return expected<void>::error( ZYPP_EXCPT_PTR( zypp::repo::RepoInvalidAliasException(
60 info, _("Repository alias cannot start with dot."))) );
61
62 return expected<void>::success();
63 }
64
65 inline expected<void> assert_alias(const ServiceInfo &info) {
66 if (info.alias().empty())
67 return expected<void>::error( ZYPP_EXCPT_PTR(zypp::repo::ServiceNoAliasException(info)));
68 // bnc #473834. Maybe we can match the alias against a regex to define
69 // and check for valid aliases
70 if (info.alias()[0] == '.')
71 return expected<void>::error( ZYPP_EXCPT_PTR(zypp::repo::ServiceInvalidAliasException(
72 info, _("Service alias cannot start with dot."))));
73
74 return expected<void>::success();
75 }
76
78 template <class Iterator>
79 inline bool foundAliasIn( const std::string & alias_r, Iterator begin_r, Iterator end_r )
80 {
81 for_( it, begin_r, end_r )
82 if ( it->alias() == alias_r )
83 return true;
84 return false;
85 }
86
87 template <class Container>
88 inline bool foundAliasIn( const std::string & alias_r, const Container & cont_r )
89 { return foundAliasIn( alias_r, cont_r.begin(), cont_r.end() ); }
90
92 template <class Iterator>
93 inline Iterator findAlias( const std::string & alias_r, Iterator begin_r, Iterator end_r )
94 {
95 for_( it, begin_r, end_r )
96 if ( it->alias() == alias_r )
97 return it;
98 return end_r;
99 }
100
101 template <class Container>
102 inline typename Container::iterator findAlias( const std::string & alias_r, Container & cont_r )
103 { return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
104
105 template <class Container>
106 inline typename Container::const_iterator findAlias( const std::string & alias_r, const Container & cont_r )
107 { return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
108
109
111 std::string filenameFromAlias( const std::string & alias_r, const std::string & stem_r );
112
128 struct RepoCollector : private zypp::base::NonCopyable
129 {
130 RepoCollector()
131 {}
132
133 RepoCollector(std::string targetDistro_)
134 : targetDistro(std::move(targetDistro_))
135 {}
136
137 bool collect( const RepoInfo &repo );
138
139 RepoInfoList repos;
140 std::string targetDistro;
141 };
142
143
149 expected<std::list<RepoInfo>> repositories_in_file( const zypp::Pathname & file );
150
152
153 expected<void> assert_urls( const RepoInfo & info );
154
155 inline expected<void> assert_url( const ServiceInfo & info )
156 {
157 if ( ! info.url().isValid() )
158 return expected<void>::error( ZYPP_EXCPT_PTR ( zypp::repo::ServiceNoUrlException( info ) ) );
159 return expected<void>::success();
160 }
161
166 inline expected<zypp::Pathname> rawcache_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
167 {
168 using namespace zyppng::operators;
169 return assert_alias(info) | and_then( [&](){ return make_expected_success( isTmpRepo( info ) ? info.metadataPath() : opt.repoRawCachePath / info.escaped_alias()); });
170 }
171
180 inline expected<zypp::Pathname> rawproductdata_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
181 {
182 using namespace zyppng::operators;
183 return rawcache_path_for_repoinfo( opt, info ) | and_then( [&]( zypp::Pathname p ) { return make_expected_success( p / info.path() ); } );
184 }
185
189 inline expected<zypp::Pathname> packagescache_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
190 {
191 using namespace zyppng::operators;
192 return assert_alias(info) |
193 and_then([&](){ return make_expected_success(isTmpRepo( info ) ? info.packagesPath() : opt.repoPackagesCachePath / info.escaped_alias()); });
194 }
195
199 inline expected<zypp::Pathname> solv_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
200 {
201 using namespace zyppng::operators;
202 return assert_alias(info) |
203 and_then([&](){ return make_expected_success(isTmpRepo( info ) ? info.metadataPath().dirname() / "%SLV%" : opt.repoSolvCachePath / info.escaped_alias()); });
204 }
205
207
209 class ServiceCollector
210 {
211 public:
212 using ServiceSet = std::set<ServiceInfo>;
213
214 ServiceCollector( ServiceSet & services_r )
215 : _services( services_r )
216 {}
217
218 bool operator()( const ServiceInfo & service_r ) const
219 {
220 _services.insert( service_r );
221 return true;
222 }
223
224 private:
225 ServiceSet & _services;
226 };
227
228
230 bool autoPruneInDir( const zypp::Pathname & path_r );
231
240 class RepoManager : public Base
241 {
242 ZYPP_ADD_PRIVATE_CONSTR_HELPER ();
243 public:
244
245 using ContextRefType = ContextRef;
246 using ContextType = Context;
247
248 using RawMetadataRefreshPolicy = zypp::RepoManagerFlags::RawMetadataRefreshPolicy;
249 using CacheBuildPolicy = zypp::RepoManagerFlags::CacheBuildPolicy;
250
251
252 using RefreshCheckStatus = zypp::RepoManagerFlags::RefreshCheckStatus;
253
255 using RefreshServiceBit = zypp::RepoManagerFlags::RefreshServiceBit;
256 using RefreshServiceOptions = zypp::RepoManagerFlags::RefreshServiceOptions;
257
258
259 ZYPP_DECL_PRIVATE_CONSTR_ARGS (RepoManager, ContextRef zyppCtx, RepoManagerOptions opt );
260
261 template < typename ...Args >
262 inline static expected<std::shared_ptr<RepoManager>> create ( Args && ...args ) {
263 using namespace zyppng::operators;
264 auto mgr = std::make_shared< RepoManager >( private_constr_t{}, std::forward<Args>(args)... );
265 return mgr->initialize() | and_then( [mgr](){ return make_expected_success(mgr); } );
266 }
267
268 public:
269
273 struct MatchServiceAlias
274 {
275 public:
276 MatchServiceAlias( std::string alias_ ) : alias(std::move(alias_)) {}
277 bool operator()( const RepoInfo & info ) const
278 { return info.service() == alias; }
279 private:
280 std::string alias;
281 };
282
284 using ServiceSet = std::set<ServiceInfo>;
285 using ServiceConstIterator = ServiceSet::const_iterator;
286 using ServiceSizeType = ServiceSet::size_type;
287
289 using RepoSet = std::set<RepoInfo>;
290 using RepoConstIterator = RepoSet::const_iterator;
291 using RepoSizeType = RepoSet::size_type;
292
293
294 virtual ~RepoManager();
295
296 public:
297
298 expected<void> initialize ();
299
300 ContextRefType zyppContext() const {
301 return _zyppContext;
302 }
303
304 const RepoManagerOptions &options() const;
305
306 bool repoEmpty() const { return repos().empty(); }
307 RepoSizeType repoSize() const { return repos().size(); }
308 RepoConstIterator repoBegin() const { return repos().begin(); }
309 RepoConstIterator repoEnd() const { return repos().end(); }
310
311 bool hasRepo( const std::string & alias ) const
312 { return foundAliasIn( alias, repos() ); }
313
314 RepoInfo getRepo( const std::string & alias ) const
315 {
316 RepoConstIterator it( findAlias( alias, repos() ) );
317 return it == repos().end() ? RepoInfo::noRepo : *it;
318 }
319
320 public:
321 expected<zypp::Pathname> metadataPath( const RepoInfo & info ) const
322 { return rawcache_path_for_repoinfo( _options, info ); }
323
324 expected<zypp::Pathname> packagesPath( const RepoInfo & info ) const
325 { return packagescache_path_for_repoinfo( _options, info ); }
326
327 static expected<RepoStatus> metadataStatus( const RepoInfo & info, const RepoManagerOptions &options );
328 expected<RepoStatus> metadataStatus( const RepoInfo & info ) const;
329
330 expected<void> cleanMetadata( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
331
332 expected<void> cleanPackages( const RepoInfo & info, ProgressObserverRef myProgress = nullptr , bool isAutoClean = false );
333
334 static zypp::repo::RepoType probeCache( const zypp::Pathname & path_r );
335
336 expected<void> cleanCacheDirGarbage( ProgressObserverRef myProgress = nullptr );
337
338 expected<void> cleanCache( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
339
340 expected<bool> isCached( const RepoInfo & info ) const
341 {
342 using namespace zyppng::operators;
343 return solv_path_for_repoinfo( _options, info )
344 | and_then( [&]( zypp::Pathname solvPath) { return make_expected_success( zypp::PathInfo(solvPath / "solv").isExist()); } );
345 }
346
347 expected<RepoStatus> cacheStatus( const RepoInfo & info ) const
348 { return cacheStatus( info, _options ); }
349
350 static expected<RepoStatus> cacheStatus( const RepoInfo & info, const RepoManagerOptions &options )
351 {
352 using namespace zyppng::operators;
353 return solv_path_for_repoinfo( options, info )
354 | and_then( [&]( zypp::Pathname solvPath) {
355 return make_expected_success ( RepoStatus::fromCookieFile(solvPath / "cookie") );
356 });
357 }
358
359 expected<void> loadFromCache( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
360
361 expected<RepoInfo> addProbedRepository( RepoInfo info, zypp::repo::RepoType probedType );
362
363 expected<void> removeRepository( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
364
365 expected<RepoInfo> modifyRepository( const std::string & alias, const RepoInfo & newinfo_r, ProgressObserverRef myProgress = nullptr );
366
367 expected<RepoInfo> getRepositoryInfo( const std::string & alias );
368 expected<RepoInfo> getRepositoryInfo( const zypp::Url & url, const zypp::url::ViewOption &urlview );
369
370 expected<RefreshCheckStatus> checkIfToRefreshMetadata( const RepoInfo & info, const zypp::MirroredOrigin &origin, RawMetadataRefreshPolicy policy );
371
372 expected<RefreshCheckStatus> checkIfToRefreshMetadata( const RepoInfo & info, const zypp::Url & url, RawMetadataRefreshPolicy policy ) {
373 return checkIfToRefreshMetadata ( info, zypp::MirroredOrigin(url), policy );
374 }
375
393 expected<void> refreshMetadata( const RepoInfo & info, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress = nullptr );
394
395 std::vector<std::pair<RepoInfo, expected<void> > > refreshMetadata(std::vector<RepoInfo> infos, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress = nullptr );
396
397 expected<zypp::repo::RepoType> probe( const zypp::MirroredOrigin &origin, const zypp::Pathname & path = zypp::Pathname() ) const;
398
399 expected<void> buildCache( const RepoInfo & info, CacheBuildPolicy policy, ProgressObserverRef myProgress = nullptr );
400
404 expected<RepoInfo> addRepository( const RepoInfo & info, const ProgressObserverRef myProgress = nullptr, const zypp::TriBool & forcedProbe = zypp::indeterminate );
405
406 expected<void> addRepositories( const zypp::Url & url, ProgressObserverRef myProgress = nullptr );
407
408 public:
409 bool serviceEmpty() const { return _services.empty(); }
410 ServiceSizeType serviceSize() const { return _services.size(); }
411 ServiceConstIterator serviceBegin() const { return _services.begin(); }
412 ServiceConstIterator serviceEnd() const { return _services.end(); }
413
414 bool hasService( const std::string & alias ) const
415 { return foundAliasIn( alias, _services ); }
416
417 ServiceInfo getService( const std::string & alias ) const
418 {
419 ServiceConstIterator it( findAlias( alias, _services ) );
420 return it == _services.end() ? ServiceInfo::noService : *it;
421 }
422
423 public:
424
425 expected<zypp::repo::ServiceType> probeService( const zypp::Url & url ) const;
426
427 expected<void> addService( const ServiceInfo & service );
428 expected<void> addService( const std::string & alias, const zypp::Url & url )
429 { return addService( ServiceInfo( alias, url ) ); }
430
431 expected<void> removeService( const std::string & alias );
432 expected<void> removeService( const ServiceInfo & service )
433 { return removeService( service.alias() ); }
434
435 expected<void> refreshService( const std::string & alias, const RefreshServiceOptions & options_r );
436 expected<void> refreshService( const ServiceInfo & service, const RefreshServiceOptions & options_r )
437 { return refreshService( service.alias(), options_r ); }
438
439 expected<void> refreshServices( const RefreshServiceOptions & options_r );
440
441 expected<void> modifyService( const std::string & oldAlias, const ServiceInfo & newService );
442
443 static expected<void> touchIndexFile( const RepoInfo & info, const RepoManagerOptions &options );
444
445 expected<void> setCacheStatus( const RepoInfo & info, const RepoStatus & status )
446 {
447 using namespace zyppng::operators;
448 return solv_path_for_repoinfo( _options, info )
449 | and_then( [&]( zypp::Pathname base ){
450 try {
451 zypp::filesystem::assert_dir(base);
452 status.saveToCookieFile( base / "cookie" );
453 } catch ( const zypp::Exception &e ) {
454 return expected<void>::error( std::make_exception_ptr(e) );
455 }
456 return expected<void>::success();
457 });
458 }
459
464 expected<void> refreshGeoIp ( const RepoInfo::url_set &urls );
465
466 template<typename OutputIterator>
467 void getRepositoriesInService( const std::string & alias, OutputIterator out ) const
468 {
469 MatchServiceAlias filter( alias );
470 std::copy( boost::make_filter_iterator( filter, repos().begin(), repos().end() ),
471 boost::make_filter_iterator( filter, repos().end(), repos().end() ),
472 out);
473 }
474
475 zypp::Pathname generateNonExistingName( const zypp::Pathname & dir, const std::string & basefilename ) const;
476
477 std::string generateFilename( const RepoInfo & info ) const
478 { return filenameFromAlias( info.alias(), "repo" ); }
479
480 std::string generateFilename( const ServiceInfo & info ) const
481 { return filenameFromAlias( info.alias(), "service" ); }
482
483
484 protected:
485 expected<void> saveService( ServiceInfo & service ) const;
486 expected<void> touchIndexFile( const RepoInfo & info );
487
488 protected:
489 expected<void> init_knownServices();
490 expected<void> init_knownRepositories();
491
492 public:
493 const RepoSet & repos() const { return _reposX; }
494 RepoSet & reposManip() { if ( ! _reposDirty ) _reposDirty = true; return _reposX; }
495
496 public:
497 PluginRepoverification pluginRepoverification() const
498 { return _pluginRepoverification; }
499
500 protected:
501 ContextRefType _zyppContext;
502 RepoManagerOptions _options;
503 RepoSet _reposX;
504 ServiceSet _services;
505 PluginRepoverification _pluginRepoverification;
506 zypp::DefaultIntegral<bool,false> _reposDirty;
507 };
508}
509
510#endif //ZYPP_NG_REPOMANAGER_INCLUDED
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:463
Gettext.h
_
#define _(MSG)
Definition Gettext.h:39
NonCopyable.h
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:153
zypp::MirroredOrigin
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
Definition MirroredOrigin.h:170
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:777
zypp::RepoInfo::usesAutoMetadataPaths
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
Definition RepoInfo.cc:786
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:822
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:825
zypp::RepoInfo::packagesPath
Pathname packagesPath() const
packagesPath Checks if the effective user is allowed to write into the system package cache.
Definition RepoInfo.cc:783
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:516
zypp::filesystem::PathInfo
Wrapper class for stat/lstat.
Definition PathInfo.h:226
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::filesystem::Pathname::dirname
Pathname dirname() const
Return all but the last component od this path.
Definition Pathname.h:133
zypp::filesystem::Pathname::empty
bool empty() const
Test for an empty path.
Definition Pathname.h:117
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:113
zypp::repo::RepoInfoBase::filepath
Pathname filepath() const
File where this repo was read from.
Definition RepoInfoBase.cc:133
zypp::repo::RepoInfoBase::alias
std::string alias() const
unique identifier for this source.
Definition RepoInfoBase.cc:110
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:27
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:241
zyppng::RepoManager::refreshService
expected< void > refreshService(const ServiceInfo &service, const RefreshServiceOptions &options_r)
Definition repomanager.h:436
zyppng::RepoManager::cacheStatus
static expected< RepoStatus > cacheStatus(const RepoInfo &info, const RepoManagerOptions &options)
Definition repomanager.h:350
zyppng::RepoManager::RepoSizeType
RepoSet::size_type RepoSizeType
Definition repomanager.h:291
zyppng::RepoManager::getRepo
RepoInfo getRepo(const std::string &alias) const
Definition repomanager.h:314
zyppng::RepoManager::cleanPackages
expected< void > cleanPackages(const RepoInfo &info, ProgressObserverRef myProgress=nullptr, bool isAutoClean=false)
Definition repomanager.cc:396
zyppng::RepoManager::touchIndexFile
static expected< void > touchIndexFile(const RepoInfo &info, const RepoManagerOptions &options)
zyppng::RepoManager::ContextRefType
ContextRef ContextRefType
Definition repomanager.h:245
zyppng::RepoManager::checkIfToRefreshMetadata
expected< RefreshCheckStatus > checkIfToRefreshMetadata(const RepoInfo &info, const zypp::MirroredOrigin &origin, RawMetadataRefreshPolicy policy)
Definition repomanager.cc:826
zyppng::RepoManager::cacheStatus
expected< RepoStatus > cacheStatus(const RepoInfo &info) const
Definition repomanager.h:347
zyppng::RepoManager::removeRepository
expected< void > removeRepository(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:610
zyppng::RepoManager::RepoConstIterator
RepoSet::const_iterator RepoConstIterator
Definition repomanager.h:290
zyppng::RepoManager::isCached
expected< bool > isCached(const RepoInfo &info) const
Definition repomanager.h:340
zyppng::RepoManager::refreshGeoIp
expected< void > refreshGeoIp(const RepoInfo::url_set &urls)
zyppng::RepoManager::ContextType
Context ContextType
Definition repomanager.h:246
zyppng::RepoManager::ZYPP_DECL_PRIVATE_CONSTR_ARGS
ZYPP_DECL_PRIVATE_CONSTR_ARGS(RepoManager, ContextRef zyppCtx, RepoManagerOptions opt)
zyppng::RepoManager::buildCache
expected< void > buildCache(const RepoInfo &info, CacheBuildPolicy policy, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:979
zyppng::RepoManager::addProbedRepository
expected< RepoInfo > addProbedRepository(RepoInfo info, zypp::repo::RepoType probedType)
Definition repomanager.cc:570
zyppng::RepoManager::generateFilename
std::string generateFilename(const RepoInfo &info) const
Definition repomanager.h:477
zyppng::RepoManager::_services
ServiceSet _services
Definition repomanager.h:504
zyppng::RepoManager::_reposX
RepoSet _reposX
Definition repomanager.h:503
zyppng::RepoManager::init_knownServices
expected< void > init_knownServices()
zyppng::RepoManager::getService
ServiceInfo getService(const std::string &alias) const
Definition repomanager.h:417
zyppng::RepoManager::zyppContext
ContextRefType zyppContext() const
Definition repomanager.h:300
zyppng::RepoManager::repoEmpty
bool repoEmpty() const
Definition repomanager.h:306
zyppng::RepoManager::RefreshServiceOptions
zypp::RepoManagerFlags::RefreshServiceOptions RefreshServiceOptions
Definition repomanager.h:256
zyppng::RepoManager::modifyRepository
expected< RepoInfo > modifyRepository(const std::string &alias, const RepoInfo &newinfo_r, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:699
zyppng::RepoManager::_reposDirty
zypp::DefaultIntegral< bool, false > _reposDirty
Definition repomanager.h:506
zyppng::RepoManager::cleanCacheDirGarbage
expected< void > cleanCacheDirGarbage(ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:441
zyppng::RepoManager::metadataStatus
static expected< RepoStatus > metadataStatus(const RepoInfo &info, const RepoManagerOptions &options)
Definition repomanager.cc:307
zyppng::RepoManager::create
static expected< std::shared_ptr< RepoManager > > create(Args &&...args)
Definition repomanager.h:262
zyppng::RepoManager::setCacheStatus
expected< void > setCacheStatus(const RepoInfo &info, const RepoStatus &status)
Definition repomanager.h:445
zyppng::RepoManager::hasRepo
bool hasRepo(const std::string &alias) const
Definition repomanager.h:311
zyppng::RepoManager::saveService
expected< void > saveService(ServiceInfo &service) const
Definition repomanager.cc:1216
zyppng::RepoManager::refreshMetadata
expected< void > refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress=nullptr)
Refresh local raw cache.
Definition repomanager.cc:842
zyppng::RepoManager::checkIfToRefreshMetadata
expected< RefreshCheckStatus > checkIfToRefreshMetadata(const RepoInfo &info, const zypp::Url &url, RawMetadataRefreshPolicy policy)
Definition repomanager.h:372
zyppng::RepoManager::getRepositoryInfo
expected< RepoInfo > getRepositoryInfo(const std::string &alias)
Definition repomanager.cc:788
zyppng::RepoManager::removeService
expected< void > removeService(const std::string &alias)
Definition repomanager.cc:1071
zyppng::RepoManager::addService
expected< void > addService(const ServiceInfo &service)
Definition repomanager.cc:1011
zyppng::RepoManager::RawMetadataRefreshPolicy
zypp::RepoManagerFlags::RawMetadataRefreshPolicy RawMetadataRefreshPolicy
Definition repomanager.h:248
zyppng::RepoManager::ServiceConstIterator
ServiceSet::const_iterator ServiceConstIterator
Definition repomanager.h:285
zyppng::RepoManager::RefreshServiceBit
zypp::RepoManagerFlags::RefreshServiceBit RefreshServiceBit
Flags for tuning RefreshService.
Definition repomanager.h:255
zyppng::RepoManager::refreshService
expected< void > refreshService(const std::string &alias, const RefreshServiceOptions &options_r)
Definition repomanager.cc:1040
zyppng::RepoManager::loadFromCache
expected< void > loadFromCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:518
zyppng::RepoManager::probeCache
static zypp::repo::RepoType probeCache(const zypp::Pathname &path_r)
Probe Metadata in a local cache directory.
Definition repomanager.cc:423
zyppng::RepoManager::repos
const RepoSet & repos() const
Definition repomanager.h:493
zyppng::RepoManager::serviceBegin
ServiceConstIterator serviceBegin() const
Definition repomanager.h:411
zyppng::RepoManager::generateNonExistingName
zypp::Pathname generateNonExistingName(const zypp::Pathname &dir, const std::string &basefilename) const
zyppng::RepoManager::_zyppContext
ContextRefType _zyppContext
Definition repomanager.h:501
zyppng::RepoManager::removeService
expected< void > removeService(const ServiceInfo &service)
Definition repomanager.h:432
zyppng::RepoManager::touchIndexFile
expected< void > touchIndexFile(const RepoInfo &info)
zyppng::RepoManager::pluginRepoverification
PluginRepoverification pluginRepoverification() const
Definition repomanager.h:497
zyppng::RepoManager::_pluginRepoverification
PluginRepoverification _pluginRepoverification
Definition repomanager.h:505
zyppng::RepoManager::ZYPP_ADD_PRIVATE_CONSTR_HELPER
ZYPP_ADD_PRIVATE_CONSTR_HELPER()
zyppng::RepoManager::getRepositoriesInService
void getRepositoriesInService(const std::string &alias, OutputIterator out) const
Definition repomanager.h:467
zyppng::RepoManager::repoEnd
RepoConstIterator repoEnd() const
Definition repomanager.h:309
zyppng::RepoManager::cleanCache
expected< void > cleanCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:498
zyppng::RepoManager::repoBegin
RepoConstIterator repoBegin() const
Definition repomanager.h:308
zyppng::RepoManager::RepoSet
std::set< RepoInfo > RepoSet
RepoInfo typedefs.
Definition repomanager.h:289
zyppng::RepoManager::refreshServices
expected< void > refreshServices(const RefreshServiceOptions &options_r)
Definition repomanager.cc:1049
zyppng::RepoManager::initialize
expected< void > initialize()
Definition repomanager.cc:292
zyppng::RepoManager::ServiceSet
std::set< ServiceInfo > ServiceSet
ServiceInfo typedefs.
Definition repomanager.h:284
zyppng::RepoManager::serviceEmpty
bool serviceEmpty() const
Definition repomanager.h:409
zyppng::RepoManager::addRepository
expected< RepoInfo > addRepository(const RepoInfo &info, const ProgressObserverRef myProgress=nullptr, const zypp::TriBool &forcedProbe=zypp::indeterminate)
Definition repomanager.cc:992
zyppng::RepoManager::reposManip
RepoSet & reposManip()
Definition repomanager.h:494
zyppng::RepoManager::_options
RepoManagerOptions _options
Definition repomanager.h:502
zyppng::RepoManager::init_knownRepositories
expected< void > init_knownRepositories()
Definition repomanager.cc:1399
zyppng::RepoManager::addService
expected< void > addService(const std::string &alias, const zypp::Url &url)
Definition repomanager.h:428
zyppng::RepoManager::RefreshCheckStatus
zypp::RepoManagerFlags::RefreshCheckStatus RefreshCheckStatus
Definition repomanager.h:252
zyppng::RepoManager::addRepositories
expected< void > addRepositories(const zypp::Url &url, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:998
zyppng::RepoManager::packagesPath
expected< zypp::Pathname > packagesPath(const RepoInfo &info) const
Definition repomanager.h:324
zyppng::RepoManager::serviceSize
ServiceSizeType serviceSize() const
Definition repomanager.h:410
zyppng::RepoManager::cleanMetadata
expected< void > cleanMetadata(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition repomanager.cc:377
zyppng::RepoManager::~RepoManager
virtual ~RepoManager()
Definition repomanager.cc:247
zyppng::RepoManager::repoSize
RepoSizeType repoSize() const
Definition repomanager.h:307
zyppng::RepoManager::modifyService
expected< void > modifyService(const std::string &oldAlias, const ServiceInfo &newService)
Definition repomanager.cc:1133
zyppng::RepoManager::metadataPath
expected< zypp::Pathname > metadataPath(const RepoInfo &info) const
Definition repomanager.h:321
zyppng::RepoManager::serviceEnd
ServiceConstIterator serviceEnd() const
Definition repomanager.h:412
zyppng::RepoManager::hasService
bool hasService(const std::string &alias) const
Definition repomanager.h:414
zyppng::RepoManager::options
const RepoManagerOptions & options() const
Definition repomanager.cc:301
zyppng::RepoManager::CacheBuildPolicy
zypp::RepoManagerFlags::CacheBuildPolicy CacheBuildPolicy
Definition repomanager.h:249
zyppng::RepoManager::probe
expected< zypp::repo::RepoType > probe(const zypp::MirroredOrigin &origin, const zypp::Pathname &path=zypp::Pathname()) const
Probe the metadata type of a repository located at url.
Definition repomanager.cc:963
zyppng::RepoManager::probeService
expected< zypp::repo::ServiceType > probeService(const zypp::Url &url) const
Definition repomanager.cc:1005
zyppng::RepoManager::ServiceSizeType
ServiceSet::size_type ServiceSizeType
Definition repomanager.h:286
zyppng::RepoManager::generateFilename
std::string generateFilename(const ServiceInfo &info) const
Definition repomanager.h:480
zyppng::ServiceCollector::ServiceCollector
ServiceCollector(ServiceSet &services_r)
Definition repomanager.h:214
zyppng::ServiceCollector::operator()
bool operator()(const ServiceInfo &service_r) const
Definition repomanager.h:218
zyppng::ServiceCollector::_services
ServiceSet & _services
Definition repomanager.h:225
zyppng::ServiceCollector::ServiceSet
std::set< ServiceInfo > ServiceSet
Definition repomanager.h:212
zyppng::expected
Definition expected.h:56
zyppng::expected::success
static expected success(ConsParams &&...params)
Definition expected.h:178
zyppng::expected::error
E & error()
Definition expected.h:288
context.h
expected.h
zypp::TriBool
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition String.h:31
std
Definition ansi.h:855
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:338
zypp::filter
Definition Filter.h:29
zypp::url
Url details namespace.
Definition UrlBase.cc:58
zyppng::operators
Definition expected.h:699
zyppng::operators::collect
detail::collect_helper collect()
Definition expected.h:735
zyppng::repo
Definition downloader.cc:22
zyppng
Definition MediaNetworkRequestExecutor.h:16
zyppng::isTmpRepo
bool isTmpRepo(const RepoInfo &info_r)
Whether repo is not under RM control and provides its own methadata paths.
Definition repomanager.h:49
zyppng::assert_url
expected< void > assert_url(const ServiceInfo &info)
Definition repomanager.h:155
zyppng::assert_urls
expected< void > assert_urls(const RepoInfo &info)
Definition repomanager.cc:227
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:470
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:166
zyppng::assert_alias
expected< void > assert_alias(const RepoInfo &info)
Definition repomanager.h:52
zyppng::and_then
ResultType and_then(const expected< T, E > &exp, Function &&f)
Definition expected.h:520
zyppng::ServiceInfo
zypp::ServiceInfo ServiceInfo
Definition repomanager.h:41
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:199
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::findAlias
Iterator findAlias(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Find alias_r in repo/service container.
Definition repomanager.h:93
zyppng::PluginRepoverification
zypp_private::repo::PluginRepoverification PluginRepoverification
Definition repomanager.h:43
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:79
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:189
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:180
zyppng::RepoInfoList
zypp::RepoInfoList RepoInfoList
Definition repomanager.h:40
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::RepoCollector::RepoCollector
RepoCollector(std::string targetDistro_)
Definition repomanager.h:133
zyppng::RepoCollector::targetDistro
std::string targetDistro
Definition repomanager.h:140
zyppng::RepoCollector::repos
RepoInfoList repos
Definition repomanager.h:139
zyppng::RepoCollector::RepoCollector
RepoCollector()
Definition repomanager.h:130
zyppng::RepoManager::MatchServiceAlias
Functor thats filter RepoInfo by service which it belongs to.
Definition repomanager.h:274
zyppng::RepoManager::MatchServiceAlias::MatchServiceAlias
MatchServiceAlias(std::string alias_)
Definition repomanager.h:276
zyppng::RepoManager::MatchServiceAlias::alias
std::string alias
Definition repomanager.h:280
zyppng::RepoManager::MatchServiceAlias::operator()
bool operator()(const RepoInfo &info) const
Definition repomanager.h:277
PathInfo.h
zyppglobal.h
ZYPP_FWD_DECL_TYPE_WITH_REFS
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)
Definition zyppglobal.h:126