[Yum-devel] [PATCH 2/9] package exists && fails to verify && is larger than expected

Zdeněk Pavlas zpavlas at redhat.com
Mon Jun 27 16:01:08 UTC 2011


Unlink it in 1st pass instead of 2nd.
Functionally equivalent.
---
 yum/__init__.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 92f25d4..f094f3b 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1955,6 +1955,8 @@ class YumBase(depsolve.Depsolve):
                         repo_cached = True
                         adderror(po, _('package fails checksum but caching is '
                             'enabled for %s') % po.repo.id)
+                    if os.path.getsize(local) >= po.size:
+                        os.unlink(local)
                 else:
                     self.verbose_logger.debug(_("using local copy of %s") %(po,))
                     continue
@@ -1992,8 +1994,6 @@ class YumBase(depsolve.Depsolve):
                         urlgrabber.progress.text_meter_total_size(remote_size,
                                                                   local_size)
                     continue
-                if os.path.getsize(local) >= po.size:
-                    os.unlink(local)
 
             checkfunc = (self.verifyPkg, (po, 1), {})
             dirstat = os.statvfs(po.repo.pkgdir)
-- 
1.7.4.4



More information about the Yum-devel mailing list