- Add zypp.conf option 'download.use_deltarpm_always' to enable using
authorMichael Andres <ma@suse.de>
Thu, 2 Oct 2008 17:50:07 +0000 (17:50 +0000)
committerMichael Andres <ma@suse.de>
Thu, 2 Oct 2008 17:50:07 +0000 (17:50 +0000)
  delta rpms even if the package is available on a local source.
  (Axel C. Frinke)

package/libzypp.changes
zypp.conf
zypp/ZConfig.cc
zypp/ZConfig.h
zypp/repo/PackageProvider.cc

index 03e0529..5db35b8 100644 (file)
@@ -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
index b3249f6..feb2e46 100644 (file)
--- a/zypp.conf
+++ b/zypp.conf
 ##
 # 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.
index d5876af..f4cb3a7 100644 (file)
@@ -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; }
index 110cbdf..df39321 100644 (file)
@@ -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 <tt>download.use_deltarpm_always (false)</tt>
+       */
+      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
        */
index 9e23899..e5b6a04 100644 (file)
@@ -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<DeltaRpm> 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 ) ) )