[yum-commits] urlgrabber/grabber.py urlgrabber/progress.py

zpavlas at osuosl.org zpavlas at osuosl.org
Tue Sep 4 13:37:57 UTC 2012


 urlgrabber/grabber.py  |   19 ++++++++++++-------
 urlgrabber/progress.py |    2 +-
 2 files changed, 13 insertions(+), 8 deletions(-)

New commits:
commit 4c7d0bd8ee6a8b6b9b8c2117e75fda0e3444d9e1
Author: Zdeněk Pavlas <zpavlas at redhat.com>
Date:   Tue Sep 4 14:43:35 2012 +0200

    multi dl: avoid MultiFileHelper.end() on failures.  BZ 854075
    
    - When download fails, call .failure() instead of .end()
      to avoid bumping finished_files.
    
    - Call checkfunc before the above.

diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index f750a62..01218b0 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -2179,10 +2179,19 @@ def parallel_wait(meter=None):
         for opts, size, ug_err in dl.perform():
             key, limit = opts.async
             host_con[key] -= 1
+
+            if ug_err is None:
+                if opts.checkfunc:
+                    try: _run_callback(opts.checkfunc, opts)
+                    except URLGrabError, ug_err: pass
+
             if opts.progress_obj:
                 if opts.multi_progress_obj:
-                    opts.multi_progress_obj.re.total += size - opts.size # correct totals
-                    opts._progress.end(size)
+                    if ug_err:
+                        opts._progress.failure(None)
+                    else:
+                        opts.multi_progress_obj.re.total += size - opts.size # correct totals
+                        opts._progress.end(size)
                     opts.multi_progress_obj.removeMeter(opts._progress)
                 else:
                     opts.progress_obj.start(text=opts.text, now=opts._progress)
@@ -2191,11 +2200,7 @@ def parallel_wait(meter=None):
                 del opts._progress
 
             if ug_err is None:
-                if opts.checkfunc:
-                    try: _run_callback(opts.checkfunc, opts)
-                    except URLGrabError, ug_err: pass
-                if ug_err is None:
-                    continue
+                continue
 
             retry = opts.retry or 0
             if opts.failure_callback:
diff --git a/urlgrabber/progress.py b/urlgrabber/progress.py
index 068017f..077fd99 100644
--- a/urlgrabber/progress.py
+++ b/urlgrabber/progress.py
@@ -611,7 +611,7 @@ class TextMultiFileMeter(MultiFileMeter):
         self._lock.acquire()
         try:
             format = "%-30.30s %6.6s %s"
-            fn = meter.basename
+            fn = meter.text or meter.basename
             if type(message) in (type(''), type(u'')):
                 message = message.splitlines()
             if not message: message = ['']


More information about the Yum-commits mailing list