[yum-cvs] yum/yum __init__.py,1.139,1.140 newcomps.py,1.2,1.3
Seth Vidal
skvidal at login.linux.duke.edu
Tue Oct 25 15:07:02 UTC 2005
Update of /home/groups/yum/cvs/yum/yum
In directory login:/tmp/cvs-serv20603/yum
Modified Files:
__init__.py newcomps.py
Log Message:
make grouplist work.
Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- __init__.py 25 Oct 2005 12:28:44 -0000 1.139
+++ __init__.py 25 Oct 2005 15:07:00 -0000 1.140
@@ -322,7 +322,11 @@
if self.comps.compscount == 0:
raise Errors.GroupsError, 'No Groups Available in any repository'
-
+
+ self.doRpmDBSetup()
+ pkglist = self.rpmdb.getPkgList()
+ self.comps.compile(pkglist)
+
def buildTransaction(self):
"""go through the packages in the transaction set, find them in the
@@ -1198,26 +1202,24 @@
optional 'uservisible' bool to tell it whether or not to return
only groups marked as uservisible"""
- if uservisible:
- availgroups = self.groupInfo.visible_groups
- else:
- availgroups = self.groupInfo.grouplist
installed = []
available = []
- for id in availgroups:
- grp = self.groupInfo.group_by_id[id]
- if self.groupInfo.isGroupInstalled(grp.name):
- installed.append(grp.name)
+ for grp in self.comps.groups.values():
+ if grp.installed:
+ if uservisible:
+ if grp.user_visible:
+ installed.append(grp)
+ else:
+ installed.append(grp)
else:
- available.append(grp.name)
-
- installed = misc.unique(installed)
- available = misc.unique(available)
- installed.sort()
- available.sort()
-
+ if uservisible:
+ if grp.user_visible:
+ available.append(grp)
+ else:
+ available.append(grp)
+
return installed, available
Index: newcomps.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/newcomps.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- newcomps.py 25 Oct 2005 06:07:32 -0000 1.2
+++ newcomps.py 25 Oct 2005 15:07:00 -0000 1.3
@@ -277,7 +277,6 @@
if elem.tag == "category":
category = Category(elem)
- print category.categoryid
if self.categories.has_key(category.categoryid):
thatcat = self.categories[category.categoryid]
thatcat.add(category)
@@ -286,35 +285,35 @@
del parser
- def compile(self, pkgtuplist):
- """ compile the groups into installed/available groups """
-
- # convert the tuple list to a simple dict of pkgnames
- inst_pkg_names = {}
- for (n,a,e,v,r) in pkgtuplist:
- inst_pkg_names[n] = 1
-
+ def compile(self, pkgtuplist):
+ """ compile the groups into installed/available groups """
+
+ # convert the tuple list to a simple dict of pkgnames
+ inst_pkg_names = {}
+ for (n,a,e,v,r) in pkgtuplist:
+ inst_pkg_names[n] = 1
+
- for group in self.groups.values():
- # if it has any mandatory or default packages in the group, then
- # make sure they're all installed, if any are missing then
- # the group is not installed.
- if len(group.mandatory_packages.keys()) > 0 or len(group.default_packages.keys()) > 0:
- check_pkgs = group.mandatory_packages.keys() + group.default_packages.keys()
- group.installed = True
- for pkgname in check_pkgs:
- if not inst_pkg_names.has_key(pkgname):
- group.installed = False
- # if it doesn't have any of those then see if it has ANY of the
- # optional packages installed. If so - then the group is installed
- else:
- check_pkgs = group.optional_packages.keys()
- group.installed = False
- for pkgname in check_pkgs:
- if inst_pkg_names.has_key(pkgname):
- group.installed = True
-
- self.compiled = True
+ for group in self.groups.values():
+ # if it has any mandatory or default packages in the group, then
+ # make sure they're all installed, if any are missing then
+ # the group is not installed.
+ if len(group.mandatory_packages.keys()) > 0 or len(group.default_packages.keys()) > 0:
+ check_pkgs = group.mandatory_packages.keys() + group.default_packages.keys()
+ group.installed = True
+ for pkgname in check_pkgs:
+ if not inst_pkg_names.has_key(pkgname):
+ group.installed = False
+ # if it doesn't have any of those then see if it has ANY of the
+ # optional packages installed. If so - then the group is installed
+ else:
+ check_pkgs = group.optional_packages.keys()
+ group.installed = False
+ for pkgname in check_pkgs:
+ if inst_pkg_names.has_key(pkgname):
+ group.installed = True
+
+ self.compiled = True
def main():
More information about the Yum-cvs-commits
mailing list