Only include groups that are specified in the kickstart. Remove any environments that use
groups not on the media.
---
src/pypungi/__init__.py | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py
index 45689c5..9eb24d0 100644
--- a/src/pypungi/__init__.py
+++ b/src/pypungi/__init__.py
@@ -724,10 +724,29 @@ class Pungi(pypungi.PungiBase):
ourcompspath = os.path.join(self.workdir, '%s-%s-comps.xml' %
(self.config.get('pungi', 'name'), self.config.get('pungi',
'version')))
- ourcomps = open(ourcompspath, 'w')
+ # Filter out things we don't include
+ ourgroups = []
+ for item in self.ksparser.handler.packages.groupList:
+ g = self.ayum.comps.return_group(item.name)
+ if g:
+ ourgroups.append(g.groupid)
+ allgroups = [g.groupid for g in self.ayum.comps.get_groups()]
+ for group in allgroups:
+ if group not in ourgroups:
+ self.logger.info('Removing extra group %s from comps file' %
(group,))
+ del self.ayum.comps._groups[group]
+
+ groups = [g.groupid for g in self.ayum.comps.get_groups()]
+ envs = self.ayum.comps.get_environments()
+ for env in envs:
+ for group in env.groups:
+ if group not in groups:
+ self.logger.info('Removing incomplete environment %s from comps
file' % (env,))
+ del self.ayum.comps._environments[env.environmentid]
+ break
+ ourcomps = open(ourcompspath, 'w')
ourcomps.write(self.ayum.comps.xml())
-
ourcomps.close()
# Disable this until
https://bugzilla.redhat.com/show_bug.cgi?id=442097 is
fixed.
--
1.8.0.1