libzypp 17.36.7

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>
25#include <zypp/repo/RepoVariables.h>
26
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
136 Url url() const
137 { return( baseUrlsEmpty() ? Url() : *baseUrlsBegin()); }
138
141 Url rawUrl() const;
142
149 url_set baseUrls() const;
153 url_set rawBaseUrls() const;
154
162 void addBaseUrl( Url url );
166 void setBaseUrl( Url url );
170 void setBaseUrls( url_set urls );
171
192 Pathname path() const;
197 void setPath( const Pathname &path );
198
202 Url mirrorListUrl() const;
206 Url rawMirrorListUrl() const;
211 void setMirrorListUrl( const Url &url );
213 void setMirrorListUrls( url_set urls );
214
216 void setMetalinkUrl( const Url &url );
218 void setMetalinkUrls( url_set urls );
219
224 repo::RepoType type() const;
231 void setProbedType( const repo::RepoType &t ) const;
236 void setType( const repo::RepoType &t );
237
244 Pathname metadataPath() const;
271 void setMetadataPath( const Pathname &path );
272
274 bool usesAutoMetadataPaths() const;
275
279 Pathname packagesPath() const;
285 void setPackagesPath( const Pathname &path );
286
290 Pathname predownloadPath() const;
291
292
349
350 bool gpgCheck() const;
352 void setGpgCheck( TriBool value_r );
354 void setGpgCheck( bool value_r );
355
357 bool repoGpgCheck() const;
359 bool repoGpgCheckIsMandatory() const;
361 void setRepoGpgCheck( TriBool value_r );
362
364 bool pkgGpgCheck() const;
366 bool pkgGpgCheckIsMandatory() const;
368 void setPkgGpgCheck( TriBool value_r );
369
373 TriBool validRepoSignature() const;
375 void setValidRepoSignature( TriBool value_r );
376
378 enum class GpgCheck {
379 indeterminate, //< not specified
380 On, //< 1** --gpgcheck
381 Strict, //< 111 --gpgcheck-strict
382 AllowUnsigned, //< 100 --gpgcheck-allow-unsigned
383 AllowUnsignedRepo, //< 10* --gpgcheck-allow-unsigned-repo
384 AllowUnsignedPackage, //< 1*0 --gpgcheck-allow-unsigned-package
385 Default, //< *** --default-gpgcheck
386 Off, //< 0** --no-gpgcheck
387 };
388
393 bool setGpgCheck( GpgCheck mode_r );
395
396
398 bool gpgKeyUrlsEmpty() const;
400 urls_size_type gpgKeyUrlsSize() const;
401
403 url_set gpgKeyUrls() const;
405 url_set rawGpgKeyUrls() const;
407 void setGpgKeyUrls( url_set urls );
408
410 Url gpgKeyUrl() const;
412 Url rawGpgKeyUrl() const;
414 void setGpgKeyUrl( const Url &gpgkey );
415
417 Pathname provideKey(const std::string &keyID_r, const Pathname &targetDirectory_r ) const;
418
422 bool keepPackages() const;
432 void setKeepPackages( bool keep );
433
438 bool effectiveKeepPackages() const;
439
444 std::string service() const;
448 void setService( const std::string& name );
449
453 std::string targetDistribution() const;
459 void setTargetDistribution(const std::string & targetDistribution);
460
461
463 const std::set<std::string> & contentKeywords() const;
464
466 void addContent( const std::string & keyword_r );
468 template <class TIterator>
469 void addContentFrom( TIterator begin_r, TIterator end_r )
470 { for_( it, begin_r, end_r ) addContent( *it ); }
471
472 template <class TContainer>
473 void addContentFrom( const TContainer & container_r )
474 { addContentFrom( container_r.begin(), container_r.end() ); }
475
479 bool hasContent() const;
481 bool hasContent( const std::string & keyword_r ) const;
483 template <class TIterator>
484 bool hasContentAll( TIterator begin_r, TIterator end_r ) const
485 { for_( it, begin_r, end_r ) if ( ! hasContent( *it ) ) return false; return true; }
486
487 template <class TContainer>
488 bool hasContentAll( const TContainer & container_r ) const
489 { return hasContentAll( container_r.begin(), container_r.end() ); }
490
491 template <class TIterator>
492 bool hasContentAny( TIterator begin_r, TIterator end_r ) const
493 { for_( it, begin_r, end_r ) if ( hasContent( *it ) ) return true; return false; }
494
495 template <class TContainer>
496 bool hasContentAny( const TContainer & container_r ) const
497 { return hasContentAny( container_r.begin(), container_r.end() ); }
498
499 public:
512
513 bool hasLicense() const;
515 bool hasLicense( const std::string & name_r ) const;
516
520 bool needToAcceptLicense() const;
522 bool needToAcceptLicense( const std::string & name_r ) const;
523
525 std::string getLicense( const Locale & lang_r = Locale() ) const;
527 std::string getLicense( const Locale & lang_r = Locale() ); // LEGACY API
529 std::string getLicense( const std::string & name_r, const Locale & lang_r = Locale() ) const;
530
535 LocaleSet getLicenseLocales() const;
537 LocaleSet getLicenseLocales( const std::string & name_r ) const;
539
544 bool requireStatusWithMediaFile () const;
545
546 public:
551 std::ostream & dumpOn( std::ostream & str ) const override;
552
557 std::ostream & dumpAsIniOn( std::ostream & str ) const override;
558
567 std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const override;
568
572 void getRawGpgChecks( TriBool & g_r, TriBool & r_r, TriBool & p_r ) const;
573
579 std::string repoStatusString() const;
580
581 struct Impl;
582 private:
583 friend class RepoManager;
584
586 RWCOW_pointer<Impl> _pimpl;
587 };
588
589
591 using RepoInfo_Ptr = shared_ptr<RepoInfo>;
593 using RepoInfo_constPtr = shared_ptr<const RepoInfo>;
595 using RepoInfoList = std::list<RepoInfo>;
596
598 std::ostream & operator<<( std::ostream & str, const RepoInfo & obj ) ZYPP_API;
599
601 std::ostream & operator<<( std::ostream & str, const RepoInfo::GpgCheck & obj ) ZYPP_API;
602
604} // namespace zypp
606#endif // ZYPP2_REPOSITORYINFO_H
Locale.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::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:496
zypp::RepoInfo::RepoInfo
RepoInfo(RepoInfo &&)=default
zypp::RepoInfo::urls_size_type
url_set::size_type urls_size_type
Definition RepoInfo.h:109
zypp::RepoInfo::RepoInfo_Ptr
shared_ptr< RepoInfo > RepoInfo_Ptr
Definition RepoInfo.h:591
zypp::RepoInfo::addContentFrom
void addContentFrom(TIterator begin_r, TIterator end_r)
Definition RepoInfo.h:469
zypp::RepoInfo::GpgCheck
GpgCheck
Some predefined settings.
Definition RepoInfo.h:378
zypp::RepoInfo::GpgCheck::Strict
@ Strict
Definition RepoInfo.h:381
zypp::RepoInfo::GpgCheck::indeterminate
@ indeterminate
Definition RepoInfo.h:379
zypp::RepoInfo::GpgCheck::On
@ On
Definition RepoInfo.h:380
zypp::RepoInfo::GpgCheck::AllowUnsignedPackage
@ AllowUnsignedPackage
Definition RepoInfo.h:384
zypp::RepoInfo::GpgCheck::Default
@ Default
Definition RepoInfo.h:385
zypp::RepoInfo::GpgCheck::AllowUnsigned
@ AllowUnsigned
Definition RepoInfo.h:382
zypp::RepoInfo::GpgCheck::AllowUnsignedRepo
@ AllowUnsignedRepo
Definition RepoInfo.h:383
zypp::RepoInfo::GpgCheck::Off
@ Off
Definition RepoInfo.h:386
zypp::RepoInfo::baseUrlsEmpty
bool baseUrlsEmpty() const
whether repository urls are available
Definition RepoInfo.cc:678
zypp::RepoInfo::hasContent
bool hasContent() const
Check for content keywords.
Definition RepoInfo.cc:690
zypp::RepoInfo::urls_const_iterator
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Definition RepoInfo.h:110
zypp::RepoInfo::RepoInfoList
std::list< RepoInfo > RepoInfoList
Definition RepoInfo.h:595
zypp::RepoInfo::operator=
RepoInfo & operator=(const RepoInfo &)=default
zypp::RepoInfo::noPriority
static unsigned noPriority()
The least priority (unsigned(-1)).
Definition RepoInfo.cc:418
zypp::RepoInfo::baseUrlsSize
urls_size_type baseUrlsSize() const
number of repository urls
Definition RepoInfo.cc:675
zypp::RepoInfo::url
Url url() const
Pars pro toto: The first repository url.
Definition RepoInfo.h:136
zypp::RepoInfo::noRepo
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition RepoInfo.h:85
zypp::RepoInfo::baseUrlsEnd
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Definition RepoInfo.cc:672
zypp::RepoInfo::baseUrlSet
bool baseUrlSet() const
Whether there are manualy configured repository urls.
Definition RepoInfo.cc:681
zypp::RepoInfo::hasContentAny
bool hasContentAny(TIterator begin_r, TIterator end_r) const
Definition RepoInfo.h:492
zypp::RepoInfo::priority
unsigned priority() const
Repository priority for solver.
Definition RepoInfo.cc:412
zypp::RepoInfo::RepoInfo
RepoInfo()
Definition RepoInfo.cc:405
zypp::RepoInfo::defaultPriority
static unsigned defaultPriority()
The default priority (99).
Definition RepoInfo.cc:415
zypp::RepoInfo::setPriority
void setPriority(unsigned newval_r)
Set repository priority for solver.
Definition RepoInfo.cc:421
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:473
zypp::RepoInfo::_pimpl
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition RepoInfo.h:586
zypp::RepoInfo::baseUrlsBegin
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition RepoInfo.cc:669
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:488
zypp::RepoInfo::RepoManager
friend class RepoManager
Definition RepoInfo.h:583
zypp::RepoInfo::RepoInfo_constPtr
shared_ptr< const RepoInfo > RepoInfo_constPtr
Definition RepoInfo.h:593
zypp::RepoInfo::hasContentAll
bool hasContentAll(TIterator begin_r, TIterator end_r) const
Definition RepoInfo.h:484
zypp::RepoInfo::addContent
void addContent(const std::string &keyword_r)
Add content keywords.
Definition RepoInfo.cc:687
zypp::RepoInfo::url_set
std::list< Url > url_set
Definition RepoInfo.h:108
zypp::RepoInfo::operator=
RepoInfo & operator=(RepoInfo &&)=default
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::url
Url details namespace.
Definition UrlBase.cc:58
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:30
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.
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
TriBool.h
Url.h
Iterator.h