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

zpavlas at osuosl.org zpavlas at osuosl.org
Mon Mar 4 15:21:46 UTC 2013


 docs/yum.conf.5 |   16 ++++++++++++++--
 yum/config.py   |    2 ++
 yum/drpm.py     |   12 +++++++-----
 3 files changed, 23 insertions(+), 7 deletions(-)

New commits:
commit ec0974eaaf82fe177f5215bd54321a3acd7090bb
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Mon Mar 4 10:27:59 2013 +0100

    add deltarpm_percentage config option, update documentation

diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index f9a924a..850b8be 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -378,6 +378,12 @@ When non-zero, delta-RPM files are used if available.  The value specifies
 the maximum number of "applydeltarpm" processes Yum will spawn. (4 by default).
 
 .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).
+
+.IP
 \fBsslcacert \fR
 Path to the directory containing the databases of the certificate authorities
 yum should use to verify SSL certificates. Defaults to none - uses system
@@ -937,12 +943,18 @@ Overrides the \fBip_resolve\fR option from the [main] section for this
 repository.
 
 .IP
-\fBpresto\fR
+\fBdeltarpm\fR
 
-Overrides the \fBpresto\fR option from the [main] section for this
+Overrides the \fBdeltarpm\fR option from the [main] section for this
 repository.
 
 .IP
+\fBdeltarpm_percentage\fR
+
+Overrides the \fBdeltarpm_percentage\fR option from the [main] section
+for this repository.
+
+.IP
 \fBsslcacert \fR
 Overrides the \fBsslcacert\fR option from the [main] section for this
 repository.
diff --git a/yum/config.py b/yum/config.py
index d2ca937..c93e143 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -792,6 +792,7 @@ class YumConf(StartupConf):
             mapper  = {'4': 'ipv4', '6': 'ipv6'})
     max_connections = IntOption(0)
     deltarpm = IntOption(4)
+    deltarpm_percentage = IntOption(75, range_min=1, range_max=100)
 
     http_caching = SelectionOption('all', ('none', 'packages', 'all'))
     metadata_expire = SecondsOption(60 * 60 * 6) # Time in seconds (6h).
@@ -951,6 +952,7 @@ class RepoConf(BaseConfig):
     timeout = Inherit(YumConf.timeout)
     ip_resolve = Inherit(YumConf.ip_resolve)
     deltarpm = Inherit(YumConf.deltarpm)
+    deltarpm_percentage = Inherit(YumConf.deltarpm_percentage)
 
     http_caching = Inherit(YumConf.http_caching)
     metadata_expire = Inherit(YumConf.metadata_expire)
diff --git a/yum/drpm.py b/yum/drpm.py
index 5b37c51..8536e4b 100644
--- a/yum/drpm.py
+++ b/yum/drpm.py
@@ -137,7 +137,7 @@ class DeltaInfo:
                 index = pinfo_repo.get(new)
                 if index is not None:
                     po = pkgs[index]
-                    best = po.size * 0.75 # make this configurable?
+                    best = po.size * (repo.deltarpm_percentage / 100.0)
                     have = installed(new[:2]) or []
                     for el in el.findall('delta'):
                         size = int(el.find('size').text)
commit f079b2d41d57b3a1dbb1a8e04b3f3adc2961e927
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Mon Mar 4 10:25:11 2013 +0100

    drpm: update comment, cleanup

diff --git a/yum/drpm.py b/yum/drpm.py
index 9c1629f..5b37c51 100644
--- a/yum/drpm.py
+++ b/yum/drpm.py
@@ -25,7 +25,7 @@ from misc import checksum, repo_gen_decompress
 from urlgrabber import grabber
 async = hasattr(grabber, 'parallel_wait')
 from xml.etree.cElementTree import iterparse
-import os, gzip
+import os
 
 APPLYDELTA = '/usr/bin/applydeltarpm'
 
@@ -126,7 +126,7 @@ class DeltaInfo:
                 (po.epoch, po.version, po.release)
                 for po in ayum.rpmdb.searchNevra(n, None, None, None, a)]
 
-        # parse metadata, populate self.deltas
+        # parse metadata, create DeltaPackage instances
         for repo, cpath in mdpath.items():
             pinfo_repo = pinfo[repo]
             path = repo_gen_decompress(cpath, 'prestodelta.xml',
@@ -165,9 +165,11 @@ class DeltaInfo:
         # this runs when worker finishes
         def callback(code):
             if code != 0:
-                return adderror(po, _('Delta RPM rebuild failed'))
+                adderror(po, _('Delta RPM rebuild failed'))
+                return
             if not po.rpm.verifyLocalPkg():
-                return adderror(po, _('Checksum of the delta-rebuilt RPM failed'))
+                adderror(po, _('Checksum of the delta-rebuilt RPM failed'))
+                return
             os.unlink(po.localpath)
             po.localpath = po.rpm.localpath # for --downloadonly
 


More information about the Yum-commits mailing list