[yum-cvs] yum/yum __init__.py,1.167,1.168 repos.py,1.86,1.87

Seth Vidal skvidal at linux.duke.edu
Tue Dec 13 06:16:05 UTC 2005


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

Modified Files:
	__init__.py repos.py 
Log Message:

make yum groupinstall work again
remove unnecessary recreation of comps object


Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -r1.167 -r1.168
--- __init__.py	11 Dec 2005 00:38:38 -0000	1.167
+++ __init__.py	13 Dec 2005 06:16:03 -0000	1.168
@@ -324,6 +324,10 @@
         self.log(3, 'Getting group metadata')
         reposWithGroups = []
         for repo in self.repos.listGroupsEnabled():
+            if repo.groups_added: # already added the groups from this repo
+                reposWithGroups.append(repo)
+                continue
+                
             if repo.repoXML is None:
                 raise Errors.RepoError, "Repository '%s' not yet setup" % repo
             try:
@@ -335,15 +339,21 @@
                 
         # now we know which repos actually have groups files.
         overwrite = self.conf.overwrite_groups
-        self.comps = comps.Comps(overwrite_groups = overwrite)
+        if not hasattr(self, 'comps'):
+            self.comps = comps.Comps(overwrite_groups = overwrite)
 
         for repo in reposWithGroups:
+            if repo.groups_added: # already added the groups from this repo
+                continue
+                
             self.log(4, 'Adding group file from repository: %s' % repo)
             groupfile = repo.getGroups()
             try:
                 self.comps.add(groupfile)
             except Errors.GroupsError, e:
                 self.errorlog(0, 'Failed to add groups file for repository: %s' % repo)
+            else:
+                repo.groups_added = True
 
         if self.comps.compscount == 0:
             raise Errors.GroupsError, 'No Groups Available in any repository'
@@ -1233,7 +1243,7 @@
         if not self.comps:
             self.doGroupSetup()
         
-        if not self.comps.has_grou(grpid):
+        if not self.comps.has_group(grpid):
             raise Errors.GroupsError, "No Group named %s exists" % grpid
             
         thisgroup = self.comps.return_group(grpid)
@@ -1248,8 +1258,11 @@
             
         
     def selectGroup(self, grpid):
-        """mark all the packages in the group to be installed"""
+        """mark all the packages in the group to be installed
+           returns a list of transaction members it added to the transaction 
+           set"""
         
+        txmbrs_used = []
         if not self.comps:
             self.doGroupSetup()
         
@@ -1262,7 +1275,7 @@
             raise Errors.GroupsError, "No Group named %s exists" % grpid
         
         if thisgroup.selected:
-            return 
+            return txmbrs_used
         
         thisgroup.selected = True
         
@@ -1274,8 +1287,11 @@
             except Errors.InstallError, e:
                 self.log(3, 'No package named %s available to be installed' % pkg)
             else:
+                txmbrs_used.extend(txmbrs)
                 for txmbr in txmbrs:
                     txmbr.groups.append(thisgroup.groupid)
+        
+        return txmbrs_used
 
     def deselectGroup(self, grpid):
         """de-mark all the packages in the group for install"""
@@ -1546,6 +1562,8 @@
                 pkgs = self.bestPackagesFromList(pkgs)
 
         if len(pkgs) == 0:
+            #FIXME - this is where we could check to see if it already installed
+            # for returning better errors
             raise Errors.InstallError, 'No package(s) available to install'
         
         # FIXME - lots more checking here

Index: repos.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/repos.py,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- repos.py	6 Nov 2005 21:59:45 -0000	1.86
+++ repos.py	13 Dec 2005 06:16:03 -0000	1.87
@@ -343,6 +343,7 @@
         self.proxy = None
         self.proxy_dict = {}
         self.metadata_cookie_fn = 'cachecookie'
+        self.groups_added = False
         
         # throw in some stubs for things that will be set by the config class
         self.basecachedir = ""




More information about the Yum-cvs-commits mailing list