libzypp 17.37.17
RepoInfo.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP2_REPOSITORYINFO_H
13#define ZYPP2_REPOSITORYINFO_H
14
15#include <list>
16#include <set>
17
19#include <zypp-core/Globals.h>
21#include <zypp-core/TriBool.h>
22#include <zypp-core/Url.h>
23
24#include <zypp/Locale.h>
25#include <zypp/repo/RepoType.h>
28
30namespace zypp
31{
32
34 //
35 // CLASS NAME : RepoInfo
36 //
72 {
73 friend std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
74
75 public:
76 RepoInfo();
77 ~RepoInfo() override;
78
79 RepoInfo(const RepoInfo &) = default;
80 RepoInfo(RepoInfo &&) = default;
81 RepoInfo &operator=(const RepoInfo &) = default;
82 RepoInfo &operator=(RepoInfo &&) = default;
83
85 static const RepoInfo noRepo;
86
87 public:
91 static unsigned defaultPriority();
95 static unsigned noPriority();
100 unsigned priority() const;
106 void setPriority( unsigned newval_r );
107
108 using url_set = std::list<Url>;
109 using urls_size_type = url_set::size_type;
114 bool baseUrlsEmpty() const;
119 bool baseUrlSet() const;
132
137 Url url() const;
142 Url rawUrl() const;
143
149 Url location() const;
150
154 url_set baseUrls() const;
158 url_set rawBaseUrls() const;
159
167 void addBaseUrl( Url url );
171 void setBaseUrl( Url url );
175 void setBaseUrls( url_set urls );
176
188
192 bool repoOriginsEmpty() const;
193
214 Pathname path() const;
219 void setPath( const Pathname &path );
220
225 Url mirrorListUrl() const;
230 Url rawMirrorListUrl() const;
231
233 void setMirrorlistUrl( const Url &url );
235 void setMetalinkUrl( const Url &url );
236
238 Url rawCfgMirrorlistUrl() const;
240 Url rawCfgMetalinkUrl() const;
241
242#if LEGACY(1735)
247 void setMirrorListUrl( const Url &url ) ZYPP_DEPRECATED;
249 void setMetalinkUrls( url_set urls ) ZYPP_DEPRECATED;
251 void setMirrorListUrls( url_set urls ) ZYPP_DEPRECATED;
252#endif
253
258 repo::RepoType type() const;
265 void setProbedType( const repo::RepoType &t ) const;
270 void setType( const repo::RepoType &t );
271
278 Pathname metadataPath() const;
305 void setMetadataPath( const Pathname &path );
306
308 bool usesAutoMetadataPaths() const;
309
313 Pathname packagesPath() const;
319 void setPackagesPath( const Pathname &path );
320
325
326
383
384 bool gpgCheck() const;
386 void setGpgCheck( TriBool value_r );
388 void setGpgCheck( bool value_r );
389
391 bool repoGpgCheck() const;
393 bool repoGpgCheckIsMandatory() const;
395 void setRepoGpgCheck( TriBool value_r );
396
398 bool pkgGpgCheck() const;
400 bool pkgGpgCheckIsMandatory() const;
402 void setPkgGpgCheck( TriBool value_r );
403
409 void setValidRepoSignature( TriBool value_r );
410
412 enum class GpgCheck {
413 indeterminate, //< not specified
414 On, //< 1** --gpgcheck
415 Strict, //< 111 --gpgcheck-strict
416 AllowUnsigned, //< 100 --gpgcheck-allow-unsigned
417 AllowUnsignedRepo, //< 10* --gpgcheck-allow-unsigned-repo
418 AllowUnsignedPackage, //< 1*0 --gpgcheck-allow-unsigned-package
419 Default, //< *** --default-gpgcheck
420 Off, //< 0** --no-gpgcheck
421 };
422
427 bool setGpgCheck( GpgCheck mode_r );
429
430
432 bool gpgKeyUrlsEmpty() const;
434 urls_size_type gpgKeyUrlsSize() const;
435
437 url_set gpgKeyUrls() const;
439 url_set rawGpgKeyUrls() const;
441 void setGpgKeyUrls( url_set urls );
442
444 Url gpgKeyUrl() const;
446 Url rawGpgKeyUrl() const;
448 void setGpgKeyUrl( const Url &gpgkey );
449
453 bool keepPackages() const;
463 void setKeepPackages( bool keep );
464
469 bool effectiveKeepPackages() const;
470
475 std::string service() const;
479 void setService( const std::string& name );
480
484 std::string targetDistribution() const;
490 void setTargetDistribution(const std::string & targetDistribution);
491
492
494 const std::set<std::string> & contentKeywords() const;
495
497 void addContent( const std::string & keyword_r );
499 template <class TIterator>
500 void addContentFrom( TIterator begin_r, TIterator end_r )
501 { for_( it, begin_r, end_r ) addContent( *it ); }
502
503 template <class TContainer>
504 void addContentFrom( const TContainer & container_r )
505 { addContentFrom( container_r.begin(), container_r.end() ); }
506
510 bool hasContent() const;
512 bool hasContent( const std::string & keyword_r ) const;
514 template <class TIterator>
515 bool hasContentAll( TIterator begin_r, TIterator end_r ) const
516 { for_( it, begin_r, end_r ) if ( ! hasContent( *it ) ) return false; return true; }
517
518 template <class TContainer>
519 bool hasContentAll( const TContainer & container_r ) const
520 { return hasContentAll( container_r.begin(), container_r.end() ); }
521
522 template <class TIterator>
523 bool hasContentAny( TIterator begin_r, TIterator end_r ) const
524 { for_( it, begin_r, end_r ) if ( hasContent( *it ) ) return true; return false; }
525
526 template <class TContainer>
527 bool hasContentAny( const TContainer & container_r ) const
528 { return hasContentAny( container_r.begin(), container_r.end() ); }
529
530 public:
543
544 bool hasLicense() const;
546 bool hasLicense( const std::string & name_r ) const;
547
551 bool needToAcceptLicense() const;
553 bool needToAcceptLicense( const std::string & name_r ) const;
554
556 std::string getLicense( const Locale & lang_r = Locale() ) const;
558 std::string getLicense( const Locale & lang_r = Locale() ); // LEGACY API
560 std::string getLicense( const std::string & name_r, const Locale & lang_r = Locale() ) const;
561
566 LocaleSet getLicenseLocales() const;
568 LocaleSet getLicenseLocales( const std::string & name_r ) const;
570
575 bool requireStatusWithMediaFile () const;
576
577 public:
582 std::ostream & dumpOn( std::ostream & str ) const override;
583
588 std::ostream & dumpAsIniOn( std::ostream & str ) const override;
589
598 std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const override;
599
603 void getRawGpgChecks( TriBool & g_r, TriBool & r_r, TriBool & p_r ) const;
604
610 std::string repoStatusString() const;
611
612 struct Impl;
613 private:
614 friend class RepoManager;
615
618 };
619
620
626 using RepoInfoList = std::list<RepoInfo>;
627
629 std::ostream & operator<<( std::ostream & str, const RepoInfo & obj ) ZYPP_API;
630
632 std::ostream & operator<<( std::ostream & str, const RepoInfo::GpgCheck & obj ) ZYPP_API;
633
635} // namespace zypp
637#endif // ZYPP2_REPOSITORYINFO_H
An iterator over elements which are the result of applying some functional transformation to the elem...
'Language[_Country]' codes.
Definition Locale.h:51
A smart container that manages a collection of MirroredOrigin objects, automatically grouping endpoin...
void setPkgGpgCheck(TriBool value_r)
Set the value for pkgGpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:561
void setMetalinkUrl(const Url &url)
Set the raw metalink url.
Definition RepoInfo.cc:644
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition RepoInfo.cc:741
bool hasContentAny(const TContainer &container_r) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition RepoInfo.h:527
RepoInfo(RepoInfo &&)=default
void setMirrorlistUrl(const Url &url)
Set the raw mirrorlist url.
Definition RepoInfo.cc:641
url_set::size_type urls_size_type
Definition RepoInfo.h:109
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
Definition RepoInfo.cc:747
shared_ptr< RepoInfo > RepoInfo_Ptr
Definition RepoInfo.h:622
void addContentFrom(TIterator begin_r, TIterator end_r)
Definition RepoInfo.h:500
GpgCheck
Some predefined settings.
Definition RepoInfo.h:412
bool baseUrlsEmpty() const
whether repository urls are available
Definition RepoInfo.cc:807
Pathname predownloadPath() const
Path where this repo packages are predownloaded.
Definition RepoInfo.cc:723
bool hasContent() const
Check for content keywords.
Definition RepoInfo.cc:824
MirroredOriginSet repoOrigins() const
The repodata origins.
Definition RepoInfo.cc:697
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Definition RepoInfo.h:110
Url rawUrl() const
Pars pro toto: The first repository raw url (no variables replaced) this is either rawBaseUrls()....
Definition RepoInfo.cc:792
repo::RepoType type() const
Type of repository,.
Definition RepoInfo.cc:750
std::list< RepoInfo > RepoInfoList
Definition RepoInfo.h:626
RepoInfo & operator=(const RepoInfo &)=default
static unsigned noPriority()
The least priority (unsigned(-1)).
Definition RepoInfo.cc:523
urls_size_type baseUrlsSize() const
number of repository urls
Definition RepoInfo.cc:804
Url url() const
Pars pro toto: The first repository url, this is either baseUrls().front() or if no baseUrl is define...
Definition RepoInfo.cc:813
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition RepoInfo.h:85
void setBaseUrl(Url url)
Clears current base URL list and adds url.
Definition RepoInfo.cc:684
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Definition RepoInfo.cc:801
Url location() const
Returns the location URL for the repository, this is either the first configured baseUrl or a configu...
Definition RepoInfo.cc:795
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
Definition RepoInfo.cc:720
Url rawCfgMetalinkUrl() const
The configured raw metalink url.
Definition RepoInfo.cc:650
bool baseUrlSet() const
Whether there are manualy configured repository urls.
Definition RepoInfo.cc:810
void setGpgCheck(TriBool value_r)
Set the value for gpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:533
Pathname path() const
Repository path.
Definition RepoInfo.cc:783
url_set baseUrls() const
The complete set of repository urls as configured.
Definition RepoInfo.cc:777
void addBaseUrl(Url url)
Add a base url.
Definition RepoInfo.cc:674
bool pkgGpgCheckIsMandatory() const
Mandatory check (pkgGpgCheck is not off) must ask to confirm using unsigned packages.
Definition RepoInfo.cc:558
url_set rawBaseUrls() const
The complete set of raw repository urls (no variables replaced)
Definition RepoInfo.cc:780
bool hasContentAny(TIterator begin_r, TIterator end_r) const
Definition RepoInfo.h:523
Url mirrorListUrl() const
Url of a file which contains a list of repository urls.
Definition RepoInfo.cc:753
void setProbedType(const repo::RepoType &t) const
This allows to adjust the RepoType lazy, from NONE to some probed value, even for const objects.
Definition RepoInfo.cc:713
void setBaseUrls(url_set urls)
Clears current base URL list and adds an url_set.
Definition RepoInfo.cc:691
unsigned priority() const
Repository priority for solver.
Definition RepoInfo.cc:517
bool gpgCheck() const
Whether default signature checking should be performed.
Definition RepoInfo.cc:530
void setPath(const Pathname &path)
set the product path.
Definition RepoInfo.cc:707
void setValidRepoSignature(TriBool value_r)
Set the value for validRepoSignature (or indeterminate if unsigned).
Definition RepoInfo.cc:580
static unsigned defaultPriority()
The default priority (99).
Definition RepoInfo.cc:520
void setPriority(unsigned newval_r)
Set repository priority for solver.
Definition RepoInfo.cc:526
RepoInfo(const RepoInfo &)=default
void addContentFrom(const TContainer &container_r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition RepoInfo.h:504
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition RepoInfo.h:617
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition RepoInfo.cc:798
bool hasContentAll(const TContainer &container_r) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition RepoInfo.h:519
bool repoGpgCheckIsMandatory() const
Mandatory check (repoGpgCheck is on) must ask to confirm using unsigned repos.
Definition RepoInfo.cc:543
friend class RepoManager
Definition RepoInfo.h:614
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
Definition RepoInfo.cc:717
shared_ptr< const RepoInfo > RepoInfo_constPtr
Definition RepoInfo.h:624
TriBool validRepoSignature() const
Whether the repo metadata are signed and successfully validated or indeterminate if unsigned.
Definition RepoInfo.cc:573
void setRepoGpgCheck(TriBool value_r)
Set the value for repoGpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:551
Pathname packagesPath() const
Path where this repo packages are cached.
Definition RepoInfo.cc:744
bool hasContentAll(TIterator begin_r, TIterator end_r) const
Definition RepoInfo.h:515
void addContent(const std::string &keyword_r)
Add content keywords.
Definition RepoInfo.cc:821
bool repoGpgCheck() const
Whether the signature of repo metadata should be checked for this repo.
Definition RepoInfo.cc:540
void setType(const repo::RepoType &t)
set the repository type
Definition RepoInfo.cc:710
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
Definition RepoInfo.cc:555
std::list< Url > url_set
Definition RepoInfo.h:108
Url rawMirrorListUrl() const
The raw mirrorListUrl (no variables replaced).
Definition RepoInfo.cc:756
RepoInfo & operator=(RepoInfo &&)=default
Url rawCfgMirrorlistUrl() const
The configured raw mirrorlist url.
Definition RepoInfo.cc:647
bool repoOriginsEmpty() const
whether repo origins are available
Definition RepoInfo.cc:702
Url manipulation class.
Definition Url.h:93
Base class implementing common features of RepoInfo and ServiceInfo.
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition String.h:31
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
std::unordered_set< Locale > LocaleSet
Definition Locale.h:29
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
std::ostream & dumpAsXmlOn(std::ostream &str, const Repository &obj)
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
Repository type enumeration.
Definition RepoType.h:29
Provides API related macros.
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3....
Definition Globals.h:112
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27