Use yum's method to write out a unified comps.
This commit is contained in:
parent
51f5969e49
commit
65c7bdf6de
@ -1,3 +1,6 @@
|
||||
* Tue Mar 25 2008 Jesse Keating <jkeating@redhat.com>
|
||||
- Use yum's comps method to write out a unified comps
|
||||
|
||||
* Fri Mar 21 2008 Jesse Keating <jkeating@redhat.com>
|
||||
- Handle shared source directory better.
|
||||
|
||||
|
@ -375,45 +375,12 @@ class Gather(pypungi.PungiBase):
|
||||
def makeCompsFile(self):
|
||||
"""Gather any comps files we can from repos and merge them into one."""
|
||||
|
||||
# get our list of repos
|
||||
repos = self.ayum.repos.repos.values()
|
||||
|
||||
compsstub = '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">\n<comps>\n'
|
||||
|
||||
closestub = '\n</comps>\n'
|
||||
|
||||
ourcompspath = os.path.join(self.workdir, '%s-%s-comps.xml' % (self.config.get('default', 'name'), self.config.get('default', 'version')))
|
||||
|
||||
ourcomps = open(ourcompspath, 'w')
|
||||
|
||||
ourcomps.write(compsstub)
|
||||
ourcomps.write(self.ayum.comps.Comps.xml())
|
||||
|
||||
# iterate through the list and get what comps we can.
|
||||
# Strip the first three lines and the last line of substance off
|
||||
# once done, write it to our comps file
|
||||
for repo in repos:
|
||||
try:
|
||||
groupfile = repo.getGroups()
|
||||
except yum.Errors.RepoMDError, e:
|
||||
self.logger.warn("No group data found for %s" % repo.id)
|
||||
pass
|
||||
else:
|
||||
# Check to see if we got a gzipped comps file
|
||||
if groupfile.endswith('.gz'):
|
||||
compslines = gzip.open(groupfile, 'r').readlines()
|
||||
else:
|
||||
compslines = open(groupfile, 'r').readlines()
|
||||
for line in compslines:
|
||||
if line.startswith('</comps'):
|
||||
end = compslines.index(line)
|
||||
|
||||
for line in compslines:
|
||||
if line.startswith('<comps'):
|
||||
start = compslines.index(line) + 1
|
||||
|
||||
ourcomps.writelines(compslines[start:end])
|
||||
|
||||
ourcomps.write(closestub)
|
||||
ourcomps.close()
|
||||
|
||||
# Run the xslt filter over our comps file
|
||||
|
Loading…
Reference in New Issue
Block a user