[Yum-devel] [PATCH 3/3] Minor speedup/cleanup for isPkgInstalled().

James Antill james at and.org
Sun Oct 18 04:11:40 UTC 2009


---
 yum/depsolve.py |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 5e855d5..d9b5e6f 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -985,19 +985,20 @@ class Depsolve(object):
 
 
     def isPackageInstalled(self, pkgname):
-        installed = False
-        if self.rpmdb.contains(name=pkgname):
-            installed = True
-
         lst = self.tsInfo.matchNaevr(name = pkgname)
         for txmbr in lst:
             if txmbr.output_state in TS_INSTALL_STATES:
                 return True
-        if installed and len(lst) > 0:
-            # if we get here, then it was installed, but it's in the tsInfo
-            # for an erase or obsoleted --> not going to be installed at end
+
+        if len(lst) > 0:
+            # if we get here then it's in the tsInfo for an erase or obsoleted
+            #  --> not going to be installed
             return False
-        return installed
+
+        if not self.rpmdb.contains(name=pkgname):
+            return False
+
+        return True
     _isPackageInstalled = isPackageInstalled
 
     def _compare_providers(self, pkgs, reqpo):
-- 
1.6.2.5



More information about the Yum-devel mailing list