libzypp 17.35.19
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
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
287
344
345 bool gpgCheck() const;
347 void setGpgCheck( TriBool value_r );
349 void setGpgCheck( bool value_r );
350
352 bool repoGpgCheck() const;
354 bool repoGpgCheckIsMandatory() const;
356 void setRepoGpgCheck( TriBool value_r );
357
359 bool pkgGpgCheck() const;
361 bool pkgGpgCheckIsMandatory() const;
363 void setPkgGpgCheck( TriBool value_r );
364
368 TriBool validRepoSignature() const;
370 void setValidRepoSignature( TriBool value_r );
371
373 enum class GpgCheck {
374 indeterminate, //< not specified
375 On, //< 1** --gpgcheck
376 Strict, //< 111 --gpgcheck-strict
377 AllowUnsigned, //< 100 --gpgcheck-allow-unsigned
378 AllowUnsignedRepo, //< 10* --gpgcheck-allow-unsigned-repo
379 AllowUnsignedPackage, //< 1*0 --gpgcheck-allow-unsigned-package
380 Default, //< *** --default-gpgcheck
381 Off, //< 0** --no-gpgcheck
382 };
383
388 bool setGpgCheck( GpgCheck mode_r );
390
391
393 bool gpgKeyUrlsEmpty() const;
395 urls_size_type gpgKeyUrlsSize() const;
396
398 url_set gpgKeyUrls() const;
400 url_set rawGpgKeyUrls() const;
402 void setGpgKeyUrls( url_set urls );
403
405 Url gpgKeyUrl() const;
407 Url rawGpgKeyUrl() const;
409 void setGpgKeyUrl( const Url &gpgkey );
410
412 Pathname provideKey(const std::string &keyID_r, const Pathname &targetDirectory_r ) const;
413
417 bool keepPackages() const;
427 void setKeepPackages( bool keep );
428
433 bool effectiveKeepPackages() const;
434
439 std::string service() const;
443 void setService( const std::string& name );
444
448 std::string targetDistribution() const;
454 void setTargetDistribution(const std::string & targetDistribution);
455
456
458 const std::set<std::string> & contentKeywords() const;
459
461 void addContent( const std::string & keyword_r );
463 template <class TIterator>
464 void addContentFrom( TIterator begin_r, TIterator end_r )
465 { for_( it, begin_r, end_r ) addContent( *it ); }
466
467 template <class TContainer>
468 void addContentFrom( const TContainer & container_r )
469 { addContentFrom( container_r.begin(), container_r.end() ); }
470
474 bool hasContent() const;
476 bool hasContent( const std::string & keyword_r ) const;
478 template <class TIterator>
479 bool hasContentAll( TIterator begin_r, TIterator end_r ) const
480 { for_( it, begin_r, end_r ) if ( ! hasContent( *it ) ) return false; return true; }
481
482 template <class TContainer>
483 bool hasContentAll( const TContainer & container_r ) const
484 { return hasContentAll( container_r.begin(), container_r.end() ); }
485
486 template <class TIterator>
487 bool hasContentAny( TIterator begin_r, TIterator end_r ) const
488 { for_( it, begin_r, end_r ) if ( hasContent( *it ) ) return true; return false; }
489
490 template <class TContainer>
491 bool hasContentAny( const TContainer & container_r ) const
492 { return hasContentAny( container_r.begin(), container_r.end() ); }
493
494 public:
507
508 bool hasLicense() const;
510 bool hasLicense( const std::string & name_r ) const;
511
515 bool needToAcceptLicense() const;
517 bool needToAcceptLicense( const std::string & name_r ) const;
518
520 std::string getLicense( const Locale & lang_r = Locale() ) const;
522 std::string getLicense( const Locale & lang_r = Locale() ); // LEGACY API
524 std::string getLicense( const std::string & name_r, const Locale & lang_r = Locale() ) const;
525
530 LocaleSet getLicenseLocales() const;
532 LocaleSet getLicenseLocales( const std::string & name_r ) const;
534
539 bool requireStatusWithMediaFile () const;
540
541 public:
546 std::ostream & dumpOn( std::ostream & str ) const override;
547
552 std::ostream & dumpAsIniOn( std::ostream & str ) const override;
553
562 std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const override;
563
567 void getRawGpgChecks( TriBool & g_r, TriBool & r_r, TriBool & p_r ) const;
568
569 struct Impl;
570 private:
571 friend class RepoManager;
572
575 };
576
577
583 using RepoInfoList = std::list<RepoInfo>;
584
586 std::ostream & operator<<( std::ostream & str, const RepoInfo & obj ) ZYPP_API;
587
589 std::ostream & operator<<( std::ostream & str, const RepoInfo::GpgCheck & obj ) ZYPP_API;
590
592} // namespace zypp
594#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
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:491
RepoInfo(RepoInfo &&)=default
url_set::size_type urls_size_type
Definition RepoInfo.h:109
shared_ptr< RepoInfo > RepoInfo_Ptr
Definition RepoInfo.h:579
void addContentFrom(TIterator begin_r, TIterator end_r)
Definition RepoInfo.h:464
GpgCheck
Some predefined settings.
Definition RepoInfo.h:373
bool baseUrlsEmpty() const
whether repository urls are available
Definition RepoInfo.cc:659
bool hasContent() const
Check for content keywords.
Definition RepoInfo.cc:671
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Definition RepoInfo.h:110
std::list< RepoInfo > RepoInfoList
Definition RepoInfo.h:583
RepoInfo & operator=(const RepoInfo &)=default
static unsigned noPriority()
The least priority (unsigned(-1)).
Definition RepoInfo.cc:404
urls_size_type baseUrlsSize() const
number of repository urls
Definition RepoInfo.cc:656
Url url() const
Pars pro toto: The first repository url.
Definition RepoInfo.h:136
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition RepoInfo.h:85
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Definition RepoInfo.cc:653
bool baseUrlSet() const
Whether there are manualy configured repository urls.
Definition RepoInfo.cc:662
bool hasContentAny(TIterator begin_r, TIterator end_r) const
Definition RepoInfo.h:487
unsigned priority() const
Repository priority for solver.
Definition RepoInfo.cc:398
static unsigned defaultPriority()
The default priority (99).
Definition RepoInfo.cc:401
void setPriority(unsigned newval_r)
Set repository priority for solver.
Definition RepoInfo.cc:407
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:468
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition RepoInfo.h:574
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition RepoInfo.cc:650
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:483
friend class RepoManager
Definition RepoInfo.h:571
shared_ptr< const RepoInfo > RepoInfo_constPtr
Definition RepoInfo.h:581
bool hasContentAll(TIterator begin_r, TIterator end_r) const
Definition RepoInfo.h:479
void addContent(const std::string &keyword_r)
Add content keywords.
Definition RepoInfo.cc:668
std::list< Url > url_set
Definition RepoInfo.h:108
RepoInfo & operator=(RepoInfo &&)=default
Url manipulation class.
Definition Url.h:93
Base class implementing common features of RepoInfo and ServiceInfo.
String related utilities and Regular expression matching.
Url details namespace.
Definition UrlBase.cc:58
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:30
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:28