ref: refs/heads/ma-misc
commit 8cf32361a98314b7e12be00040d4d496ff53719f
Author: Michael Andres
Date: Fri Sep 11 15:12:07 2009 +0200
Add zypp.conf option commit.downloadMode to set the default commit download policy.
---
zypp.conf | 22 ++++++++++++++++++++++
zypp/ZConfig.cc | 10 ++++++++++
zypp/ZConfig.h | 6 ++++++
zypp/ZYppCommitPolicy.cc | 2 +-
4 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/zypp.conf b/zypp.conf
index 7121341..32c1b44 100644
--- a/zypp.conf
+++ b/zypp.conf
@@ -197,6 +197,28 @@
## download.media_preference = download
##
+## Commit download policy to use as default.
+##
+## DownloadOnly, Just download all packages to the local cache.
+## Do not install. Implies a dry-run.
+##
+## DownloadInAdvance, First download all packages to the local cache.
+## Then start to install.
+##
+## DownloadInHeaps, Similar to DownloadInAdvance, but try to split
+## the transaction into heaps, where at the end of
+## each heap a consistent system state is reached.
+##
+## DownloadAsNeeded Alternating download and install. Packages are
+## cached just to avid CD/DVD hopping. This is the
+## traditional behaviour.
+##
+## <UNSET> If a value is not set, empty or unknown, we pick
+## some save default.
+##
+## commit.downloadMode =
+
+##
## Defining directory which contains vendor description files.
##
## One file in this directory reflects a group of equivalent vendors. e.G.:
diff --git a/zypp/ZConfig.cc b/zypp/ZConfig.cc
index 299ee31..69cab62 100644
--- a/zypp/ZConfig.cc
+++ b/zypp/ZConfig.cc
@@ -318,6 +318,12 @@ namespace zypp
{
str::strtonum(value, download_max_silent_tries);
}
+ else if ( entry == "commit.downloadMode" )
+ {
+ INT << value << endl;
+ INT << deserializeDownloadMode(value) << endl;
+ commit_downloadMode.set( deserializeDownloadMode( value ) );
+ }
else if ( entry == "vendordir" )
{
cfg_vendor_path = Pathname(value);
@@ -444,6 +450,8 @@ namespace zypp
int download_max_download_speed;
int download_max_silent_tries;
+ Option commit_downloadMode;
+
Option solver_onlyRequires;
Option solver_allowVendorChange;
Option solver_upgradeTestcasesToKeep;
@@ -650,6 +658,8 @@ namespace zypp
long ZConfig::download_max_silent_tries() const
{ return _pimpl->download_max_silent_tries; }
+ DownloadMode ZConfig::commit_downloadMode() const
+ { return _pimpl->commit_downloadMode.get(); }
bool ZConfig::solver_onlyRequires() const
{ return _pimpl->solver_onlyRequires.get(); }
diff --git a/zypp/ZConfig.h b/zypp/ZConfig.h
index a2f4e11..cec14a0 100644
--- a/zypp/ZConfig.h
+++ b/zypp/ZConfig.h
@@ -25,6 +25,7 @@
#include "zypp/Pathname.h"
#include "zypp/IdString.h"
+#include "zypp/DownloadMode.h"
#include "zypp/target/rpm/RpmFlags.h"
///////////////////////////////////////////////////////////////////
@@ -210,6 +211,11 @@ namespace zypp
void set_default_download_media_prefer_download();
/**
+ * Commit download policy to use as default.
+ */
+ DownloadMode commit_downloadMode() const;
+
+ /**
* Directory for equivalent vendor definitions (configPath()/vendors.d)
* \ingroup g_ZC_CONFIGFILES
*/
diff --git a/zypp/ZYppCommitPolicy.cc b/zypp/ZYppCommitPolicy.cc
index bab2ea8..8527486 100644
--- a/zypp/ZYppCommitPolicy.cc
+++ b/zypp/ZYppCommitPolicy.cc
@@ -33,7 +33,7 @@ namespace zypp
Impl()
: _restrictToMedia ( 0 )
, _dryRun ( false )
- , _downloadMode ( DownloadDefault )
+ , _downloadMode ( ZConfig::instance().commit_downloadMode() )
, _rpmInstFlags ( ZConfig::instance().rpmInstallFlags() )
, _syncPoolAfterCommit ( true )
{}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org