[Yum-devel] [PATCH 1/4] drop 'adderror' arg from presto.rebuild()

Zdenek Pavlas zpavlas at redhat.com
Mon Apr 8 15:08:18 UTC 2013


---
 yum/__init__.py | 6 +++---
 yum/drpm.py     | 9 +++++----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index a5e21fb..d1ab41a 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2256,13 +2256,13 @@ much more problems).
             pkgs.append(po)
 
         # download presto metadata and use drpms
-        presto = DeltaInfo(self, pkgs)
+        presto = DeltaInfo(self, pkgs, adderror)
         deltasize = rpmsize = 0
         for po in pkgs:
             if isinstance(po, DeltaPackage):
                 if verify_local(po):
                     # there's .drpm already, use it
-                    presto.rebuild(po, adderror)
+                    presto.rebuild(po)
                     continue
                 deltasize += po.size
                 rpmsize += po.rpm.size
@@ -2300,7 +2300,7 @@ much more problems).
                         urlgrabber.progress.text_meter_total_size(remote_size,
                                                                   local_size[0])
                     if isinstance(po, DeltaPackage):
-                        presto.rebuild(po, adderror)
+                        presto.rebuild(po)
                         return
                     else:
                         presto.dequeue_max()
diff --git a/yum/drpm.py b/yum/drpm.py
index 45d3a80..d3f296d 100644
--- a/yum/drpm.py
+++ b/yum/drpm.py
@@ -106,8 +106,9 @@ def _num_cpus_online(unknown=1):
     return unknown
 
 class DeltaInfo:
-    def __init__(self, ayum, pkgs):
+    def __init__(self, ayum, pkgs, adderror):
         self.verbose_logger = ayum.verbose_logger
+        self.adderror = adderror
         self.jobs = {}
         self._future_jobs = []
         self.limit = ayum.conf.deltarpm
@@ -243,17 +244,17 @@ class DeltaInfo:
             num += 1
         return num
 
-    def rebuild(self, po, adderror):
+    def rebuild(self, po):
         """ Turn a drpm into an rpm, by adding it to the queue and trying to
             service the queue. """
         # this runs when worker finishes
         def callback(code):
             if code != 0:
                 unlink_f(po.rpm.localpath)
-                adderror(po, _('Delta RPM rebuild failed'))
+                self.adderror(po, _('Delta RPM rebuild failed'))
                 return
             if not po.rpm.verifyLocalPkg():
-                adderror(po, _('Checksum of the delta-rebuilt RPM failed'))
+                self.adderror(po, _('Checksum of the delta-rebuilt RPM failed'))
                 return
             os.unlink(po.localpath)
             po.localpath = po.rpm.localpath # for --downloadonly
-- 
1.7.11.7



More information about the Yum-devel mailing list