Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / RepoInfo.h
index 9fcbe1d..70a47e3 100644 (file)
@@ -21,7 +21,6 @@
 #include "zypp/Url.h"
 #include "zypp/Locale.h"
 #include "zypp/TriBool.h"
-#include "zypp/base/EnumClass.h"
 #include "zypp/repo/RepoType.h"
 #include "zypp/repo/RepoVariables.h"
 
@@ -86,6 +85,10 @@ namespace zypp
        */
       static unsigned defaultPriority();
       /**
+       * The least priority (<tt>unsigned(-1)</tt>). 
+       */
+      static unsigned noPriority();
+      /**
        * Repository priority for solver.
        * Some number between \c 1 (highest priority) and \c 99 (\ref defaultPriority).
        */
@@ -201,6 +204,10 @@ namespace zypp
        * \param url The base url for the list
        */
       void setMirrorListUrl( const Url &url );
+      /**
+       * Like \ref setMirrorListUrl but expect metalink format.
+       */
+      void setMetalinkUrl( const Url &url );
 
       /**
        * Type of repository,
@@ -249,80 +256,30 @@ namespace zypp
       void setPackagesPath( const Pathname &path );
 
 
-      /** \name Repository gpgchecks
-       * How signature checking should be performed for this repo.
-       *
-       * The values are computed based in the settings of \c gpgcheck, \c repo_gpgcheck
-       * end \c pkg_gpgcheck in \c zypp.conf. Explicitly setting these values in the
-       * repositories \a .repo file will overwrite the defaults from \c zypp.conf for this
-       * repo.
-       *
-       * If \c gpgcheck is \c on (the default) we will check the signature of repo metadata
-       * (packages are secured via checksum inside the metadata). Using unsigned repos
-       * needs to be confirmed.
-       * Packages from signed repos are accepted if their checksum matches the checksum
-       * stated in the repo metadata.
-       * Packages from unsigned repos need a valid gpg signature, using unsigned packages
-       * needs to be confirmed.
-       *
-       * The above default behavior can be tuned by explicitly setting \c repo_gpgcheck
-       * and/or \c pkg_gpgcheck:
-       *
-       *   \c repo_gpgcheck = \c on same as the default.
-       *
-       *   \c repo_gpgcheck = \c off will silently accept unsigned repos. It will NOT turn of
-       *   signature checking on the whole, nevertheless it's not a secure setting.
-       *
-       *   \c pkg_gpgcheck = \c on will enforce the package signature checking and the need
-       *   to confirm unsigned packages for all repos (signed and unsigned).
+      /** Whether default signature checking should be performed for this repo.
        *
-       *   \c pkg_gpgcheck = \c off will silently accept unsigned packages. It will NOT turn of
-       *   signature checking on the whole, nevertheless it's not a secure setting.
+       * This will turn on \ref repoGpgCheck for signed repos and
+       * \ref pkgGpgCheck for unsigned ones or if \ref repoGpgCheck is off.
        *
-       * If \c gpgCheck is \c off (not recommneded), no checks are performed. You can still
-       * enable them individually by setting \c repo_gpgcheck and/or \c pkg_gpgcheck to \c on.
-       *
-       * \code
-       *  R: check repo signature is mandatory, confirm unsigned repos
-       *  r: check repo signature, unsigned repos are ok but enforce p
-       *   : do not check repo signatures
-       *
-       *  P: check package signature always, confirm unsigned packages
-       *  p: like P for unsigned repos, accepted by checksum for signed repos
-       *  b: like p but accept unsigned packages
-       *   : do not check package signatures
-       *                    pkg_
-       * gpgcheck 1|     *       0       1
-       * ------------------------------------
-       * repo_   *1|     R/p     R/b     R/P
-       *          0|     r/p     r/b     r/P
-       *
-       *                    pkg_
-       * gpgcheck 0|     *       0       1
-       * ------------------------------------
-       * repo_   *0|                       P
-       *          1|     R       R       R/P
-       * \endcode
+       * The default is \c true but may be overwritten by \c zypp.conf or a \ref .repo file.
        */
-      //@{
-      /** Whether default signature checking should be performed. */
       bool gpgCheck() const;
       /** Set the value for \ref gpgCheck (or \c indeterminate to use the default). */
       void setGpgCheck( TriBool value_r );
       /** \overload \deprecated legacy and for squid */
       void setGpgCheck( bool value_r );
 
-      /** Whether the signature of repo metadata should be checked for this repo. */
+      /** Whether the signature of repo metadata should be checked for this repo.
+       * The default is defined by \ref gpgCheck but may be overwritten by \c zypp.conf or a \ref .repo file.
+       */
       bool repoGpgCheck() const;
-      /** Mandatory check (\ref repoGpgCheck is \c on) must ask to confirm using unsigned repos. */
-      bool repoGpgCheckIsMandatory() const;
       /** Set the value for \ref repoGpgCheck (or \c indeterminate to use the default). */
       void setRepoGpgCheck( TriBool value_r );
 
