[Yum-devel] [PATCH 3/6] invert the 'if' condition to have the 'continue' branch first.

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


---
 yum/__init__.py |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 8c75879..3778e27 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1953,19 +1953,18 @@ 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:
-                        adderror(po, _('package fails checksum but caching is '
-                            'enabled for %s') % po.repo.id)
-                        # caching is enabled and the package 
-                        # just failed to check out there's no 
-                        # way to save this, report the error and return
-                        return errors
-                else:
+                if self.verifyPkg(local, po, False):
                     self.verbose_logger.debug(_("using local copy of %s") %(po,))
                     continue
+                if os.path.getsize(local) >= po.size:
+                    os.unlink(local)
+                if po.repo.cache:
+                    adderror(po, _('package fails checksum but caching is '
+                        'enabled for %s') % po.repo.id)
+                    # caching is enabled and the package 
+                    # just failed to check out there's no 
+                    # way to save this, report the error and return
+                    return errors
 
             remote_pkgs.append(po)
             remote_size += po.size
-- 
1.7.4.4



More information about the Yum-devel mailing list