libzypp 17.37.10

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-core/base/Iterator.h>
19#include <zypp-core/Globals.h>
20#include <zypp-core/MirroredOrigin.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>
26#include <zypp/repo/RepoVariables.h>
27#include <zypp/repo/RepoInfoBase.h>
28
30 namespace zypp
31{
32
34 //
35 // CLASS NAME : RepoInfo
36 //
71 class ZYPP_API RepoInfo : public repo::RepoInfoBase
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;
110 using urls_const_iterator = transform_iterator<repo::RepoVariablesUrlReplacer, url_set::const_iterator>;
114 bool baseUrlsEmpty() const;
119 bool baseUrlSet() const;
123 urls_size_type baseUrlsSize() const;
127 urls_const_iterator baseUrlsBegin() const;
131 urls_const_iterator baseUrlsEnd() 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
187 MirroredOriginSet repoOrigins() const;
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
324 Pathname predownloadPath() const;
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
407 TriBool validRepoSignature() const;
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
617 RWCOW_pointer<Impl> _pimpl;
618 };
619
620
622 using RepoInfo_Ptr = shared_ptr<RepoInfo>;
624 using RepoInfo_constPtr = shared_ptr<const RepoInfo>;
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
Locale.h
MirroredOrigin.h
RepoInfoBase.h
RepoType.h
RepoVariables.h
Impl
shared_ptr
transform_iterator
An iterator over elements which are the result of applying some functional transformation to the elem...
zypp::Locale
'Language[_Country]' codes.
Definition Locale.h:51
zypp::MirroredOriginSet
A smart container that manages a collection of MirroredOrigin objects, automatically grouping endpoin...
Definition MirroredOrigin.h:325
zypp::RepoInfo::setPkgGpgCheck
void setPkgGpgCheck(TriBool value_r)
Set the value for pkgGpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:553
zypp::RepoInfo::setMetalinkUrl
void setMetalinkUrl(const Url &url)
Set the raw metalink url.
Definition RepoInfo.cc:636
zypp::RepoInfo::metadataPath
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition RepoInfo.cc:733
zypp::RepoInfo::hasContentAny
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
zypp::RepoInfo::RepoInfo
RepoInfo(RepoInfo &&)=default
zypp::RepoInfo::setMirrorlistUrl
void setMirrorlistUrl(const Url &url)
Set the raw mirrorlist url.
Definition RepoInfo.cc:633
zypp::RepoInfo::urls_size_type
url_set::size_type urls_size_type
Definition RepoInfo.h:109
zypp::RepoInfo::usesAutoMetadataPaths
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
Definition RepoInfo.cc:739
zypp::RepoInfo::RepoInfo_Ptr
shared_ptr< RepoInfo > RepoInfo_Ptr
Definition RepoInfo.h:622
zypp::RepoInfo::addContentFrom
void addContentFrom(TIterator begin_r, TIterator end_r)
Definition RepoInfo.h:500
zypp::RepoInfo::GpgCheck
GpgCheck
Some predefined settings.
Definition RepoInfo.h:412
zypp::RepoInfo::GpgCheck::Strict
@ Strict
Definition RepoInfo.h:415
zypp::RepoInfo::GpgCheck::indeterminate
@ indeterminate
Definition RepoInfo.h:413
zypp::RepoInfo::GpgCheck::On
@ On
Definition RepoInfo.h:414
zypp::RepoInfo::GpgCheck::AllowUnsignedPackage
@ AllowUnsignedPackage
Definition RepoInfo.h:418
zypp::RepoInfo::GpgCheck::Default
@ Default
Definition RepoInfo.h:419
zypp::RepoInfo::GpgCheck::AllowUnsigned
@ AllowUnsigned
Definition RepoInfo.h:416
zypp::RepoInfo::GpgCheck::AllowUnsignedRepo
@ AllowUnsignedRepo
Definition RepoInfo.h:417
zypp::RepoInfo::GpgCheck::Off
@ Off
Definition RepoInfo.h:420
zypp::RepoInfo::baseUrlsEmpty
bool baseUrlsEmpty() const
whether repository urls are available
Definition RepoInfo.cc:799
zypp::RepoInfo::predownloadPath
Pathname predownloadPath() const
Path where this repo packages are predownloaded.
Definition RepoInfo.cc:715
zypp::RepoInfo::hasContent
bool hasContent() const
Check for content keywords.
Definition RepoInfo.cc:816
zypp::RepoInfo::repoOrigins
MirroredOriginSet repoOrigins() const
The repodata origins.
Definition RepoInfo.cc:689
zypp::RepoInfo::urls_const_iterator
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Definition RepoInfo.h:110
zypp::RepoInfo::rawUrl
Url rawUrl() const
Pars pro toto: The first repository raw url (no variables replaced) this is either rawBaseUrls()....
Definition RepoInfo.cc:784
zypp::RepoInfo::type
repo::RepoType type() const
Type of repository,.
Definition RepoInfo.cc:742
zypp::RepoInfo::RepoInfoList
std::list< RepoInfo > RepoInfoList
Definition RepoInfo.h:626
zypp::RepoInfo::operator=
RepoInfo & operator=(const RepoInfo &)=default
zypp::RepoInfo::noPriority
static unsigned noPriority()
The least priority (unsigned(-1)).
Definition RepoInfo.cc:515
zypp::RepoInfo::baseUrlsSize
urls_size_type baseUrlsSize() const
number of repository urls
Definition RepoInfo.cc:796
zypp::RepoInfo::url
Url url() const
Pars pro toto: The first repository url, this is either baseUrls().front() or if no baseUrl is define...
Definition RepoInfo.cc:805
zypp::RepoInfo::noRepo
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition RepoInfo.h:85
zypp::RepoInfo::setBaseUrl
void setBaseUrl(Url url)
Clears current base URL list and adds url.
Definition RepoInfo.cc:676
zypp::RepoInfo::baseUrlsEnd
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Definition RepoInfo.cc:793
zypp::RepoInfo::location
Url location() const
Returns the location URL for the repository, this is either the first configured baseUrl or a configu...
Definition RepoInfo.cc:787
zypp::RepoInfo::setPackagesPath
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
Definition RepoInfo.cc:712
zypp::RepoInfo::rawCfgMetalinkUrl
Url rawCfgMetalinkUrl() const
The configured raw metalink url.
Definition RepoInfo.cc:642
zypp::RepoInfo::baseUrlSet
bool baseUrlSet() const
Whether there are manualy configured repository urls.
Definition RepoInfo.cc:802
zypp::RepoInfo::setGpgCheck
void setGpgCheck(TriBool value_r)
Set the value for gpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:525
zypp::RepoInfo::path
Pathname path() const
Repository path.
Definition RepoInfo.cc:775
zypp::RepoInfo::baseUrls
url_set baseUrls() const
The complete set of repository urls as configured.
Definition RepoInfo.cc:769
zypp::RepoInfo::addBaseUrl
void addBaseUrl(Url url)
Add a base url.
Definition RepoInfo.cc:666
zypp::RepoInfo::pkgGpgCheckIsMandatory
bool pkgGpgCheckIsMandatory() const
Mandatory check (pkgGpgCheck is not off) must ask to confirm using unsigned packages.
Definition RepoInfo.cc:550
zypp::RepoInfo::rawBaseUrls
url_set rawBaseUrls() const
The complete set of raw repository urls (no variables replaced)
Definition RepoInfo.cc:772
zypp::RepoInfo::hasContentAny
bool hasContentAny(TIterator begin_r, TIterator end_r) const
Definition RepoInfo.h:523
zypp::RepoInfo::mirrorListUrl
Url mirrorListUrl() const
Url of a file which contains a list of repository urls.
Definition RepoInfo.cc:745
zypp::RepoInfo::setProbedType
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:705
zypp::RepoInfo::setBaseUrls
void setBaseUrls(url_set urls)
Clears current base URL list and adds an url_set.
Definition RepoInfo.cc:683
zypp::RepoInfo::priority
unsigned priority() const
Repository priority for solver.
Definition RepoInfo.cc:509
zypp::RepoInfo::gpgCheck
bool gpgCheck() const
Whether default signature checking should be performed.
Definition RepoInfo.cc:522
zypp::RepoInfo::setPath
void setPath(const Pathname &path)
set the product path.
Definition RepoInfo.cc:699
zypp::RepoInfo::setValidRepoSignature
void setValidRepoSignature(TriBool value_r)
Set the value for validRepoSignature (or indeterminate if unsigned).
Definition RepoInfo.cc:572
zypp::RepoInfo::RepoInfo
RepoInfo()
Definition RepoInfo.cc:502
zypp::RepoInfo::defaultPriority
static unsigned defaultPriority()
The default priority (99).
Definition RepoInfo.cc:512
zypp::RepoInfo::setPriority
void setPriority(unsigned newval_r)
Set repository priority for solver.
Definition RepoInfo.cc:518
zypp::RepoInfo::RepoInfo
RepoInfo(const RepoInfo &)=default
zypp::RepoInfo::addContentFrom
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
zypp::RepoInfo::_pimpl
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition RepoInfo.h:617
zypp::RepoInfo::baseUrlsBegin
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition RepoInfo.cc:790
zypp::RepoInfo::hasContentAll
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
zypp::RepoInfo::repoGpgCheckIsMandatory
bool repoGpgCheckIsMandatory() const
Mandatory check (repoGpgCheck is on) must ask to confirm using unsigned repos.
Definition RepoInfo.cc:535
zypp::RepoInfo::RepoManager
friend class RepoManager
Definition RepoInfo.h:614
zypp::RepoInfo::setMetadataPath
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
Definition RepoInfo.cc:709
zypp::RepoInfo::RepoInfo_constPtr
shared_ptr< const RepoInfo > RepoInfo_constPtr
Definition RepoInfo.h:624
zypp::RepoInfo::validRepoSignature
TriBool validRepoSignature() const
Whether the repo metadata are signed and successfully validated or indeterminate if unsigned.
Definition RepoInfo.cc:565
zypp::RepoInfo::setRepoGpgCheck
void setRepoGpgCheck(TriBool value_r)
Set the value for repoGpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:543
zypp::RepoInfo::packagesPath
Pathname packagesPath() const
Path where this repo packages are cached.
Definition RepoInfo.cc:736
zypp::RepoInfo::hasContentAll
bool hasContentAll(TIterator begin_r, TIterator end_r) const
Definition RepoInfo.h:515
zypp::RepoInfo::addContent
void addContent(const std::string &keyword_r)
Add content keywords.
Definition RepoInfo.cc:813
zypp::RepoInfo::repoGpgCheck
bool repoGpgCheck() const
Whether the signature of repo metadata should be checked for this repo.
Definition RepoInfo.cc:532
zypp::RepoInfo::setType
void setType(const repo::RepoType &t)
set the repository type
Definition RepoInfo.cc:702
zypp::RepoInfo::pkgGpgCheck
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
Definition RepoInfo.cc:547
zypp::RepoInfo::url_set
std::list< Url > url_set
Definition RepoInfo.h:108
zypp::RepoInfo::rawMirrorListUrl
Url rawMirrorListUrl() const
The raw mirrorListUrl (no variables replaced).
Definition RepoInfo.cc:748
zypp::RepoInfo::operator=
RepoInfo & operator=(RepoInfo &&)=default
zypp::RepoInfo::rawCfgMirrorlistUrl
Url rawCfgMirrorlistUrl() const
The configured raw mirrorlist url.
Definition RepoInfo.cc:639
zypp::RepoInfo::repoOriginsEmpty
bool repoOriginsEmpty() const
whether repo origins are available
Definition RepoInfo.cc:694
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
zypp::repo::RepoInfoBase
Base class implementing common features of RepoInfo and ServiceInfo.
Definition RepoInfoBase.h:40
str
String related utilities and Regular expression matching.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::LocaleSet
std::unordered_set< Locale > LocaleSet
Definition Locale.h:29
zypp::dumpOn
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition Capability.cc:580
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition SerialNumber.cc:52
zypp::dumpAsXmlOn
std::ostream & dumpAsXmlOn(std::ostream &str, const Repository &obj)
Definition Repository.cc:407
zypp::TriBool
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition String.h:31
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
zypp::repo::RepoType
Repository type enumeration.
Definition RepoType.h:29
Globals.h
Provides API related macros.
ZYPP_DEPRECATED
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3....
Definition Globals.h:112
TriBool.h
Url.h
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
Iterator.h