libzypp 17.37.0
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
18#include <zypp/base/Iterator.h>
19#include <zypp-core/Globals.h>
20
21#include <zypp/Url.h>
22#include <zypp/Locale.h>
23#include <zypp/TriBool.h>
24#include <zypp/repo/RepoType.h>
26
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
180 bool effectiveBaseUrlsEmpty() const;
181
192
197 std::vector<std::vector<Url>> groupedBaseUrls() const;
198
199
200
221 Pathname path() const;
226 void setPath( const Pathname &path );
227
231 Url mirrorListUrl() const;
235 Url rawMirrorListUrl() const;
240 void setMirrorListUrl( const Url &url );
242 void setMirrorListUrls( url_set urls );
243
245 void setMetalinkUrl( const Url &url );
247 void setMetalinkUrls( url_set urls );
248
253 repo::RepoType type() const;
260 void setProbedType( const repo::RepoType &t ) const;
265 void setType( const repo::RepoType &t );
266
273 Pathname metadataPath() const;
300 void setMetadataPath( const Pathname &path );
301
303 bool usesAutoMetadataPaths() const;
304
308 Pathname packagesPath() const;
314 void setPackagesPath( const Pathname &path );
315
320
321
378
379 bool gpgCheck() const;
381 void setGpgCheck( TriBool value_r );
383 void setGpgCheck( bool value_r );
384
386 bool repoGpgCheck() const;
388 bool repoGpgCheckIsMandatory() const;
390 void setRepoGpgCheck( TriBool value_r );
391
393 bool pkgGpgCheck() const;
395 bool pkgGpgCheckIsMandatory() const;
397 void setPkgGpgCheck( TriBool value_r );
398
404 void setValidRepoSignature( TriBool value_r );
405
407 enum class GpgCheck {
408 indeterminate, //< not specified
409 On, //< 1** --gpgcheck
410 Strict, //< 111 --gpgcheck-strict
411 AllowUnsigned, //< 100 --gpgcheck-allow-unsigned
412 AllowUnsignedRepo, //< 10* --gpgcheck-allow-unsigned-repo
413 AllowUnsignedPackage, //< 1*0 --gpgcheck-allow-unsigned-package
414 Default, //< *** --default-gpgcheck
415 Off, //< 0** --no-gpgcheck
416 };
417
422 bool setGpgCheck( GpgCheck mode_r );
424
425
427 bool gpgKeyUrlsEmpty() const;
429 urls_size_type gpgKeyUrlsSize() const;
430
432 url_set gpgKeyUrls() const;
434 url_set rawGpgKeyUrls() const;
436 void setGpgKeyUrls( url_set urls );
437
439 Url gpgKeyUrl() const;
441 Url rawGpgKeyUrl() const;
443 void setGpgKeyUrl( const Url &gpgkey );
444
448 bool keepPackages() const;
458 void setKeepPackages( bool keep );
459
464 bool effectiveKeepPackages() const;
465
470 std::string service() const;
474 void setService( const std::string& name );
475
479 std::string targetDistribution() const;
485 void setTargetDistribution(const std::string & targetDistribution);
486
487
489 const std::set<std::string> & contentKeywords() const;
490
492 void addContent( const std::string & keyword_r );
494 template <class TIterator>
495 void addContentFrom( TIterator begin_r, TIterator end_r )
496 { for_( it, begin_r, end_r ) addContent( *it ); }
497
498 template <class TContainer>
499 void addContentFrom( const TContainer & container_r )
500 { addContentFrom( container_r.begin(), container_r.end() ); }
501
505 bool hasContent() const;
507 bool hasContent( const std::string & keyword_r ) const;
509 template <class TIterator>
510 bool hasContentAll( TIterator begin_r, TIterator end_r ) const
511 { for_( it, begin_r, end_r ) if ( ! hasContent( *it ) ) return false; return true; }
512
513 template <class TContainer>
514 bool hasContentAll( const TContainer & container_r ) const
515 { return hasContentAll( container_r.begin(), container_r.end() ); }
516
517 template <class TIterator>
518 bool hasContentAny( TIterator begin_r, TIterator end_r ) const
519 { for_( it, begin_r, end_r ) if ( hasContent( *it ) ) return true; return false; }
520
521 template <class TContainer>
522 bool hasContentAny( const TContainer & container_r ) const
523 { return hasContentAny( container_r.begin(), container_r.end() ); }
524
525 public:
538
539 bool hasLicense() const;
541 bool hasLicense( const std::string & name_r ) const;
542
546 bool needToAcceptLicense() const;
548 bool needToAcceptLicense( const std::string & name_r ) const;
549
551 std::string getLicense( const Locale & lang_r = Locale() ) const;
553 std::string getLicense( const Locale & lang_r = Locale() ); // LEGACY API
555 std::string getLicense( const std::string & name_r, const Locale & lang_r = Locale() ) const;
556
561 LocaleSet getLicenseLocales() const;
563 LocaleSet getLicenseLocales( const std::string & name_r ) const;
565
570 bool requireStatusWithMediaFile () const;
571
572 public:
577 std::ostream & dumpOn( std::ostream & str ) const override;
578
583 std::ostream & dumpAsIniOn( std::ostream & str ) const override;
584
593 std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const override;
594
598 void getRawGpgChecks( TriBool & g_r, TriBool & r_r, TriBool & p_r ) const;
599
605 std::string repoStatusString() const;
606
607 struct Impl;
608 private:
609 friend class RepoManager;
610
613 };
614
615
621 using RepoInfoList = std::list<RepoInfo>;
622
624 std::ostream & operator<<( std::ostream & str, const RepoInfo & obj ) ZYPP_API;
625
627 std::ostream & operator<<( std::ostream & str, const RepoInfo::GpgCheck & obj ) ZYPP_API;
628
630} // namespace zypp
632#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
void setPkgGpgCheck(TriBool value_r)
Set the value for pkgGpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:542
void setMirrorListUrls(url_set urls)
Like setMirrorListUrl but take an url_set.
Definition RepoInfo.cc:625
void setMetalinkUrl(const Url &url)
Like setMirrorListUrl but expect metalink format.
Definition RepoInfo.cc:628
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition RepoInfo.cc:713
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:522
RepoInfo(RepoInfo &&)=default
url_set::size_type urls_size_type
Definition RepoInfo.h:109
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
Definition RepoInfo.cc:719
shared_ptr< RepoInfo > RepoInfo_Ptr
Definition RepoInfo.h:617
void addContentFrom(TIterator begin_r, TIterator end_r)
Definition RepoInfo.h:495
GpgCheck
Some predefined settings.
Definition RepoInfo.h:407
bool baseUrlsEmpty() const
whether repository urls are available
Definition RepoInfo.cc:782
Pathname predownloadPath() const
Path where this repo packages are predownloaded.
Definition RepoInfo.cc:695
bool hasContent() const
Check for content keywords.
Definition RepoInfo.cc:799
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Definition RepoInfo.h:110
void setMirrorListUrl(const Url &url)
Set mirror list url.
Definition RepoInfo.cc:622
Url rawUrl() const
Pars pro toto: The first repository raw url (no variables replaced) this is either rawBaseUrls()....
Definition RepoInfo.cc:764
repo::RepoType type() const
Type of repository,.
Definition RepoInfo.cc:722
url_set effectiveBaseUrls() const
The complete set of effective repository urls.
Definition RepoInfo.cc:674
std::list< RepoInfo > RepoInfoList
Definition RepoInfo.h:621
RepoInfo & operator=(const RepoInfo &)=default
static unsigned noPriority()
The least priority (unsigned(-1)).
Definition RepoInfo.cc:504
urls_size_type baseUrlsSize() const
number of repository urls
Definition RepoInfo.cc:779
Url url() const
Pars pro toto: The first repository url, this is either baseUrls().front() or if no baseUrl is define...
Definition RepoInfo.cc:788
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:656
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Definition RepoInfo.cc:776
Url location() const
Returns the location URL for the repository, this is either the first configured baseUrl or a configu...
Definition RepoInfo.cc:767
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
Definition RepoInfo.cc:692
bool baseUrlSet() const
Whether there are manualy configured repository urls.
Definition RepoInfo.cc:785
void setGpgCheck(TriBool value_r)
Set the value for gpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:514
Pathname path() const
Repository path.
Definition RepoInfo.cc:755
url_set baseUrls() const
The complete set of repository urls as configured.
Definition RepoInfo.cc:749
void addBaseUrl(Url url)
Add a base url.
Definition RepoInfo.cc:646
bool pkgGpgCheckIsMandatory() const
Mandatory check (pkgGpgCheck is not off) must ask to confirm using unsigned packages.
Definition RepoInfo.cc:539
url_set rawBaseUrls() const
The complete set of raw repository urls (no variables replaced)
Definition RepoInfo.cc:752
bool hasContentAny(TIterator begin_r, TIterator end_r) const
Definition RepoInfo.h:518
Url mirrorListUrl() const
Url of a file which contains a list of repository urls.
Definition RepoInfo.cc:725
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:685
void setBaseUrls(url_set urls)
Clears current base URL list and adds an url_set.
Definition RepoInfo.cc:663
unsigned priority() const
Repository priority for solver.
Definition RepoInfo.cc:498
bool gpgCheck() const
Whether default signature checking should be performed.
Definition RepoInfo.cc:511
void setPath(const Pathname &path)
set the product path.
Definition RepoInfo.cc:679
void setValidRepoSignature(TriBool value_r)
Set the value for validRepoSignature (or indeterminate if unsigned).
Definition RepoInfo.cc:561
static unsigned defaultPriority()
The default priority (99).
Definition RepoInfo.cc:501
void setPriority(unsigned newval_r)
Set repository priority for solver.
Definition RepoInfo.cc:507
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:499
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition RepoInfo.h:612
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition RepoInfo.cc:773
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:514
bool repoGpgCheckIsMandatory() const
Mandatory check (repoGpgCheck is on) must ask to confirm using unsigned repos.
Definition RepoInfo.cc:524
friend class RepoManager
Definition RepoInfo.h:609
std::vector< std::vector< Url > > groupedBaseUrls() const
Returns the currently known effective baseUrls in groups, where each group contains a primary base ur...
Definition RepoInfo.cc:770
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
Definition RepoInfo.cc:689
shared_ptr< const RepoInfo > RepoInfo_constPtr
Definition RepoInfo.h:619
TriBool validRepoSignature() const
Whether the repo metadata are signed and successfully validated or indeterminate if unsigned.
Definition RepoInfo.cc:554
void setRepoGpgCheck(TriBool value_r)
Set the value for repoGpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:532
void setMetalinkUrls(url_set urls)
Like setMirrorListUrls but expect metalink format.
Definition RepoInfo.cc:631
Pathname packagesPath() const
Path where this repo packages are cached.
Definition RepoInfo.cc:716
bool hasContentAll(TIterator begin_r, TIterator end_r) const
Definition RepoInfo.h:510
void addContent(const std::string &keyword_r)
Add content keywords.
Definition RepoInfo.cc:796
bool repoGpgCheck() const
Whether the signature of repo metadata should be checked for this repo.
Definition RepoInfo.cc:521
void setType(const repo::RepoType &t)
set the repository type
Definition RepoInfo.cc:682
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
Definition RepoInfo.cc:536
std::list< Url > url_set
Definition RepoInfo.h:108
Url rawMirrorListUrl() const
The raw mirrorListUrl (no variables replaced).
Definition RepoInfo.cc:728
RepoInfo & operator=(RepoInfo &&)=default
bool effectiveBaseUrlsEmpty() const
whether effective repository urls are available
Definition RepoInfo.cc:669
Url manipulation class.
Definition Url.h:93
Base class implementing common features of RepoInfo and ServiceInfo.
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)
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition String.h:31
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 for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27