[yum-commits] yum/__init__.py

zpavlas at osuosl.org zpavlas at osuosl.org
Thu May 16 08:02:51 UTC 2013


 yum/__init__.py |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 9c2e6e444d07a23cd827c78cae5a70483113d04f
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Wed May 15 12:40:27 2013 +0200

    drpm retry: add RPM sizes to total size.  BZ 959786
    
    Move the callback_total call out of the retry loop.
    Don't reset remote_size and beg_download when retrying.

diff --git a/yum/__init__.py b/yum/__init__.py
index 50e2fad..6810b0e 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2319,6 +2319,8 @@ much more problems).
             self.closeRpmDB()
             self.doUnlock()
 
+        beg_download = time.time()
+        all_remote_pkgs = remote_pkgs
         while True:
             remote_pkgs.sort(mediasort)
             #  This is kind of a hack and does nothing in non-Fedora versions,
@@ -2326,7 +2328,6 @@ much more problems).
             if (hasattr(urlgrabber.progress, 'text_meter_total_size') and
                 len(remote_pkgs) > 1):
                 urlgrabber.progress.text_meter_total_size(remote_size)
-            beg_download = time.time()
             i = 0
             local_size = [0]
             done_repos = set()
@@ -2380,8 +2381,6 @@ much more problems).
 
             if hasattr(urlgrabber.progress, 'text_meter_total_size'):
                 urlgrabber.progress.text_meter_total_size(0)
-            if callback_total is not None and not errors:
-                callback_total(remote_pkgs, remote_size, beg_download)
 
             if downloadonly:
                 for po in remote_pkgs:
@@ -2409,13 +2408,16 @@ much more problems).
 
             # there were drpm related errors *only*
             remote_pkgs = []
-            remote_size = 0
             for po in errors:
                 po = po.rpm
                 remote_pkgs.append(po)
                 remote_size += po.size
+            # callback_total needs the total pkg count
+            all_remote_pkgs.extend(remote_pkgs)
             errors.clear()
             self.verbose_logger.warn(_('Some delta RPMs failed to download or rebuild. Retrying..'))
+        if callback_total and not errors:
+            callback_total(all_remote_pkgs, remote_size, beg_download)
 
         if not downloadonly:
             # XXX: Run unlocked?  Skip this for now..


More information about the Yum-commits mailing list