libzypp  17.37.5
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 
27 #include <zypp/repo/RepoInfoBase.h>
28 
30 namespace 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>;
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 
180  bool effectiveBaseUrlsEmpty() const;
181 
191  url_set effectiveBaseUrls() const;
192 
197  std::vector<std::vector<Url>> groupedBaseUrls() const;
198 
199 
200 
221  Pathname path() const;
226  void setPath( const Pathname &path );
227 
232  Url mirrorListUrl() const;
237  Url rawMirrorListUrl() const;
238 
240  void setMirrorlistUrl( const Url &url );
242  void setMetalinkUrl( const Url &url );
243 
245  Url rawCfgMirrorlistUrl() const;
247  Url rawCfgMetalinkUrl() const;
248 
249 #if LEGACY(1735)
250 
254  void setMirrorListUrl( const Url &url ) ZYPP_DEPRECATED;
256  void setMetalinkUrls( url_set urls ) ZYPP_DEPRECATED;
258  void setMirrorListUrls( url_set urls ) ZYPP_DEPRECATED;
259 #endif
260 
265  repo::RepoType type() const;
272  void setProbedType( const repo::RepoType &t ) const;
277  void setType( const repo::RepoType &t );
278 
285  Pathname metadataPath() const;
312  void setMetadataPath( const Pathname &path );
313 
315  bool usesAutoMetadataPaths() const;
316 
320  Pathname packagesPath() const;
326  void setPackagesPath( const Pathname &path );
327 
331  Pathname predownloadPath() const;
332 
333 
391  bool gpgCheck() const;
393  void setGpgCheck( TriBool value_r );
395  void setGpgCheck( bool value_r );
396 
398  bool repoGpgCheck() const;
400  bool repoGpgCheckIsMandatory() const;
402  void setRepoGpgCheck( TriBool value_r );
403 
405  bool pkgGpgCheck() const;
407  bool pkgGpgCheckIsMandatory() const;
409  void setPkgGpgCheck( TriBool value_r );
410 
414  TriBool validRepoSignature() const;
416  void setValidRepoSignature( TriBool value_r );
417 
419  enum class GpgCheck {
420  indeterminate, //< not specified
421  On, //< 1** --gpgcheck
422  Strict, //< 111 --gpgcheck-strict
423  AllowUnsigned, //< 100 --gpgcheck-allow-unsigned
424  AllowUnsignedRepo, //< 10* --gpgcheck-allow-unsigned-repo
425  AllowUnsignedPackage, //< 1*0 --gpgcheck-allow-unsigned-package
426  Default, //< *** --default-gpgcheck
427  Off, //< 0** --no-gpgcheck
428  };
429 
434  bool setGpgCheck( GpgCheck mode_r );
436 
437 
439  bool gpgKeyUrlsEmpty() const;
441  urls_size_type gpgKeyUrlsSize() const;
442 
444  url_set gpgKeyUrls() const;
446  url_set rawGpgKeyUrls() const;
448  void setGpgKeyUrls( url_set urls );
449 
451  Url gpgKeyUrl() const;
453  Url rawGpgKeyUrl() const;
455  void setGpgKeyUrl( const Url &gpgkey );
456 
460  bool keepPackages() const;
470  void setKeepPackages( bool keep );
471 
476  bool effectiveKeepPackages() const;
477 
482  std::string service() const;
486  void setService( const std::string& name );
487 
491  std::string targetDistribution() const;
497  void setTargetDistribution(const std::string & targetDistribution);
498 
499 
501  const std::set<std::string> & contentKeywords() const;
502 
504  void addContent( const std::string & keyword_r );
506  template <class TIterator>
507  void addContentFrom( TIterator begin_r, TIterator end_r )
508  { for_( it, begin_r, end_r ) addContent( *it ); }
510  template <class TContainer>
511  void addContentFrom( const TContainer & container_r )
512  { addContentFrom( container_r.begin(), container_r.end() ); }
513 
517  bool hasContent() const;
519  bool hasContent( const std::string & keyword_r ) const;
521  template <class TIterator>
522  bool hasContentAll( TIterator begin_r, TIterator end_r ) const
523  { for_( it, begin_r, end_r ) if ( ! hasContent( *it ) ) return false; return true; }
525  template <class TContainer>
526  bool hasContentAll( const TContainer & container_r ) const
527  { return hasContentAll( container_r.begin(), container_r.end() ); }
529  template <class TIterator>
530  bool hasContentAny( TIterator begin_r, TIterator end_r ) const
531  { for_( it, begin_r, end_r ) if ( hasContent( *it ) ) return true; return false; }
533  template <class TContainer>
534  bool hasContentAny( const TContainer & container_r ) const
535  { return hasContentAny( container_r.begin(), container_r.end() ); }
536 
537  public:
551  bool hasLicense() const;
553  bool hasLicense( const std::string & name_r ) const;
554 
558  bool needToAcceptLicense() const;
560  bool needToAcceptLicense( const std::string & name_r ) const;
561 
563  std::string getLicense( const Locale & lang_r = Locale() ) const;
565  std::string getLicense( const Locale & lang_r = Locale() ); // LEGACY API
567  std::string getLicense( const std::string & name_r, const Locale & lang_r = Locale() ) const;
568 
573  LocaleSet getLicenseLocales() const;
575  LocaleSet getLicenseLocales( const std::string & name_r ) const;
577 
582  bool requireStatusWithMediaFile () const;
583 
584  public:
589  std::ostream & dumpOn( std::ostream & str ) const override;
590 
595  std::ostream & dumpAsIniOn( std::ostream & str ) const override;
596 
605  std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const override;
606 
610  void getRawGpgChecks( TriBool & g_r, TriBool & r_r, TriBool & p_r ) const;
611 
617  std::string repoStatusString() const;
618 
619  struct Impl;
620  private:
621  friend class RepoManager;
622 
625  };
627 
629  using RepoInfo_Ptr = shared_ptr<RepoInfo>;
631  using RepoInfo_constPtr = shared_ptr<const RepoInfo>;
633  using RepoInfoList = std::list<RepoInfo>;
634 
636  std::ostream & operator<<( std::ostream & str, const RepoInfo & obj ) ZYPP_API;
637 
639  std::ostream & operator<<( std::ostream & str, const RepoInfo::GpgCheck & obj ) ZYPP_API;
640 
642 } // namespace zypp
644 #endif // ZYPP2_REPOSITORYINFO_H
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition: String.h:31
bool hasContentAll(TIterator begin_r, TIterator end_r) const
Definition: RepoInfo.h:522
zypp::RepoInfo RepoInfo
Definition: repomanager.h:36
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: RepoInfo.h:624
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:29
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition: SerialNumber.cc:52
What is known about a repository.
Definition: RepoInfo.h:71
Request the standard behavior (as defined in zypp.conf or &#39;Job&#39;)
Provides API related macros.
bool hasContentAny(TIterator begin_r, TIterator end_r) const
Definition: RepoInfo.h:530
RepoInfo implementation.
Definition: RepoInfo.cc:78
bool hasContentAll(const TContainer &container_r) const
Definition: RepoInfo.h:526
std::ostream & dumpAsXmlOn(std::ostream &str, const Repository &obj)
Definition: Repository.cc:407
GpgCheck
Some predefined settings.
Definition: RepoInfo.h:419
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition: ResTraits.h:93
shared_ptr< const RepoInfo > RepoInfo_constPtr
Definition: RepoInfo.h:631
url_set::size_type urls_size_type
Definition: RepoInfo.h:109
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition: Capability.cc:580
std::list< Url > url_set
Definition: RepoInfo.h:108
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Definition: RepoInfo.h:110
bool hasContentAny(const TContainer &container_r) const
Definition: RepoInfo.h:534
&#39;Language[_Country]&#39; codes.
Definition: Locale.h:50
std::list< RepoInfo > RepoInfoList
Definition: RepoInfo.h:633
void addContentFrom(TIterator begin_r, TIterator end_r)
Definition: RepoInfo.h:507
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition: RepoInfo.h:85
Base class implementing common features of RepoInfo and ServiceInfo.
Definition: RepoInfoBase.h:39
shared_ptr< RepoInfo > RepoInfo_Ptr
Definition: RepoInfo.h:629
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
SolvableIdType size_type
Definition: PoolMember.h:126
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3...
Definition: Globals.h:112
Url manipulation class.
Definition: Url.h:92
void addContentFrom(const TContainer &container_r)
Definition: RepoInfo.h:511
Repository type enumeration.
Definition: RepoType.h:28