[yum-cvs] yum/yum __init__.py,1.190,1.191

Paul Nasrat pnasrat at linux.duke.edu
Thu Mar 2 21:34:40 UTC 2006


Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv13459/yum

Modified Files:
	__init__.py 
Log Message:
Cover case if package selected, then group

Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -r1.190 -r1.191
--- __init__.py	2 Mar 2006 15:11:57 -0000	1.190
+++ __init__.py	2 Mar 2006 21:34:38 -0000	1.191
@@ -1380,12 +1380,13 @@
         
         if self.conf.enable_group_conditionals:
             for condreq, cond in thisgroup.conditional_packages.iteritems():
-                if self.rpmdb.installed(name = cond):
+                if self._isPackageInstalled(cond):
                     txmbrs = self.install(name = condreq)
                     txmbrs_used.extend(txmbrs)
                     for txmbr in txmbrs:
                         txmbr.groups.append(thisgroup.groupid)
                     continue
+                # Otherwise we hook into tsInfo.add
                 pkgs = self.pkgSack.searchNevra(name=condreq)
                 if pkgs:
                     pkgs = self.bestPackagesFromList(pkgs)
@@ -1890,3 +1891,19 @@
         
         return returndict
 
+    def _isPackageInstalled(self, pkgname):
+        # FIXME: Taken from anaconda/pirut 
+        # clean up and make public
+        installed = False
+        if self.rpmdb.installed(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
+            return False
+        return installed




More information about the Yum-cvs-commits mailing list