[yum-commits] docs/yum.conf.5 yum/config.py yum/drpm.py

zpavlas at osuosl.org zpavlas at osuosl.org
Tue Sep 17 07:31:49 UTC 2013


 docs/yum.conf.5 |    4 ++--
 yum/config.py   |    4 ++--
 yum/drpm.py     |   13 +++++++++++--
 3 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit b892cc3c29eee71ad219d5a7c4b6a6b99800cf21
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Mon Sep 16 13:37:20 2013 +0200

    Disable drpms for local repositories. BZ 1007097
    
    - Change the "off" value from 1% to 0%
    - Default is 0 for file:// repos, [main] value otherwise.
    - Update docs.

diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index 90da81f..cb7ab14 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -401,9 +401,10 @@ slower).
 
 .IP
 \fBdeltarpm_percentage\fR
-
 When the relative size of delta vs pkg is larger than this, delta is not used.
 Default value is 75 (Deltas must be at least 25% smaller than the pkg).
+Use `0' to turn off delta rpm processing. Local repositories (with file://
+baseurl) have delta rpms turned off by default.
 
 .IP
 \fBsslcacert \fR
@@ -1018,7 +1019,6 @@ repository.
 
 .IP
 \fBdeltarpm_percentage\fR
-
 Overrides the \fBdeltarpm_percentage\fR option from the [main] section
 for this repository.
 
diff --git a/yum/config.py b/yum/config.py
index 3bc5bd1..52e539d 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -802,7 +802,7 @@ class YumConf(StartupConf):
             mapper  = {'4': 'ipv4', '6': 'ipv6'})
     max_connections = IntOption(0, range_min=0)
     deltarpm = IntOption(2, range_min=-16, range_max=128)
-    deltarpm_percentage = IntOption(75, range_min=1, range_max=100)
+    deltarpm_percentage = IntOption(75, range_min=0, range_max=100)
 
     http_caching = SelectionOption('all', ('none', 'packages', 'all'))
     metadata_expire = SecondsOption(60 * 60 * 6) # Time in seconds (6h).
@@ -971,7 +971,7 @@ class RepoConf(BaseConfig):
     throttle = Inherit(YumConf.throttle)
     timeout = Inherit(YumConf.timeout)
     ip_resolve = Inherit(YumConf.ip_resolve)
-    deltarpm_percentage = Inherit(YumConf.deltarpm_percentage)
+    deltarpm_percentage = IntOption(None, range_min=0, range_max=100)
 
     http_caching = Inherit(YumConf.http_caching)
     metadata_expire = Inherit(YumConf.metadata_expire)
diff --git a/yum/drpm.py b/yum/drpm.py
index 2e23241..d00cf1c 100644
--- a/yum/drpm.py
+++ b/yum/drpm.py
@@ -128,7 +128,13 @@ class DeltaInfo:
         pinfo = {}
         reposize = {}
         for index, po in enumerate(pkgs):
-            if po.repo.deltarpm_percentage == 1:
+            perc = po.repo.deltarpm_percentage
+            if perc is None:
+                urls = po.repo.urls
+                perc = ayum.conf.deltarpm_percentage
+                if len(urls) == 1 and urls[0].startswith('file:'):
+                    perc = 0 # for local repos, default to off.
+            if perc == 0:
                 continue # Allow people to turn off a repo. (meh)
             if po.state == TS_UPDATE: pass
             elif po.name in ayum.conf.installonlypkgs: pass
@@ -193,7 +199,10 @@ class DeltaInfo:
                 index = pinfo_repo.get(new)
                 if index is not None:
                     po = pkgs[index]
-                    best = po.size * (repo.deltarpm_percentage / 100.0)
+                    perc = repo.deltarpm_percentage
+                    if perc is None:
+                        perc = ayum.conf.deltarpm_percentage
+                    best = po.size * (perc / 100.0)
                     have = oldrpms.get(repo, {}).get((name, arch), {})
                     for el in el.findall('delta'):
                         size = int(el.find('size').text)


More information about the Yum-commits mailing list