From b2f05458689a822cd7a90769d1b61d367416883b Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Fri, 23 May 2008 13:53:22 +0000 Subject: [PATCH] - prepare for messages and scripts - follow conventions for config names - document settings --- zypp.conf | 27 +++++++++++++++++++++++++++ zypp/ZConfig.cc | 28 ++++++++++++++++++++++++++-- zypp/ZConfig.h | 27 ++++++++++++++++++++++++--- zypp/target/TargetImpl.cc | 2 +- 4 files changed, 78 insertions(+), 6 deletions(-) diff --git a/zypp.conf b/zypp.conf index 81d72c8..7e4ebdc 100644 --- a/zypp.conf +++ b/zypp.conf @@ -187,3 +187,30 @@ ## 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 + + diff --git a/zypp/ZConfig.cc b/zypp/ZConfig.cc index 940b1b8..52cec69 100644 --- a/zypp/ZConfig.cc +++ b/zypp/ZConfig.cc @@ -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 ); } ///////////////////////////////////////////////////////////////// diff --git a/zypp/ZConfig.h b/zypp/ZConfig.h index cedf71e..ad623e7 100644 --- a/zypp/ZConfig.h +++ b/zypp/ZConfig.h @@ -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; diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc index 8584e7a..4b7b496 100644 --- a/zypp/target/TargetImpl.cc +++ b/zypp/target/TargetImpl.cc @@ -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(); } -- 2.7.4