[Yum-devel] [PATCH 1/6] Unlink invalid package files before starting downloads.

Zdeněk Pavlas zpavlas at redhat.com
Wed Jul 13 16:50:33 UTC 2011


---
 yum/__init__.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index e9bc1f9..83973d4 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1955,6 +1955,8 @@ class YumBase(depsolve.Depsolve):
             local = po.localPkg()
             if os.path.exists(local):
                 if not self.verifyPkg(local, po, False):
+                    if os.path.getsize(local) >= po.size:
+                        os.unlink(local)
                     if po.repo.cache:
                         repo_cached = True
                         adderror(po, _('package fails checksum but caching is '
@@ -1996,8 +1998,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