From 8af81599612cf9e2db97d1f6fe981ffe657b698f Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Thu, 2 Oct 2008 17:50:07 +0000 Subject: [PATCH] - Add zypp.conf option 'download.use_deltarpm_always' to enable using delta rpms even if the package is available on a local source. (Axel C. Frinke) --- package/libzypp.changes | 10 +++++++++- zypp.conf | 9 +++++++++ zypp/ZConfig.cc | 14 +++++++++++--- zypp/ZConfig.h | 12 +++++++++--- zypp/repo/PackageProvider.cc | 16 ++++++++++------ 5 files changed, 48 insertions(+), 13 deletions(-) diff --git a/package/libzypp.changes b/package/libzypp.changes index 03e0529..5db35b8 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,9 +1,17 @@ ------------------------------------------------------------------- +Thu Oct 2 19:46:13 CEST 2008 - ma@suse.de + +- Add zypp.conf option 'download.use_deltarpm_always' to enable using + delta rpms even if the package is available on a local source. + (Axel C. Frinke) +- revision 11235 +- version 5.14.0 (13) + +------------------------------------------------------------------- Thu Oct 2 18:50:11 CEST 2008 - ma@suse.de - Add product attribute: PRODUCTLINE. - revision 11234 -- version 5.14.0 (13) ------------------------------------------------------------------- Thu Oct 2 17:18:19 CEST 2008 - ma@suse.de diff --git a/zypp.conf b/zypp.conf index b3249f6..feb2e46 100644 --- a/zypp.conf +++ b/zypp.conf @@ -135,6 +135,15 @@ ## # download.use_deltarpm = true +## +## Whether to consider using a deltarpm even when rpm is local +## +## Valid values: boolean +## Default value: false +## +## This option has no effect unless download.use_deltarpm is set true. +## +# download.use_deltarpm_always = false ## ## Defining directory which contains vendor description files. diff --git a/zypp/ZConfig.cc b/zypp/ZConfig.cc index d5876af..f4cb3a7 100644 --- a/zypp/ZConfig.cc +++ b/zypp/ZConfig.cc @@ -147,6 +147,7 @@ namespace zypp , repo_add_probe ( false ) , repo_refresh_delay ( 10 ) , download_use_deltarpm ( true ) + , download_use_deltarpm_always ( false ) , solver_onlyRequires ( false ) , apply_locks_file ( true ) @@ -233,6 +234,10 @@ namespace zypp { download_use_deltarpm = str::strToBool( value, download_use_deltarpm ); } + else if ( entry == "download.use_deltarpm_always" ) + { + download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always ); + } else if ( entry == "vendordir" ) { cfg_vendor_path = Pathname(value); @@ -288,11 +293,11 @@ namespace zypp } else if ( entry == "credentials.global.dir" ) { - credentials_global_dir_path = Pathname(value); + credentials_global_dir_path = Pathname(value); } else if ( entry == "credentials.global.file" ) { - credentials_global_file_path = Pathname(value); + credentials_global_file_path = Pathname(value); } } } @@ -346,6 +351,7 @@ namespace zypp unsigned repo_refresh_delay; bool download_use_deltarpm; + bool download_use_deltarpm_always; bool solver_onlyRequires; Pathname solver_checkSystemFile; @@ -355,7 +361,7 @@ namespace zypp bool apply_locks_file; target::rpm::RpmInstFlags rpmInstallFlags; - + Pathname history_log_path; Pathname credentials_global_dir_path; Pathname credentials_global_file_path; @@ -525,6 +531,8 @@ namespace zypp bool ZConfig::download_use_deltarpm() const { return _pimpl->download_use_deltarpm; } + bool ZConfig::download_use_deltarpm_always() const + { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; } bool ZConfig::solver_onlyRequires() const { return _pimpl->solver_onlyRequires; } diff --git a/zypp/ZConfig.h b/zypp/ZConfig.h index 110cbdf..df39321 100644 --- a/zypp/ZConfig.h +++ b/zypp/ZConfig.h @@ -155,6 +155,12 @@ namespace zypp */ bool download_use_deltarpm() const; + /** Whether to consider using a deltarpm even when rpm is local. + * This requires \ref download_use_deltarpm being \c true. + * Config option download.use_deltarpm_always (false) + */ + bool download_use_deltarpm_always() const; + /** * Directory for equivalent vendor definitions (configPath()/vendors.d) * \ingroup g_ZC_CONFIGFILES @@ -228,16 +234,16 @@ namespace zypp /** * Path where ZYpp install history is logged. Defaults to * /var/log/zypp/history. - * + * * \see http://en.opensuse.org/Libzypp/Package_History */ Pathname historyLogFile() const; - + /** * Defaults to /etc/zypp/credentials.d */ Pathname credentialsGlobalDir() const; - + /** * Defaults to /etc/zypp/credentials.cat */ diff --git a/zypp/repo/PackageProvider.cc b/zypp/repo/PackageProvider.cc index 9e23899..e5b6a04 100644 --- a/zypp/repo/PackageProvider.cc +++ b/zypp/repo/PackageProvider.cc @@ -20,6 +20,7 @@ #include "zypp/repo/Applydeltarpm.h" #include "zypp/repo/PackageDelta.h" +#include "zypp/TmpPath.h" #include "zypp/ZConfig.h" #include "zypp/RepoInfo.h" #include "zypp/media/MediaManager.h" @@ -128,7 +129,7 @@ namespace zypp url = * info.baseUrlsBegin(); // check whether to process patch/delta rpms - if ( MediaManager::downloads(url) ) + if ( MediaManager::downloads(url) || ZConfig::instance().download_use_deltarpm_always() ) { std::list deltaRpms; if ( ZConfig::instance().download_use_deltarpm() ) @@ -196,11 +197,14 @@ namespace zypp } Pathname destination( Pathname::dirname( delta ) / defRpmFileName( _package ) ); - /* just to ease testing with non remote sources */ - // FIXME removed API - //if ( ! _package->source().remote() ) - // destination = Pathname("/tmp") / defRpmFileName( _package ); - /**/ + + if ( ! delta.getDispose() ) + { + // There is no cleanup method associated with the deta. Thus the + // delta is not a temporary file, and we don't want to write in + // the package into this directory. + destination = filesystem::TmpPath::defaultLocation() / defRpmFileName( _package ); + } if ( ! applydeltarpm::provide( delta, destination, bind( &PackageProvider::progressDeltaApply, this, _1 ) ) ) -- 2.7.4