libzypp  17.38.7
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>
20 #include <zypp/RepoStatus.h>
21 
24 
25 #include <zypp/ng/context.h>
26 
27 #include <zypp-core/base/Gettext.h>
28 #include <zypp-core/base/DefaultIntegral>
30 #include <zypp-core/fs/PathInfo.h>
32 #include <zypp-core/ng/base/Base>
35 
36 namespace zyppng {
37 
44  ZYPP_FWD_DECL_TYPE_WITH_REFS( SyncContext );
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() )
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] == '.')
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())
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] == '.')
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  }
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  }
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() ); }
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 
129  {
131  {}
132 
133  RepoCollector(std::string targetDistro_)
134  : targetDistro(std::move(targetDistro_))
135  {}
136 
137  bool collect( const RepoInfo &repo );
138 
140  std::string targetDistro;
141  };
143 
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() )
159  return expected<void>::success();
160  }
161 
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 
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 
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 
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 
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:
226  };
228 
230  bool autoPruneInDir( const zypp::Pathname & path_r );
231 
240  class RepoManager : public Base
241  {
243  public:
244 
245  using ContextRefType = ContextRef;
247 
250 
251 
253 
257 
258 
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 
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;
287 
289  using RepoSet = std::set<RepoInfo>;
290  using RepoConstIterator = RepoSet::const_iterator;
292 
293 
294  virtual ~RepoManager();
295 
296  public:
297 
299 
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:
322  { return rawcache_path_for_repoinfo( _options, info ); }
323 
325  { return packagescache_path_for_repoinfo( _options, info ); }
326 
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 
348  { return cacheStatus( info, _options ); }
349 
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 
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 );
369 
371 
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 
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 
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 );
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 
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 {
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 
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:
491 
492  public:
493  const RepoSet & repos() const { return _reposX; }
494  RepoSet & reposManip() { if ( ! _reposDirty ) _reposDirty = true; return _reposX; }
495 
496  public:
498  { return _pluginRepoverification; }
499 
500  protected:
507  };
508 }
509 
510 #endif //ZYPP_NG_REPOMANAGER_INCLUDED
expected< void > modifyService(const std::string &oldAlias, const ServiceInfo &newService)
Pathname filepath() const
File where this repo was read from.
Service data.
Definition: ServiceInfo.h:36
Pathname path() const
Repository path.
Definition: RepoInfo.cc:824
Thrown when the repo alias is found to be invalid.
zypp::RepoStatus RepoStatus
Definition: repomanager.h:39
expected< void > addService(const ServiceInfo &service)
std::string targetDistro
Definition: repomanager.h:140
RepoSizeType repoSize() const
Definition: repomanager.h:307
int assert_dir(const Pathname &path, unsigned mode)
Like &#39;mkdir -p&#39;.
Definition: PathInfo.cc:338
ContextRefType _zyppContext
Definition: repomanager.h:501
RepoManagerOptions _options
Definition: repomanager.h:502
ServiceSet::size_type ServiceSizeType
Definition: repomanager.h:286
Repository metadata verification beyond GPG.
zypp::RepoInfo RepoInfo
Definition: repomanager.h:38
const RepoManagerOptions & options() const
Definition: repomanager.cc:301
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:827
expected< void > removeService(const std::string &alias)
RepoCollector(std::string targetDistro_)
Definition: repomanager.h:133
expected< void > removeRepository(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:610
void getRepositoriesInService(const std::string &alias, OutputIterator out) const
Definition: repomanager.h:467
std::set< ServiceInfo > ServiceSet
ServiceInfo typedefs.
Definition: repomanager.h:284
RefreshServiceFlags RefreshServiceOptions
Options tuning RefreshService.
zypp::RepoManagerFlags::RawMetadataRefreshPolicy RawMetadataRefreshPolicy
Definition: repomanager.h:248
expected< RefreshCheckStatus > checkIfToRefreshMetadata(const RepoInfo &info, const zypp::MirroredOrigin &origin, RawMetadataRefreshPolicy policy)
Definition: repomanager.cc:826
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 > cleanCacheDirGarbage(ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:441
bool operator()(const RepoInfo &info) const
Definition: repomanager.h:277
const RepoSet & repos() const
Definition: repomanager.h:493
expected< void > refreshGeoIp(const RepoInfo::url_set &urls)
std::list< RepoInfo > RepoInfoList
relates: RepoInfo
Definition: RepoInfo.h:636
expected< void > refreshService(const std::string &alias, const RefreshServiceOptions &options_r)
RepoConstIterator repoEnd() const
Definition: repomanager.h:309
bool isTmpRepo(const RepoInfo &info_r)
Whether repo is not under RM control and provides its own methadata paths.
Definition: repomanager.h:49
Definition: ansi.h:854
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:470
expected< RepoInfo > addProbedRepository(RepoInfo info, zypp::repo::RepoType probedType)
Definition: repomanager.cc:570
std::string escaped_alias() const
Same as alias(), just escaped in a way to be a valid file name.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
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
virtual ~RepoManager()
Definition: repomanager.cc:247
Url::asString() view options.
Definition: UrlBase.h:40
expected< void > assert_url(const ServiceInfo &info)
Definition: repomanager.h:155
bool serviceEmpty() const
Definition: repomanager.h:409
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
zypp::RepoInfoList RepoInfoList
Definition: repomanager.h:40
Repo manager settings.
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition: String.h:31
expected< bool > isCached(const RepoInfo &info) const
Definition: repomanager.h:340
Simple callback to collect the results.
Definition: repomanager.h:128
void saveToCookieFile(const Pathname &path_r) const
Save the status information to a cookie file.
Definition: RepoStatus.cc:224
RepoSet::size_type RepoSizeType
Definition: repomanager.h:291
bool empty() const
Test for an empty path.
Definition: Pathname.h:117
zypp::RepoManagerFlags::CacheBuildPolicy CacheBuildPolicy
Definition: repomanager.h:249
bool hasService(const std::string &alias) const
Definition: repomanager.h:414
bool repoEmpty() const
Definition: repomanager.h:306
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
RepoInfo getRepo(const std::string &alias) const
Definition: repomanager.h:314
std::set< RepoInfo > RepoSet
RepoInfo typedefs.
Definition: repomanager.h:289
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
RepoConstIterator repoBegin() const
Definition: repomanager.h:308
bool collect(const RepoInfo &repo)
Definition: repomanager.cc:148
PluginRepoverification pluginRepoverification() const
Definition: repomanager.h:497
Functor thats filter RepoInfo by service which it belongs to.
Definition: repomanager.h:273
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
zypp::Pathname generateNonExistingName(const zypp::Pathname &dir, const std::string &basefilename) const
Generate a non existing filename in a directory, using a base name.
ContextRefType zyppContext() const
Definition: repomanager.h:300
std::string alias() const
unique identifier for this source.
std::set< ServiceInfo > ServiceSet
Definition: repomanager.h:212
expected< void > cleanCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:498
expected< void > assert_alias(const RepoInfo &info)
Definition: repomanager.h:52
expected< void > removeService(const ServiceInfo &service)
Definition: repomanager.h:432
Pathname dirname() const
Return all but the last component od this path.
Definition: Pathname.h:133
expected< void > refreshService(const ServiceInfo &service, const RefreshServiceOptions &options_r)
Definition: repomanager.h:436
ZYPP_DECL_PRIVATE_CONSTR_ARGS(RepoManager, ContextRef zyppCtx, RepoManagerOptions opt)
expected< RepoInfo > getRepositoryInfo(const std::string &alias)
Definition: repomanager.cc:788
zypp::DefaultIntegral< bool, false > _reposDirty
Definition: repomanager.h:506
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
std::string generateFilename(const ServiceInfo &info) const
Definition: repomanager.h:480
RepoInfoList repos
Definition: repomanager.h:139
PluginRepoverification _pluginRepoverification
Definition: repomanager.h:505
#define _(MSG)
Definition: Gettext.h:39
bool isValid() const
Verifies the Url.
Definition: Url.cc:516
expected< RepoInfo > addRepository(const RepoInfo &info, const ProgressObserverRef myProgress=nullptr, const zypp::TriBool &forcedProbe=zypp::indeterminate)
Definition: repomanager.cc:992
ServiceConstIterator serviceEnd() const
Definition: repomanager.h:412
std::list< Url > url_set
Definition: RepoInfo.h:108
expected< zypp::Pathname > metadataPath(const RepoInfo &info) const
Definition: repomanager.h:321
expected< void > setCacheStatus(const RepoInfo &info, const RepoStatus &status)
Definition: repomanager.h:445
expected< void > init_knownServices()
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition: RepoInfo.cc:779
RepoSet::const_iterator RepoConstIterator
Definition: repomanager.h:290
SolvableIdType size_type
Definition: poolconstants.h:59
std::string generateFilename(const RepoInfo &info) const
Definition: repomanager.h:477
expected< void > loadFromCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:518
static expected success(ConsParams &&...params)
Definition: expected.h:178
Url url() const
The service url.
Definition: ServiceInfo.cc:102
zypp::ServiceInfo ServiceInfo
Definition: repomanager.h:41
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
Definition: RepoInfo.cc:788
expected< void > buildCache(const RepoInfo &info, CacheBuildPolicy policy, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:979
std::ostream & copy(std::istream &from_r, std::ostream &to_r)
Copy istream to ostream.
Definition: IOStream.h:51
expected< zypp::Pathname > packagesPath(const RepoInfo &info) const
Definition: repomanager.h:324
bool autoPruneInDir(const zypp::Pathname &path_r)
bsc#1204956: Tweak to prevent auto pruning package caches.
Definition: repomanager.cc:234
ServiceSizeType serviceSize() const
Definition: repomanager.h:410
expected< RepoStatus > cacheStatus(const RepoInfo &info) const
Definition: repomanager.h:347
expected< void > init_knownRepositories()
expected< void > refreshServices(const RefreshServiceOptions &options_r)
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 > addService(const std::string &alias, const zypp::Url &url)
Definition: repomanager.h:428
expected< void > initialize()
Definition: repomanager.cc:292
Base class for Exception.
Definition: Exception.h:152
FilterIterator< Pred, Base > make_filter_iterator(Pred p, Base it, Base end)
Helper function to deduce types and construct a FilterIterator.
Definition: iterators.h:116
zypp_private::repo::PluginRepoverification PluginRepoverification
Definition: repomanager.h:43
ServiceInfo getService(const std::string &alias) const
Definition: repomanager.h:417
static expected< void > touchIndexFile(const RepoInfo &info, const RepoManagerOptions &options)
ZYPP_FWD_DECL_TYPE_WITH_REFS(EventDispatcher)
ServiceCollector(ServiceSet &services_r)
Definition: repomanager.h:214
expected< RefreshCheckStatus > checkIfToRefreshMetadata(const RepoInfo &info, const zypp::Url &url, RawMetadataRefreshPolicy policy)
Definition: repomanager.h:372
Iterator findAlias(const std::string &alias_r, Iterator begin_r, Iterator end_r)
Find alias_r in repo/service container.
Definition: repomanager.h:93
auto and_then(Fun &&function)
Definition: expected.h:708
ServiceSet _services
Definition: repomanager.h:504
ServiceSet::const_iterator ServiceConstIterator
Definition: repomanager.h:285
static expected< std::shared_ptr< RepoManager > > create(Args &&...args)
Definition: repomanager.h:262
Pathname packagesPath() const
packagesPath Checks if the effective user is allowed to write into the system package cache...
Definition: RepoInfo.cc:785
Wrapper class for ::stat/::lstat.
Definition: PathInfo.h:225
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition: RepoInfo.h:85
Thrown when the repo alias is found to be invalid.
expected< void > cleanMetadata(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:377
static expected< RepoStatus > cacheStatus(const RepoInfo &info, const RepoManagerOptions &options)
Definition: repomanager.h:350
bool operator()(const ServiceInfo &service_r) const
Definition: repomanager.h:218
RefreshCheckStatus
Possibly return state of RepoManager::checkIfToRefreshMetadata function.
ResultType and_then(const expected< T, E > &exp, Function &&f)
Definition: expected.h:520
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
Track changing files or directories.
Definition: RepoStatus.h:40
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::repo::ServiceType > probeService(const zypp::Url &url) const
static zypp::repo::RepoType probeCache(const zypp::Pathname &path_r)
Probe Metadata in a local cache directory.
Definition: repomanager.cc:423
RepoSet & reposManip()
Definition: repomanager.h:494
zypp::RepoManagerFlags::RefreshServiceOptions RefreshServiceOptions
Definition: repomanager.h:256
RefreshServiceBit
Flags for tuning RefreshService.
bool hasRepo(const std::string &alias) const
Definition: repomanager.h:311
ServiceConstIterator serviceBegin() const
Definition: repomanager.h:411
expected< void > refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress=nullptr)
Refresh local raw cache.
Definition: repomanager.cc:842
expected< void > addRepositories(const zypp::Url &url, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:998
Service has no or invalid url defined.
zypp::RepoManagerOptions RepoManagerOptions
Definition: repomanager.h:42
expected< RepoInfo > modifyRepository(const std::string &alias, const RepoInfo &newinfo_r, ProgressObserverRef myProgress=nullptr)
Definition: repomanager.cc:699
Functor collecting ServiceInfos into a ServiceSet.
Definition: repomanager.h:209
expected< void > cleanPackages(const RepoInfo &info, ProgressObserverRef myProgress=nullptr, bool isAutoClean=false)
Definition: repomanager.cc:396
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:199
static expected< RepoStatus > metadataStatus(const RepoInfo &info, const RepoManagerOptions &options)
Definition: repomanager.cc:307
expected< void > saveService(ServiceInfo &service) const
Repository type enumeration.
Definition: RepoType.h:28
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
ContextRef ContextRefType
Definition: repomanager.h:245