Imported Upstream version 17.0.0
[platform/upstream/libzypp.git] / zypp / ZConfig.h
index a222594..6114e7b 100644 (file)
@@ -16,7 +16,7 @@
 #include <set>
 #include <string>
 
-#include "zypp/base/Deprecated.h"
+#include "zypp/APIConfig.h"
 #include "zypp/base/NonCopyable.h"
 #include "zypp/base/PtrTypes.h"
 
@@ -24,6 +24,7 @@
 #include "zypp/Locale.h"
 #include "zypp/Pathname.h"
 #include "zypp/IdString.h"
+#include "zypp/TriBool.h"
 
 #include "zypp/DownloadMode.h"
 #include "zypp/target/rpm/RpmFlags.h"
@@ -52,6 +53,7 @@ namespace zypp
    *
    * namespace_settingName()
    *
+   * \ingroup ZyppConfig
    * \ingroup Singleton
   */
   class ZConfig : private base::NonCopyable
@@ -66,7 +68,9 @@ namespace zypp
 
     public:
 
-      /** The target root directory. */
+      /** The target root directory.
+       * Returns an empty path if no target is set.
+       */
       Pathname systemRoot() const;
 
     public:
@@ -106,6 +110,24 @@ namespace zypp
       { setTextLocale( defaultTextLocale() ); }
 
     public:
+      /** \name Maintain user data
+       * \see \ref zypp-userdata
+       */
+      //@{
+      /** Whether a (non empty) user data sting is defined. */
+      bool hasUserData() const;
+
+      /** User defined string value to be passed to log, history, plugins... */
+      std::string userData() const;
+
+      /** Set a new \ref userData string.
+       * \returns \c TRUE if the string was accepted; \c FALSE if the
+       * string was rejected due to nonprintable characters or newlines.
+       */
+      bool setUserData( const std::string & str_r );
+      //@}
+
+    public:
       /**
        * Path where the caches are kept (/var/cache/zypp)
        * \ingroup g_ZC_REPOCACHE
@@ -149,6 +171,13 @@ namespace zypp
       Pathname knownServicesPath() const;
 
       /**
+       * Path containing custom repo variable definitions (configPath()/vars.d).
+       * \see \ref zypp::repo::RepoVarExpand Repo variable expander
+       * \ingroup g_ZC_CONFIGFILES
+       */
+      Pathname varsPath() const;
+
+      /**
        * Whether repository urls should be probed.
        / config option
        * repo.add.probe
@@ -161,6 +190,27 @@ namespace zypp
       unsigned repo_refresh_delay() const;
 
       /**
+       * List of locales for which translated package descriptions should be downloaded.
+       */
+      LocaleSet repoRefreshLocales() const;
+
+      /**
+       * Whether to use repository alias or name in user messages (progress,
+       * exceptions, ...).
+       * True: use alias, false: use name.
+       */
+      bool repoLabelIsAlias() const;
+
+      /**
+       * Whether to use repository alias or name in user messages (progress,
+       * exceptions, ...). Console applications might prefer to use and display
+       * the shorter alias instead of full repository name.
+       *
+       * Default: false; i.e. repo label is 'name'
+       */
+      void repoLabelIsAlias( bool yesno_r );
+
+      /**
        * Maximum number of concurrent connections for a single transfer
        */
       long download_max_concurrent_connections() const;
@@ -181,6 +231,11 @@ namespace zypp
        */
       long download_max_silent_tries() const;
 
+      /**
+       * Maximum time in seconds that you allow a transfer operation to take.
+       */
+      long download_transfer_timeout() const;
+
 
       /** Whether to consider using a deltarpm when downloading a package.
        * Config option <tt>download.use_deltarpm (true)</tt>
@@ -210,11 +265,47 @@ namespace zypp
        */
       void set_default_download_media_prefer_download();
 
+      /** Path where media are preferably mounted or downloaded.
+       * Config option <tt>download.media_mountdir (/var/adm/mount)</tt>
+       * Needs to be a (writable) directory, otherwise /var/tmp is fallback.
+       */
+      Pathname download_mediaMountdir() const;
+      /** Set alternate value. */
+      void set_download_mediaMountdir( Pathname newval_r );
+      /** Reset to zypp.cong default. */
+      void set_default_download_mediaMountdir();
+
       /**
        * Commit download policy to use as default.
        */
       DownloadMode commit_downloadMode() const;
 
