libzypp  17.35.12
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 
41 
46 
48  using SyncRepoManagerRef = RepoManagerRef<SyncContextRef>;
49 
51  using AsyncRepoManagerRef = RepoManagerRef<ContextRef>;
52 
54  inline bool isTmpRepo( const RepoInfo & info_r )
55  { return( info_r.filepath().empty() && info_r.usesAutoMetadataPaths() ); }
56 
57  inline expected<void> assert_alias(const RepoInfo &info)
58  {
59  if ( info.alias().empty() )
61  // bnc #473834. Maybe we can match the alias against a regex to define
62  // and check for valid aliases
63  if ( info.alias()[0] == '.')
65  info, _("Repository alias cannot start with dot."))) );
66 
67  return expected<void>::success();
68  }
69 
70  inline expected<void> assert_alias(const ServiceInfo &info) {
71  if (info.alias().empty())
73  // bnc #473834. Maybe we can match the alias against a regex to define
74  // and check for valid aliases
75  if (info.alias()[0] == '.')
77  info, _("Service alias cannot start with dot."))));
78 
79  return expected<void>::success();
80  }
81 
83  template <class Iterator>
84  inline bool foundAliasIn( const std::string & alias_r, Iterator begin_r, Iterator end_r )
85  {
86  for_( it, begin_r, end_r )
87  if ( it->alias() == alias_r )
88  return true;
89  return false;
90  }
92  template <class Container>
93  inline bool foundAliasIn( const std::string & alias_r, const Container & cont_r )
94  { return foundAliasIn( alias_r, cont_r.begin(), cont_r.end() ); }
95 
97  template <class Iterator>
98  inline Iterator findAlias( const std::string & alias_r, Iterator begin_r, Iterator end_r )
99  {
100  for_( it, begin_r, end_r )
101  if ( it->alias() == alias_r )
102  return it;
103  return end_r;
104  }
106  template <class Container>
107  inline typename Container::iterator findAlias( const std::string & alias_r, Container & cont_r )
108  { return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
110  template <class Container>
111  inline typename Container::const_iterator findAlias( const std::string & alias_r, const Container & cont_r )
112  { return findAlias( alias_r, cont_r.begin(), cont_r.end() ); }
113 
114 
116  std::string filenameFromAlias( const std::string & alias_r, const std::string & stem_r );
117 
134  {
136  {}
137 
138  RepoCollector(std::string targetDistro_)
139  : targetDistro(std::move(targetDistro_))
140  {}
141 
142  bool collect( const RepoInfo &repo );
143 
145  std::string targetDistro;
146  };
148 
155 
157 
158  expected<void> assert_urls( const RepoInfo & info );
159 
160  inline expected<void> assert_url( const ServiceInfo & info )
161  {
162  if ( ! info.url().isValid() )
164  return expected<void>::success();
165  }
166 
172  {
173  using namespace zyppng::operators;
174  return assert_alias(info) | and_then( [&](){ return make_expected_success( isTmpRepo( info ) ? info.metadataPath() : opt.repoRawCachePath / info.escaped_alias()); });
175  }
176 
186  {
187  using namespace zyppng::operators;
188  return rawcache_path_for_repoinfo( opt, info ) | and_then( [&]( zypp::Pathname p ) { return make_expected_success( p / info.path() ); } );
189  }
190 
195  {
196  using namespace zyppng::operators;
197  return assert_alias(info) |
198  and_then([&](){ return make_expected_success(isTmpRepo( info ) ? info.packagesPath() : opt.repoPackagesCachePath / info.escaped_alias()); });
199  }
200 
205  {
206  using namespace zyppng::operators;
207  return assert_alias(info) |
208  and_then([&](){ return make_expected_success(isTmpRepo( info ) ? info.metadataPath().dirname() / "%SLV%" : opt.repoSolvCachePath / info.escaped_alias()); });
209  }
210 
212 
215  {
216  public:
217  using ServiceSet = std::set<ServiceInfo>;
218 
219  ServiceCollector( ServiceSet & services_r )
220  : _services( services_r )
221  {}
222 
223  bool operator()( const ServiceInfo & service_r ) const
224  {
225  _services.insert( service_r );
226  return true;
227  }
228 
229  private:
231  };
233 
235  bool autoPruneInDir( const zypp::Pathname & path_r );
236 
245  template <typename ZyppContextRefType>
246  class RepoManager : public Base, private MaybeAsyncMixin<std::is_same_v<ZyppContextRefType, ContextRef>>
247  {
249  ZYPP_ENABLE_MAYBE_ASYNC_MIXIN( (std::is_same_v<ZyppContextRefType, ContextRef>) );
250 
251  public:
252 
253  using ContextRefType = ZyppContextRefType;
254  using ContextType = typename ZyppContextRefType::element_type;
255 
258 
259 
261 
265 
266 
267  ZYPP_DECL_PRIVATE_CONSTR_ARGS (RepoManager, ZyppContextRefType zyppCtx, RepoManagerOptions opt );
268 
269  template < typename ...Args >
271  using namespace zyppng::operators;
272  auto mgr = std::make_shared< RepoManager<ZyppContextRefType> >( private_constr_t{}, std::forward<Args>(args)... );
273  return mgr->initialize() | and_then( [mgr](){ return make_expected_success(mgr); } );
274  }
275 
276  public:
277 
282  {
283  public:
284  MatchServiceAlias( std::string alias_ ) : alias(std::move(alias_)) {}
285  bool operator()( const RepoInfo & info ) const
286  { return info.service() == alias; }
287  private:
288  std::string alias;
289  };
290 
292  using ServiceSet = std::set<ServiceInfo>;
293  using ServiceConstIterator = ServiceSet::const_iterator;
295 
297  using RepoSet = std::set<RepoInfo>;
298  using RepoConstIterator = RepoSet::const_iterator;
300 
301 
302  virtual ~RepoManager();
303 
304  public:
305 
307 
309  return _zyppContext;
310  }
311 
312  const RepoManagerOptions &options() const;
313 
314  bool repoEmpty() const { return repos().empty(); }
315  RepoSizeType repoSize() const { return repos().size(); }
316  RepoConstIterator repoBegin() const { return repos().begin(); }
317  RepoConstIterator repoEnd() const { return repos().end(); }
318 
319  bool hasRepo( const std::string & alias ) const
320  { return foundAliasIn( alias, repos() ); }
321 
322  RepoInfo getRepo( const std::string & alias ) const
323  {
324  RepoConstIterator it( findAlias( alias, repos() ) );
325  return it == repos().end() ? RepoInfo::noRepo : *it;
326  }
327 
328  public:
330  { return rawcache_path_for_repoinfo( _options, info ); }
331 
333  { return packagescache_path_for_repoinfo( _options, info ); }
334 
336  expected<RepoStatus> metadataStatus( const RepoInfo & info ) const;
337 
338  expected<void> cleanMetadata( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
339 
340  expected<void> cleanPackages( const RepoInfo & info, ProgressObserverRef myProgress = nullptr , bool isAutoClean = false );
341 
342  static zypp::repo::RepoType probeCache( const zypp::Pathname & path_r );
343 
344  expected<void> cleanCacheDirGarbage( ProgressObserverRef myProgress = nullptr );
345 
346  expected<void> cleanCache( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
347 
348  expected<bool> isCached( const RepoInfo & info ) const
349  {
350  using namespace zyppng::operators;
351  return solv_path_for_repoinfo( _options, info )
352  | and_then( [&]( zypp::Pathname solvPath) { return make_expected_success( zypp::PathInfo(solvPath / "solv").isExist()); } );
353  }
354 
356  { return cacheStatus( info, _options ); }
357 
359  {
360  using namespace zyppng::operators;
361  return solv_path_for_repoinfo( options, info )
362  | and_then( [&]( zypp::Pathname solvPath) {
363  return make_expected_success ( RepoStatus::fromCookieFile(solvPath / "cookie") );
364  });
365  }
366 
367  expected<void> loadFromCache( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
368 
370 
371  expected<void> removeRepository( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
372 
373  expected<RepoInfo> modifyRepository( const std::string & alias, const RepoInfo & newinfo_r, ProgressObserverRef myProgress = nullptr );
374 
375  expected<RepoInfo> getRepositoryInfo( const std::string & alias );
377 
379 
397  expected<void> refreshMetadata( const RepoInfo & info, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress = nullptr );
398 
399  std::vector<std::pair<RepoInfo, expected<void> > > refreshMetadata(std::vector<RepoInfo> infos, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress = nullptr );
400 
401  expected<zypp::repo::RepoType> probe( const zypp::Url & url, const zypp::Pathname & path = zypp::Pathname() ) const;
402 
403  expected<void> buildCache( const RepoInfo & info, CacheBuildPolicy policy, ProgressObserverRef myProgress = nullptr );
404 
408  expected<RepoInfo> addRepository( const RepoInfo & info, ProgressObserverRef myProgress = nullptr );
409 
410  expected<void> addRepositories( const zypp::Url & url, ProgressObserverRef myProgress = nullptr );
411 
412  public:
413  bool serviceEmpty() const { return _services.empty(); }
414  ServiceSizeType serviceSize() const { return _services.size(); }
415  ServiceConstIterator serviceBegin() const { return _services.begin(); }
416  ServiceConstIterator serviceEnd() const { return _services.end(); }
417 
418  bool hasService( const std::string & alias ) const
419  { return foundAliasIn( alias, _services ); }
420 
421  ServiceInfo getService( const std::string & alias ) const
422  {
423  ServiceConstIterator it( findAlias( alias, _services ) );
424  return it == _services.end() ? ServiceInfo::noService : *it;
425  }
426 
427  public:
428 
430 
431  expected<void> addService( const ServiceInfo & service );
432  expected<void> addService( const std::string & alias, const zypp::Url & url )
433  { return addService( ServiceInfo( alias, url ) ); }
434 
435  expected<void> removeService( const std::string & alias );
437  { return removeService( service.alias() ); }
438 
439  expected<void> refreshService( const std::string & alias, const RefreshServiceOptions & options_r );
440  expected<void> refreshService( const ServiceInfo & service, const RefreshServiceOptions & options_r )
441  { return refreshService( service.alias(), options_r ); }
442 
444 
445  expected<void> modifyService( const std::string & oldAlias, const ServiceInfo & newService );
446 
447  static expected<void> touchIndexFile( const RepoInfo & info, const RepoManagerOptions &options );
448 
449  expected<void> setCacheStatus( const RepoInfo & info, const RepoStatus & status )
450  {
451  using namespace zyppng::operators;
452  return solv_path_for_repoinfo( _options, info )
453  | and_then( [&]( zypp::Pathname base ){
454  try {
456  status.saveToCookieFile( base / "cookie" );
457  } catch ( const zypp::Exception &e ) {
458  return expected<void>::error( std::make_exception_ptr(e) );
459  }
460  return expected<void>::success();
461  });
462  }
463 
469 
470  template<typename OutputIterator>
471  void getRepositoriesInService( const std::string & alias, OutputIterator out ) const
472  {
473  MatchServiceAlias filter( alias );
474  std::copy( boost::make_filter_iterator( filter, repos().begin(), repos().end() ),
475  boost::make_filter_iterator( filter, repos().end(), repos().end() ),
476  out);
477  }
478 
479  zypp::Pathname generateNonExistingName( const zypp::Pathname & dir, const std::string & basefilename ) const;
480 
481  std::string generateFilename( const RepoInfo & info ) const
482  { return filenameFromAlias( info.alias(), "repo" ); }
483 
484  std::string generateFilename( const ServiceInfo & info ) const
485  { return filenameFromAlias( info.alias(), "service" ); }
486 
487 
488  protected:
489  expected<void> saveService( ServiceInfo & service ) const;
490  expected<void> touchIndexFile( const RepoInfo & info );
491 
492  protected:
495 
496  public:
497  const RepoSet & repos() const { return _reposX; }
498  RepoSet & reposManip() { if ( ! _reposDirty ) _reposDirty = true; return _reposX; }
499 
500  protected:
507  };
508 }
509 
510 #endif //ZYPP_NG_REPOMANAGER_INCLUDED
static expected< std::shared_ptr< RepoManager< ZyppContextRefType > > > create(Args &&...args)
Definition: repomanager.h:270
bool repoEmpty() const
Definition: repomanager.h:314
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:253
std::set< RepoInfo > RepoSet
RepoInfo typedefs.
Definition: repomanager.h:297
Service data.
Definition: ServiceInfo.h:36
Pathname path() const
Repository path.
Definition: RepoInfo.cc:635
Thrown when the repo alias is found to be invalid.
zypp::RepoStatus RepoStatus
Definition: repomanager.h:37
std::string targetDistro
Definition: repomanager.h:145
RepoInfo getRepo(const std::string &alias) const
Definition: repomanager.h:322
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:285
#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:638
RepoCollector(std::string targetDistro_)
Definition: repomanager.h:138
bool hasRepo(const std::string &alias) const
Definition: repomanager.h:319
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:432
ServiceConstIterator serviceBegin() const
Definition: repomanager.h:415
bool hasService(const std::string &alias) const
Definition: repomanager.h:418
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
RepoSizeType repoSize() const
Definition: repomanager.h:315
expected< zypp::Pathname > metadataPath(const RepoInfo &info) const
Definition: repomanager.h:329
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:436
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
expected< RepoInfo > addProbedRepository(RepoInfo info, zypp::repo::RepoType probedType)
Definition: repomanager.cc:572
zypp::RepoManagerFlags::CacheBuildPolicy CacheBuildPolicy
Definition: repomanager.h:257
bool isTmpRepo(const RepoInfo &info_r)
Whether repo is not under RM control and provides its own methadata paths.
Definition: repomanager.h:54
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:506
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:428
Url::asString() view options.
Definition: UrlBase.h:39
expected< void > assert_url(const ServiceInfo &info)
Definition: repomanager.h:160
bool serviceEmpty() const
Definition: repomanager.h:413
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:194
RepoSet::size_type RepoSizeType
Definition: repomanager.h:299
ContextRefType _zyppContext
Definition: repomanager.h:501
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:317
void getRepositoriesInService(const std::string &alias, OutputIterator out) const
Definition: repomanager.h:471
Simple callback to collect the results.
Definition: repomanager.h:133
std::string generateFilename(const ServiceInfo &info) const
Definition: repomanager.h:484
expected< void > addRepositories(const zypp::Url &url, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:990
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:84
const RepoSet & repos() const
Definition: repomanager.h:497
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:185
ZYPP_FWD_DECL_TYPE_WITH_REFS(Context)
bool collect(const RepoInfo &repo)
Definition: repomanager.cc:148
ServiceSet _services
Definition: repomanager.h:504
Functor thats filter RepoInfo by service which it belongs to.
Definition: repomanager.h:281
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:217
ServiceSizeType serviceSize() const
Definition: repomanager.h:414
RepoManagerRef< SyncContextRef > SyncRepoManagerRef
Definition: repomanager.h:48
expected< void > assert_alias(const RepoInfo &info)
Definition: repomanager.h:57
Pathname dirname() const
Return all but the last component od this path.
Definition: Pathname.h:126
ZYPP_FWD_DECL_TEMPL_TYPE_WITH_REFS_ARG1(RepoManager, ZyppContextRefType)
RepoConstIterator repoBegin() const
Definition: repomanager.h:316
ServiceInfo getService(const std::string &alias) const
Definition: repomanager.h:421
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:144
expected< RepoInfo > addRepository(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:984
expected< RefreshCheckStatus > checkIfToRefreshMetadata(const RepoInfo &info, const zypp::Url &url, RawMetadataRefreshPolicy policy)
Definition: repomanager.cc:828
bool isValid() const
Verifies the Url.
Definition: Url.cc:493
std::list< Url > url_set
Definition: RepoInfo.h:108
RepoSet::const_iterator RepoConstIterator
Definition: repomanager.h:298
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition: RepoInfo.cc:593
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:599
zypp::RepoManagerFlags::RefreshServiceOptions RefreshServiceOptions
Definition: repomanager.h:264
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:971
std::ostream & copy(std::istream &from_r, std::ostream &to_r)
Copy istream to ostream.
Definition: IOStream.h:51
static expected< RepoStatus > cacheStatus(const RepoInfo &info, const RepoManagerOptions &options)
Definition: repomanager.h:358
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:254
zypp_private::repo::PluginRepoverification _pluginRepoverification
Definition: repomanager.h:505
expected< RepoStatus > cacheStatus(const RepoInfo &info) const
Definition: repomanager.h:355
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:416
Base class for Exception.
Definition: Exception.h:146
ServiceSet::size_type ServiceSizeType
Definition: repomanager.h:294
std::set< ServiceInfo > ServiceSet
ServiceInfo typedefs.
Definition: repomanager.h:292
expected< void > refreshGeoIp(const RepoInfo::url_set &urls)
ServiceCollector(ServiceSet &services_r)
Definition: repomanager.h:219
expected< void > addService(const ServiceInfo &service)
expected< void > setCacheStatus(const RepoInfo &info, const RepoStatus &status)
Definition: repomanager.h:449
zypp::RepoManagerFlags::RawMetadataRefreshPolicy RawMetadataRefreshPolicy
Definition: repomanager.h:256
Iterator findAlias(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Find alias_r in repo/service container.
Definition: repomanager.h:98
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:502
expected< zypp::repo::ServiceType > probeService(const zypp::Url &url) const
Definition: repomanager.cc:997
Pathname packagesPath() const
Path where this repo packages are cached.
Definition: RepoInfo.cc:596
expected< bool > isCached(const RepoInfo &info) const
Definition: repomanager.h:348
Wrapper class for ::stat/::lstat.
Definition: PathInfo.h:221
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:51
std::string generateFilename(const RepoInfo &info) const
Definition: repomanager.h:481
bool operator()(const ServiceInfo &service_r) const
Definition: repomanager.h:223
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:498
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:171
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:246
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:332
ContextRefType zyppContext() const
Definition: repomanager.h:308
ServiceSet::const_iterator ServiceConstIterator
Definition: repomanager.h:293
RefreshServiceBit
Flags for tuning RefreshService.
expected< void > refreshService(const ServiceInfo &service, const RefreshServiceOptions &options_r)
Definition: repomanager.h:440
SolvableIdType size_type
Definition: PoolMember.h:126
Service has no or invalid url defined.
zypp::RepoManagerOptions RepoManagerOptions
Definition: repomanager.h:40
Functor collecting ServiceInfos into a ServiceSet.
Definition: repomanager.h:214
Url manipulation class.
Definition: Url.h:91
expected< zypp::Pathname > solv_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the solv cache path for a repository.
Definition: repomanager.h:204
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