Handle gzipped comps files.

This commit is contained in:
Jesse Keating 2008-02-21 18:04:39 -05:00 committed by Jesse Keating
parent 1a5e874d84
commit eb1a47579f
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,6 @@
* Thu Feb 21 2008 Jesse Keating <jkeating@redhat.com>
- Handle gzipped comps files.
* Fri Feb 08 2008 Jesse Keating <jkeating@redhat.com>
- Fix comps mashup to be more lenient with the open/close of <comps

View File

@ -16,6 +16,7 @@ import yum
import os
import shutil
import sys
import gzip
import pypungi
import logging
import urlgrabber.progress
@ -389,7 +390,11 @@ class Gather(pypungi.PungiBase):
self.logger.warn("No group data found for %s" % repo.id)
pass
else:
compslines = open(groupfile, 'r').readlines()
# 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)