[Fedora-livecd-list] imgcreate/yuminst.py

Jeremy Katz katzj at fedoraproject.org
Wed Oct 8 13:12:52 UTC 2008


 imgcreate/yuminst.py |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 74a5bc4cb1bb392ce1f8b59e76ffade8f505ae9c
Author: Jesse Keating <jkeating at redhat.com>
Date:   Tue Oct 7 16:42:44 2008 -0700

    Fix a bug with getting groups with options (@foo --optional).
    
    New yum api (in 3.2.x) allows us to pass into selectGroups what set we
    want from the group.  The default is mandatory and default.
    Use that unless we have options from kickstart for either
    optional packages (IE everything in the group) or just the
    default packages of the group.
    
    This also allows us to just get the right packages the first time
    rather than getting packages and then pruning/adding as necessary.
    Less trips through the yum stack, which is a good thing.

diff --git a/imgcreate/yuminst.py b/imgcreate/yuminst.py
index a7b04b6..b89a6ed 100644
--- a/imgcreate/yuminst.py
+++ b/imgcreate/yuminst.py
@@ -110,11 +110,14 @@ class LiveCDYum(yum.YumBase):
             logging.warn("No such package %s to remove" %(pkg,))
 
     def selectGroup(self, grp, include = pykickstart.parser.GROUP_DEFAULT):
-        yum.YumBase.selectGroup(self, grp)
+        # default to getting mandatory and default packages from a group
+        # unless we have specific options from kickstart
+        package_types = ['mandatory', 'default']
         if include == pykickstart.parser.GROUP_REQUIRED:
-            map(lambda p: self.deselectPackage(p), grp.default_packages.keys())
+            package_types.remove('default')
         elif include == pykickstart.parser.GROUP_ALL:
-            map(lambda p: self.selectPackage(p), grp.optional_packages.keys())
+            package_types.append('optional')
+        yum.YumBase.selectGroup(self, grp, group_package_types=package_types)
 
     def addRepository(self, name, url = None, mirrorlist = None):
         def _varSubstitute(option):





More information about the livecd mailing list