+      /** \name Signature checking (repodata and packages)
+       * If \ref gpgcheck is \c on (the default) we will either check the signature
+       * of repo metadata (packages are secured via checksum in the metadata), or the
+       * signature of an rpm package to install if it's repo metadata are not signed
+       * or not checked. If \ref gpgcheck is \c off, no checks are performed.
+       *
+       * The default behavior can be altered by explicitly setting \ref repo_gpgcheck and/or
+       * \ref pkg_gpgcheck to perform those checks always (\c on) or never (\c off).
+       *
+       * Explicitly setting \c gpgcheck, \c repo_gpgcheck or \c pkg_gpgcheck in a
+       * repositories \a .repo file will overwrite the defaults here.
+       */
+      //@{
+      bool gpgCheck() const;                   ///< Turn signature checking on/off (on)
+      TriBool repoGpgCheck() const;            ///< Check repo matadata signatures (indeterminate - according to gpgcheck)
+      TriBool pkgGpgCheck() const;             ///< Check rpm package signatures (indeterminate - according to gpgcheck)
+
+      void setGpgCheck( bool val_r );          ///< Change the value
+      void setRepoGpgCheck( TriBool val_r );   ///< Change the value
+      void setPkgGpgCheck( TriBool val_r );    ///< Change the value
+
+      void resetGpgCheck();                    ///< Reset to the zconfig default
+      void resetRepoGpgCheck();                        ///< Reset to the zconfig default
+      void resetPkgGpgCheck();                 ///< Reset to the zconfig default
+     //@}
+      //
       /**
        * Directory for equivalent vendor definitions  (configPath()/vendors.d)
        * \ingroup g_ZC_CONFIGFILES
@@ -233,10 +324,34 @@ namespace zypp
       Pathname solver_checkSystemFile() const;
 
       /**
+       * Directory, which may or may not contain files in which
+       * dependencies described which has to be fulfilled for a
+       * running system.
+       */
+      Pathname solver_checkSystemFileDir() const;
+
+      /**
        * Whether vendor check is by default enabled.
        */
       bool solver_allowVendorChange() const;
 
+      /** DUP tune: Whether to allow version downgrades upon DUP. */
+      bool solver_dupAllowDowngrade() const;
+
+      /** DUP tune: Whether to follow package renames upon DUP. */
+      bool solver_dupAllowNameChange() const;
+
+      /** DUP tune: Whether to allow package arch changes upon DUP. */
+      bool solver_dupAllowArchChange() const;
+
+      /** DUP tune: Whether to allow package vendor changes upon DUP. */
+      bool solver_dupAllowVendorChange() const;
+
+      /**
+       * Whether removing a package should also remove no longer needed requirements.
+       */
+      bool solver_cleandepsOnRemove() const;
+
       /**
        * When committing a dist upgrade (e.g. <tt>zypper dup</tt>)
        * a solver testcase is written. It is needed in bugreports,
@@ -266,12 +381,18 @@ namespace zypp
       void resetSolverUpgradeRemoveDroppedPackages();
 
       /** \name Packages which can be installed in different versions at the same time.
-       * This returns the config file values (\c names or \c provides:...). For the corresponding
-       * packages use e.g \ref sat::Pool::multiversionBegin, or \ref sat::Solbale::multiversionInstall
-       * (\ref ui::Selectable::multiversionInstall).
+       *
+       * This returns the config file values (\c names or \c provides:...). The
+       * corresponding packages have the \c multiversionInstall property set. Those
+       * packages will be installed using 'rpm -i', so they will not implicitly obsolete
+       * other installed versions.
+       *
+       * \see \ref sat::SolvableType
        */
       //@{
       const std::set<std::string> & multiversionSpec() const;
+      void multiversionSpec( std::set<std::string> new_r );
+      void clearMultiversionSpec();
       void addMultiversionSpec( const std::string & name_r );
       void removeMultiversionSpec( const std::string & name_r );
       //@}
@@ -343,7 +464,6 @@ namespace zypp
        */
       Pathname credentialsGlobalFile() const;
 
-
       /** Package telling the "product version" on systems not using /etc/product.d/baseproduct.
        *
        * On RHEL, Fedora and others the "product version" is determined by the first package
@@ -354,6 +474,14 @@ namespace zypp
        */
       std::string distroverpkg() const;
 
+      /** \name Plugins */
+      //@{
+      /**
+       * Defaults to \c /usr/lib/zypp/plugins
+       */
+      Pathname pluginsPath() const;
+
+      //@}
     public:
       class Impl;
       /** Dtor */