-      /** Whether the signature of rpm packages should be checked for this repo. */
+      /** Whether the signature of rpm packages should be checked for this repo.
+       * The default is defined by \ref gpgCheck but may be overwritten by \c zypp.conf or a \ref .repo file.
+       */
       bool pkgGpgCheck() const;
-      /** Mandatory check (\ref pkgGpgCheck is not \c off) must ask to confirm using unsigned packages. */
-      bool pkgGpgCheckIsMandatory() const;
       /** Set the value for \ref pkgGpgCheck (or \c indeterminate to use the default). */
       void setPkgGpgCheck( TriBool value_r );
 
@@ -333,28 +290,6 @@ namespace zypp
       /** Set the value for \ref validRepoSignature (or \c indeterminate if unsigned). */
       void setValidRepoSignature( TriBool value_r );
 
-      /** Some predefined settings (use like 'enum class \ref GpgCheck') */
-      struct GpgCheckDef {
-       enum Enum {
-         indeterminate,                //< not specified
-         On,                   //< 1** --gpgcheck
-         Strict,                       //< 111 --gpgcheck-strict
-         AllowUnsigned,                //< 100 --gpgcheck-allow-unsigned
-         AllowUnsignedRepo,    //< 10* --gpgcheck-allow-unsigned-repo
-         AllowUnsignedPackage, //< 1*0 --gpgcheck-allow-unsigned-package
-         Default,              //< *** --default-gpgcheck
-         Off,                  //< 0** --no-gpgcheck
-       };
-      };
-      typedef base::EnumClass<GpgCheckDef> GpgCheck;   ///< 'enum class GpgCheck'
-
-      /** Adjust *GpgCheck settings according to \a mode_r.
-       * \c GpgCheck::indeterminate will leave the settings as they are.
-       * \return whether setting were changed
-       */
-      bool setGpgCheck( GpgCheck mode_r );
-      //@}
-
 
       /** Whether gpgkey URLs are defined */
       bool gpgKeyUrlsEmpty() const;
@@ -412,38 +347,42 @@ namespace zypp
        */
       void setTargetDistribution(const std::string & targetDistribution);
 
+
+      /** Content keywords defined. */
+      const std::set<std::string> & contentKeywords() const;
+
       /** Add content keywords */
       void addContent( const std::string & keyword_r );
       /** \overload add keywords from container */
-      template <class _Iterator>
-      void addContentFrom( _Iterator begin_r, _Iterator end_r )
+      template <class TIterator>
+      void addContentFrom( TIterator begin_r, TIterator end_r )
       { for_( it, begin_r, end_r ) addContent( *it ); }
       /** \overload  */
-      template <class _Container>
-      void addContentFrom( const _Container & container_r )
+      template <class TContainer>
+      void addContentFrom( const TContainer & container_r )
       { addContentFrom( container_r.begin(), container_r.end() ); }
 
       /** Check for content keywords.
-       * Checking for an empty string returns whether content kewords are
-       * known at all. They may be missing due to missing metadata in disabled
-       * repos.
+       * They may be missing due to missing metadata in disabled repos.
        */
-      bool hasContent( const std::string & keyword_r = std::string() ) const;
+      bool hasContent() const;
+      /** \overload check for a keywords being present */
+      bool hasContent( const std::string & keyword_r ) const;
       /** \overload check for \b all keywords being present */
-      template <class _Iterator>
-      bool hasContentAll( _Iterator begin_r, _Iterator end_r ) const
+      template <class TIterator>
+      bool hasContentAll( TIterator begin_r, TIterator end_r ) const
       { for_( it, begin_r, end_r ) if ( ! hasContent( *it ) ) return false; return true; }
       /** \overload  */
-      template <class _Container>
-      bool hasContentAll( const _Container & container_r ) const
+      template <class TContainer>
+      bool hasContentAll( const TContainer & container_r ) const
       { return hasContentAll( container_r.begin(), container_r.end() ); }
       /** \overload check for \b any keyword being present */
-      template <class _Iterator>
-      bool hasContentAny( _Iterator begin_r, _Iterator end_r ) const
+      template <class TIterator>
+      bool hasContentAny( TIterator begin_r, TIterator end_r ) const
       { for_( it, begin_r, end_r ) if ( hasContent( *it ) ) return true; return false; }
       /** \overload  */
-      template <class _Container>
-      bool hasContentAny( const _Container & container_r ) const
+      template <class TContainer>
+      bool hasContentAny( const TContainer & container_r ) const
       { return hasContentAny( container_r.begin(), container_r.end() ); }
 
     public:
@@ -513,8 +452,6 @@ namespace zypp
   /** \relates RepoInfo Stream output */
   std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
 
-  /** \relates RepoInfo::GpgCheck Stream output */
-  std::ostream & operator<<( std::ostream & str, const RepoInfo::GpgCheck & obj );
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp