- prepare for messages and scripts
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 23 May 2008 13:53:22 +0000 (13:53 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 23 May 2008 13:53:22 +0000 (13:53 +0000)
- follow conventions for config names
- document settings

zypp.conf
zypp/ZConfig.cc
zypp/ZConfig.h
zypp/target/TargetImpl.cc

index 81d72c8..7e4ebdc 100644 (file)
--- a/zypp.conf
+++ b/zypp.conf
 ## Default value: true
 ##
 # locksfile.apply = true
+
+##
+## Where update items are stored
+## (example: scripts, messages)
+##
+## Valid values: path to directory
+## Default value: /var/afm
+##
+# update.datadir = /var/adm
+
+##
+## Where update messages are stored
+##
+## Valid values: path to directory
+## Default value: {update.datadir}/update-messages
+##
+# update.messagesdir = /var/adm/update-messages
+
+##
+## Where update scripts are stored
+##
+## Valid values: path to directory
+## Default value: {update.datadir}/update-scripts
+##
+# update.scriptsdir = /var/adm/update-scripts
+
+
index 940b1b8..52cec69 100644 (file)
@@ -258,10 +258,19 @@ namespace zypp
                 {
                   apply_locks_file = str::strToBool( value, apply_locks_file );
                 }
+                else if ( entry == "update.datadir" )
+                {
+                  update_data_path = Pathname(value);
+                }
                 else if ( entry == "update.scriptsdir" )
                 {
                   update_scripts_path = Pathname(value);
                 }
+                else if ( entry == "update.messagessdir" )
+                {
+                  update_messages_path = Pathname(value);
+                }
+
               }
             }
           }
@@ -305,7 +314,9 @@ namespace zypp
     Pathname cfg_products_path;
     Pathname locks_file;
 
+    Pathname update_data_path;
     Pathname update_scripts_path;
+    Pathname update_messages_path;
 
     bool repo_add_probe;
     unsigned repo_refresh_delay;
@@ -494,10 +505,23 @@ namespace zypp
     return _pimpl->apply_locks_file;
   }
 
-  Pathname ZConfig::updateScriptsPath() const
+  Pathname ZConfig::update_dataPath() const
+  {
+    return ( _pimpl->update_data_path.empty()
+        ? Pathname("/var/adm") : _pimpl->update_data_path );
+  }
+
+  Pathname ZConfig::update_messagesPath() const
+  {
+    return ( _pimpl->update_messages_path.empty()
+             ? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path );
+  }
+
+
+  Pathname ZConfig::update_scriptsPath() const
   {
     return ( _pimpl->update_scripts_path.empty()
-        ? Pathname("/var/adm/update-scripts") : _pimpl->update_scripts_path );
+             ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
   }
 
   /////////////////////////////////////////////////////////////////
index cedf71e..ad623e7 100644 (file)
@@ -38,6 +38,15 @@ namespace zypp
    * It reads /etc/zypp/zypp.conf, the filename can be overridden by
    * setting the ZYPP_CONF environment variable to a different file.
    *
+   * Note, if you add settings to this file, please follow the following
+   * convention:
+   *
+   * namespace.settingname
+   *
+   * should become
+   *
+   * namespace_settingName()
+   *
    * \ingroup Singleton
   */
   class ZConfig : private base::NonCopyable
@@ -175,10 +184,22 @@ namespace zypp
        */
       bool apply_locks_file() const;
 
-     /**
-       * Path where update scripts are stored
+      /**
+       * Path where the update items are kept (/var/adm)
        */
-      Pathname updateScriptsPath() const;
+      Pathname update_dataPath() const;
+
+     /**
+       * Path where the repo metadata is downloaded and kept (update_dataPath()/).
+        * \ingroup g_ZC_REPOCACHE
+      */
+      Pathname update_scriptsPath() const;
+
+     /**
+       * Path where the repo solv files are created and kept (update_dataPath()/solv).
+        * \ingroup g_ZC_REPOCACHE
+      */
+      Pathname update_messagesPath() const;
 
     public:
       class Impl;
index 8584e7a..4b7b496 100644 (file)
@@ -685,7 +685,7 @@ namespace zypp
             {
               it->status().resetTransact( ResStatus::USER );
              // check for and run an update script
-             RunUpdateScript(ZConfig::instance().updateScriptsPath(), p->name(), p->edition().version(), p->edition().release());
+             RunUpdateScript(ZConfig::instance().update_scriptsPath(), p->name(), p->edition().version(), p->edition().release());
             }
             progress.disconnect();
           }