libzypp  17.37.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 
17 #include <zypp/RepoManagerFlags.h>
19 #include <zypp/RepoStatus.h>
20 
24 
25 #include <zypp-core/base/Gettext.h>
26 #include <zypp-core/base/DefaultIntegral>
28 #include <zypp-core/fs/PathInfo.h>
30 #include <zypp-core/zyppng/base/Base>
33 
34 namespace zyppng {
35 
42 
47 
49  using SyncRepoManagerRef = RepoManagerRef<SyncContextRef>;
50 
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() )
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] == '.')
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())
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] == '.')
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  }
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  }
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() ); }
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 
135  {
137  {}
138 
139  RepoCollector(std::string targetDistro_)
140  : targetDistro(std::move(targetDistro_))
141  {}
142 
143  bool collect( const RepoInfo &repo );
144 
146  std::string targetDistro;
147  };
149 
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() )
165  return expected<void>::success();
166  }
167 
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 
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 
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 
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 
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:
232  };
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  {
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 
259 
260 
262 
266 
267 
268  ZYPP_DECL_PRIVATE_CONSTR_ARGS (RepoManager, ZyppContextRefType zyppCtx, RepoManagerOptions opt );
269 
270  template < typename ...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 
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;
296 
298  using RepoSet = std::set<RepoInfo>;
299  using RepoConstIterator = RepoSet::const_iterator;
301 
302 
303  virtual ~RepoManager();
304 
305  public:
306 
308 
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:
331  { return rawcache_path_for_repoinfo( _options, info ); }
332 
334  { return packagescache_path_for_repoinfo( _options, info ); }
335 
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 
357  { return cacheStatus( info, _options ); }
358 
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 
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 );
378 
379  expected<RefreshCheckStatus> checkIfToRefreshMetadata( const RepoInfo & info, const std::vector<zypp::Url> &urls, RawMetadataRefreshPolicy policy );
380 
382  return checkIfToRefreshMetadata ( info, std::vector<zypp::Url>{url}, policy );
383  }
384 
402  expected<void> refreshMetadata( const RepoInfo & info, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress = nullptr );
403 
404  std::vector<std::pair<RepoInfo, expected<void> > > refreshMetadata(std::vector<RepoInfo> infos, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress = nullptr );
405 
406  expected<zypp::repo::RepoType> probe( const std::vector<zypp::Url> & url, const zypp::Pathname & path = zypp::Pathname() ) const;
407 
408  expected<void> buildCache( const RepoInfo & info, CacheBuildPolicy policy, ProgressObserverRef myProgress = nullptr );
409 
413  expected<RepoInfo> addRepository( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
414 
415  expected<void> addRepositories( const zypp::Url & url, ProgressObserverRef myProgress = nullptr );
416 
417  public:
418  bool serviceEmpty() const { return _services.empty(); }
419  ServiceSizeType serviceSize() const { return _services.size(); }
420  ServiceConstIterator serviceBegin() const { return _services.begin(); }
421  ServiceConstIterator serviceEnd() const { return _services.end(); }
422 
423  bool hasService( const std::string & alias ) const
424  { return foundAliasIn( alias, _services ); }
425 
426  ServiceInfo getService( const std::string & alias ) const
427  {
428  ServiceConstIterator it( findAlias( alias, _services ) );
429  return it == _services.end() ? ServiceInfo::noService : *it;
430  }
431 
432  public:
433 
435 
436  expected<void> addService( const ServiceInfo & service );
437  expected<void> addService( const std::string & alias, const zypp::Url & url )
438  { return addService( ServiceInfo( alias, url ) ); }
439 
440  expected<void> removeService( const std::string & alias );
442  { return removeService( service.alias() ); }
443 
444  expected<void> refreshService( const std::string & alias, const RefreshServiceOptions & options_r );
445  expected<void> refreshService( const ServiceInfo & service, const RefreshServiceOptions & options_r )
446  { return refreshService( service.alias(), options_r ); }
447 
449 
450  expected<void> modifyService( const std::string & oldAlias, const ServiceInfo & newService );
451 
452  static expected<void> touchIndexFile( const RepoInfo & info, const RepoManagerOptions &options );
453 
454  expected<void> setCacheStatus( const RepoInfo & info, const RepoStatus & status )
455  {
456  using namespace zyppng::operators;
457  return solv_path_for_repoinfo( _options, info )
458  | and_then( [&]( zypp::Pathname base ){
459  try {
461  status.saveToCookieFile( base / "cookie" );
462  } catch ( const zypp::Exception &e ) {
463  return expected<void>::error( std::make_exception_ptr(e) );
464  }
465  return expected<void>::success();
466  });
467  }
468 
474 
475  template<typename OutputIterator>
476  void getRepositoriesInService( const std::string & alias, OutputIterator out ) const
477  {
478  MatchServiceAlias filter( alias );
479  std::copy( boost::make_filter_iterator( filter, repos().begin(), repos().end() ),
480  boost::make_filter_iterator( filter, repos().end(), repos().end() ),
481  out);
482  }
483 
484  zypp::Pathname generateNonExistingName( const zypp::Pathname & dir, const std::string & basefilename ) const;
485 
486  std::string generateFilename( const RepoInfo & info ) const
487  { return filenameFromAlias( info.alias(), "repo" ); }
488 
489  std::string generateFilename( const ServiceInfo & info ) const
490  { return filenameFromAlias( info.alias(), "service" ); }
491 
492 
493  protected:
494  expected<void> saveService( ServiceInfo & service ) const;
495  expected<void> touchIndexFile( const RepoInfo & info );
496 
497  protected:
500 
501  public:
502  const RepoSet & repos() const { return _reposX; }
503  RepoSet & reposManip() { if ( ! _reposDirty ) _reposDirty = true; return _reposX; }
504 
505  public:
507  { return _pluginRepoverification; }
508 
509  protected:
516  };
517 }
518 
519 #endif //ZYPP_NG_REPOMANAGER_INCLUDED
static expected< std::shared_ptr< RepoManager< ZyppContextRefType > > > create(Args &&...args)
Definition: repomanager.h:271
bool repoEmpty() const
Definition: repomanager.h:315
Pathname filepath() const
File where this repo was read from.
expected< void > modifyService(const std::string &oldAlias, const ServiceInfo &newService)
ZyppContextRefType ContextRefType
Definition: repomanager.h:254
std::set< RepoInfo > RepoSet
RepoInfo typedefs.
Definition: repomanager.h:298
Service data.
Definition: ServiceInfo.h:36
Pathname path() const
Repository path.
Definition: RepoInfo.cc:792
Thrown when the repo alias is found to be invalid.
zypp::RepoStatus RepoStatus
Definition: repomanager.h:37
std::string targetDistro
Definition: repomanager.h:146
RepoInfo getRepo(const std::string &alias) const
Definition: repomanager.h:323
int assert_dir(const Pathname &path, unsigned mode)
Like &#39;mkdir -p&#39;.
Definition: PathInfo.cc:324
expected< void > init_knownServices()
bool operator()(const RepoInfo &info) const
Definition: repomanager.h:286
#define _(MSG)
Definition: Gettext.h:39
Repository metadata verification beyond GPG.
zypp::RepoInfo RepoInfo
Definition: repomanager.h:36
expected< void > saveService(ServiceInfo &service) const
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:795
RepoCollector(std::string targetDistro_)
Definition: repomanager.h:139
bool hasRepo(const std::string &alias) const
Definition: repomanager.h:320
const RepoManagerOptions & options() const
Definition: repomanager.cc:303
RefreshServiceFlags RefreshServiceOptions
Options tuning RefreshService.
expected< void > addService(const std::string &alias, const zypp::Url &url)
Definition: repomanager.h:437
ServiceConstIterator serviceBegin() const
Definition: repomanager.h:420
bool hasService(const std::string &alias) const
Definition: repomanager.h:423
RepoSizeType repoSize() const
Definition: repomanager.h:316
expected< zypp::Pathname > metadataPath(const RepoInfo &info) const
Definition: repomanager.h:330
expected< std::list< RepoInfo > > repositories_in_file(const zypp::Pathname &file)
Reads RepoInfo&#39;s from a repo file.
Definition: repomanager.cc:167
expected< void > removeService(const ServiceInfo &service)
Definition: repomanager.h:441
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
expected< RepoInfo > addProbedRepository(RepoInfo info, zypp::repo::RepoType probedType)
Definition: repomanager.cc:572
zypp::RepoManagerFlags::CacheBuildPolicy CacheBuildPolicy
Definition: repomanager.h:258
expected< RefreshCheckStatus > checkIfToRefreshMetadata(const RepoInfo &info, const zypp::Url &url, RawMetadataRefreshPolicy policy)
Definition: repomanager.h:381
bool isTmpRepo(const RepoInfo &info_r)
Whether repo is not under RM control and provides its own methadata paths.
Definition: repomanager.h:55
Definition: Arch.h:363
What is known about a repository.
Definition: RepoInfo.h:71
static expected< std::decay_t< Type >, Err > make_expected_success(Type &&t)
Definition: expected.h:397
expected< void > cleanCacheDirGarbage(ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:443
std::string escaped_alias() const
Same as alias(), just escaped in a way to be a valid file name.
zypp::DefaultIntegral< bool, false > _reposDirty
Definition: repomanager.h:515
static RepoStatus fromCookieFile(const Pathname &path)
Reads the status from a cookie file.
Definition: RepoStatus.cc:210
Service without alias was used in an operation.
#define ZYPP_EXCPT_PTR(EXCPT)
Drops a logline and returns Exception as a std::exception_ptr.
Definition: Exception.h:463
Url::asString() view options.
Definition: UrlBase.h:40
expected< void > assert_url(const ServiceInfo &info)
Definition: repomanager.h:161
bool serviceEmpty() const
Definition: repomanager.h:418
expected< void > refreshServices(const RefreshServiceOptions &options_r)
static zypp::repo::RepoType probeCache(const zypp::Pathname &path_r)
Probe Metadata in a local cache directory.
Definition: repomanager.cc:425
static expected< void > touchIndexFile(const RepoInfo &info, const RepoManagerOptions &options)
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
RepoSet::size_type RepoSizeType
Definition: repomanager.h:300
ContextRefType _zyppContext
Definition: repomanager.h:510
zypp::RepoInfoList RepoInfoList
Definition: repomanager.h:38
Repo manager settings.
static expected< RepoStatus > metadataStatus(const RepoInfo &info, const RepoManagerOptions &options)
Definition: repomanager.cc:309
ZYPP_DECL_PRIVATE_CONSTR_ARGS(RepoManager, ZyppContextRefType zyppCtx, RepoManagerOptions opt)
virtual ~RepoManager()
Definition: repomanager.cc:249
RepoConstIterator repoEnd() const
Definition: repomanager.h:318
void getRepositoriesInService(const std::string &alias, OutputIterator out) const
Definition: repomanager.h:476
Simple callback to collect the results.
Definition: repomanager.h:134
std::string generateFilename(const ServiceInfo &info) const
Definition: repomanager.h:489
expected< void > addRepositories(const zypp::Url &url, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:991
void saveToCookieFile(const Pathname &path_r) const
Save the status information to a cookie file.
Definition: RepoStatus.cc:224
bool empty() const
Test for an empty path.
Definition: Pathname.h:116
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
const RepoSet & repos() const
Definition: repomanager.h:502
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
PluginRepoverification _pluginRepoverification
Definition: repomanager.h:514
bool collect(const RepoInfo &repo)
Definition: repomanager.cc:148
ServiceSet _services
Definition: repomanager.h:513
Functor thats filter RepoInfo by service which it belongs to.
Definition: repomanager.h:282
expected< void > loadFromCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:520
std::string alias() const
unique identifier for this source.
std::set< ServiceInfo > ServiceSet
Definition: repomanager.h:218
ServiceSizeType serviceSize() const
Definition: repomanager.h:419
RepoManagerRef< SyncContextRef > SyncRepoManagerRef
Definition: repomanager.h:49
expected< void > assert_alias(const RepoInfo &info)
Definition: repomanager.h:58
Pathname dirname() const
Return all but the last component od this path.
Definition: Pathname.h:126
expected< zypp::repo::RepoType > probe(const std::vector< zypp::Url > &url, const zypp::Pathname &path=zypp::Pathname()) const
Probe the metadata type of a repository located at url.
Definition: repomanager.cc:959
ZYPP_FWD_DECL_TEMPL_TYPE_WITH_REFS_ARG1(RepoManager, ZyppContextRefType)
RepoConstIterator repoBegin() const
Definition: repomanager.h:317
ServiceInfo getService(const std::string &alias) const
Definition: repomanager.h:426
zypp::Pathname generateNonExistingName(const zypp::Pathname &dir, const std::string &basefilename) const
Generate a non existing filename in a directory, using a base name.
expected< void > refreshService(const std::string &alias, const RefreshServiceOptions &options_r)
RepoInfoList repos
Definition: repomanager.h:145
expected< RepoInfo > addRepository(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:985
bool isValid() const
Verifies the Url.
Definition: Url.cc:507
std::list< Url > url_set
Definition: RepoInfo.h:108
RepoSet::const_iterator RepoConstIterator
Definition: repomanager.h:299
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition: RepoInfo.cc:750
ZYPP_ENABLE_MAYBE_ASYNC_MIXIN((std::is_same_v< ZyppContextRefType, ContextRef >))
static expected success(ConsParams &&...params)
Definition: expected.h:115
Url url() const
The service url.
Definition: ServiceInfo.cc:102
zypp::ServiceInfo ServiceInfo
Definition: repomanager.h:39
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
Definition: RepoInfo.cc:756
zypp::RepoManagerFlags::RefreshServiceOptions RefreshServiceOptions
Definition: repomanager.h:265
expected< RepoInfo > getRepositoryInfo(const std::string &alias)
Definition: repomanager.cc:790
expected< void > buildCache(const RepoInfo &info, CacheBuildPolicy policy, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:972
std::ostream & copy(std::istream &from_r, std::ostream &to_r)
Copy istream to ostream.
Definition: IOStream.h:51
expected< RefreshCheckStatus > checkIfToRefreshMetadata(const RepoInfo &info, const std::vector< zypp::Url > &urls, RawMetadataRefreshPolicy policy)
Definition: repomanager.cc:828
static expected< RepoStatus > cacheStatus(const RepoInfo &info, const RepoManagerOptions &options)
Definition: repomanager.h:359
bool autoPruneInDir(const zypp::Pathname &path_r)
bsc#1204956: Tweak to prevent auto pruning package caches.
Definition: repomanager.cc:234
expected< void > cleanMetadata(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:379
typename ZyppContextRefType::element_type ContextType
Definition: repomanager.h:255
expected< RepoStatus > cacheStatus(const RepoInfo &info) const
Definition: repomanager.h:356
thrown when it was impossible to determine an alias for this repo.
Definition: RepoException.h:91
expected< void > assert_urls(const RepoInfo &info)
Definition: repomanager.cc:227
expected< void > refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress=nullptr)
Refresh local raw cache.
Definition: repomanager.cc:843
ServiceConstIterator serviceEnd() const
Definition: repomanager.h:421
Base class for Exception.
Definition: Exception.h:152
ServiceSet::size_type ServiceSizeType
Definition: repomanager.h:295
std::set< ServiceInfo > ServiceSet
ServiceInfo typedefs.
Definition: repomanager.h:293
zypp_private::repo::PluginRepoverification PluginRepoverification
Definition: repomanager.h:41
expected< void > refreshGeoIp(const RepoInfo::url_set &urls)
ZYPP_FWD_DECL_TYPE_WITH_REFS(EventDispatcher)
ServiceCollector(ServiceSet &services_r)
Definition: repomanager.h:220
expected< void > addService(const ServiceInfo &service)
expected< void > setCacheStatus(const RepoInfo &info, const RepoStatus &status)
Definition: repomanager.h:454
zypp::RepoManagerFlags::RawMetadataRefreshPolicy RawMetadataRefreshPolicy
Definition: repomanager.h:257
Iterator findAlias(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Find alias_r in repo/service container.
Definition: repomanager.h:99
expected< void > removeRepository(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:612
auto and_then(Fun &&function)
Definition: expected.h:623
RepoManagerOptions _options
Definition: repomanager.h:511
expected< zypp::repo::ServiceType > probeService(const zypp::Url &url) const
Definition: repomanager.cc:998
Pathname packagesPath() const
Path where this repo packages are cached.
Definition: RepoInfo.cc:753
expected< bool > isCached(const RepoInfo &info) const
Definition: repomanager.h:349
Wrapper class for ::stat/::lstat.
Definition: PathInfo.h:225
expected< void > removeService(const std::string &alias)
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition: RepoInfo.h:85
expected< void > initialize()
Definition: repomanager.cc:294
Thrown when the repo alias is found to be invalid.
RepoManagerRef< ContextRef > AsyncRepoManagerRef
Definition: repomanager.h:52
std::string generateFilename(const RepoInfo &info) const
Definition: repomanager.h:486
bool operator()(const ServiceInfo &service_r) const
Definition: repomanager.h:224
RefreshCheckStatus
Possibly return state of RepoManager::checkIfToRefreshMetadata function.
ResultType and_then(const expected< T, E > &exp, Function &&f)
Definition: expected.h:423
expected< void > cleanPackages(const RepoInfo &info, ProgressObserverRef myProgress=nullptr, bool isAutoClean=false)
Definition: repomanager.cc:398
expected< void > init_knownRepositories()
RepoSet & reposManip()
Definition: repomanager.h:503
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
Track changing files or directories.
Definition: RepoStatus.h:40
The RepoManager class Provides knowledge and methods to maintain repo settings and metadata for a giv...
Definition: repomanager.h:247
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
expected< zypp::Pathname > packagesPath(const RepoInfo &info) const
Definition: repomanager.h:333
ContextRefType zyppContext() const
Definition: repomanager.h:309
ServiceSet::const_iterator ServiceConstIterator
Definition: repomanager.h:294
RefreshServiceBit
Flags for tuning RefreshService.
expected< void > refreshService(const ServiceInfo &service, const RefreshServiceOptions &options_r)
Definition: repomanager.h:445
SolvableIdType size_type
Definition: PoolMember.h:126
PluginRepoverification pluginRepoverification() const
Definition: repomanager.h:506
Service has no or invalid url defined.
zypp::RepoManagerOptions RepoManagerOptions
Definition: repomanager.h:40
Functor collecting ServiceInfos into a ServiceSet.
Definition: repomanager.h:215
Url manipulation class.
Definition: Url.h:92
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
expected< void > cleanCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:500
Repository type enumeration.
Definition: RepoType.h:28
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
expected< RepoInfo > modifyRepository(const std::string &alias, const RepoInfo &newinfo_r, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:701