Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / ZConfig.h
index 9b73393..84b3905 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,7 +24,9 @@
 #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"
 
 ///////////////////////////////////////////////////////////////////
@@ -51,6 +53,7 @@ namespace zypp
    *
    * namespace_settingName()
    *
+   * \ingroup ZyppConfig
    * \ingroup Singleton
   */
   class ZConfig : private base::NonCopyable
@@ -65,6 +68,13 @@ namespace zypp
 
     public:
 
+      /** The target root directory.
+       * Returns an empty path if no target is set.
+       */
+      Pathname systemRoot() const;
+
+    public:
+
       /** The autodetected system architecture. */
       static Arch defaultSystemArchitecture();
 
@@ -100,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
@@ -155,6 +183,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;
@@ -175,6 +224,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>
@@ -188,17 +242,50 @@ namespace zypp
       bool download_use_deltarpm_always() const;
 
       /**
-       * Directory for equivalent vendor definitions  (configPath()/vendors.d)
-       * \ingroup g_ZC_CONFIGFILES
+       * Hint which media to prefer when installing packages (download vs. CD).
+       * \see class \ref media::MediaPriority
        */
-      Pathname vendorPath() const;
+      bool download_media_prefer_download() const;
+      /** \overload */
+      bool download_media_prefer_volatile() const
+      { return ! download_media_prefer_download(); }
+      /**
+       * Set \ref download_media_prefer_download to a specific value.
+       */
+      void set_download_media_prefer_download( bool yesno_r );
+      /**
+       * Set \ref download_media_prefer_download to the configfiles default.
+       */
+      void set_default_download_media_prefer_download();
+
+      /**
+       * 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)
+      //@}
+      //
       /**
-       * Directory for additional product information  (configPath()/products.d)
+       * Directory for equivalent vendor definitions  (configPath()/vendors.d)
        * \ingroup g_ZC_CONFIGFILES
-       * \deprecated This locations is no longer used or supported.
        */
-      Pathname productsPath() const ZYPP_DEPRECATED;
+      Pathname vendorPath() const;
 
       /**
        * Solver regards required packages,patterns,... only
@@ -212,12 +299,55 @@ namespace zypp
       Pathname solver_checkSystemFile() const;
 
       /**
-       * Packages which can be installed parallel with different versions
-       * Returning a set of package names (IdString)
+       * Whether vendor check is by default enabled.
        */
-      std::set<IdString> multiversion() const;
-      void addMultiversion(std::string &name);
-      bool removeMultiversion(std::string &name);
+      bool solver_allowVendorChange() 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,
+       * in case something went wrong. This returns the number of
+       * testcases to keep on the system. Old cases will be deleted,
+       * as new ones are created. Use \c 0 to write no testcase at all.
+       */
+      unsigned solver_upgradeTestcasesToKeep() const;
+
+      /** Whether dist upgrade should remove a products dropped packages (true).
+       *
+       * A new product may suggest a list of old and no longer supported
+       * packages (dropped packages). Performing a dist upgrade the solver
+       * may try to delete them, even if they do not cause any dependency
+       * problem.
+       *
+       * Turning this option off, the solver will not try to remove those
+       * packages unless they actually do cause dependency trouble. At any
+       * time you may use zypper to detect orphaned packages, and do the
+       * cleanup manually. Or simply leave them installed as long as you don't
+       * need the disk space.
+       */
+      bool solverUpgradeRemoveDroppedPackages() const;
+      /** Set \ref solverUpgradeRemoveDroppedPackages to \a val_r. */
+      void setSolverUpgradeRemoveDroppedPackages( bool val_r );
+      /** Reset \ref solverUpgradeRemoveDroppedPackages to the \c zypp.conf default. */
+      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).
+       */
+      //@{
+      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 );
+      //@}
 
       /**
        * Path where zypp can find or create lock file (configPath()/locks)
@@ -247,6 +377,16 @@ namespace zypp
       */
       Pathname update_messagesPath() const;
 
+      /** \name Command to be invoked to send update messages. */
+      //@{
+      /** Command definition for sending update messages.*/
+      std::string updateMessagesNotify() const;
+      /** Set a new command definition (see update.messages.notify in zypp.conf). */
+      void setUpdateMessagesNotify( const std::string & val_r );
+      /** Reset to the zypp.conf default. */
+      void resetUpdateMessagesNotify();
+     //@}
+
       /** \name Options for package installation */
       //@{
       /** The default \ref target::rpm::RpmInstFlags for \ref ZYppCommitPolicy.
@@ -276,6 +416,24 @@ 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
+       * providing 'redhat-release'. This value is not hardcoded in YUM and can be configured
+       * with the $distroverpkg variable.
+       *
+       * Defaults to 'redhat-release'.
+       */
+      std::string distroverpkg() const;
+
+      /** \name Plugins */
+      //@{
+      /**
+       * Defaults to \c /usr/lib/zypp/plugins
+       */
+      Pathname pluginsPath() const;
+
+      //@}
     public:
       class Impl;
       /** Dtor */