- Pass gather a ksparser object instead, needed for yum repos

and more advanced package handling.
This commit is contained in:
Jesse Keating 2007-08-25 10:04:25 -04:00 committed by Jesse Keating
parent c6986f49a8
commit 0b3221eafa
2 changed files with 16 additions and 16 deletions

12
pungi
View File

@ -70,16 +70,6 @@ def main():
if part.mountpoint == 'iso': if part.mountpoint == 'iso':
config.set('default', 'cdsize', part.size) config.set('default', 'cdsize', part.size)
# Build up a package dict.
pkgdict = {'groups': [], 'packages': [], 'excludes': [])
for group in ksparser.handler.packages.groupList:
if group.include == 1:
pkgdict['groups'].append(group.name)
pkgdict['packages'].extend(ksparser.handler.packages.packageList)
pkgdict['excludes'].extend(ksparser.handler.packages.excludedList)
# Set up our directories # Set up our directories
if not os.path.exists(config.get('default', 'destdir')): if not os.path.exists(config.get('default', 'destdir')):
try: try:
@ -100,7 +90,7 @@ def main():
# Actually do work. # Actually do work.
if not config.get('default', 'arch') == 'source': if not config.get('default', 'arch') == 'source':
if opts.do_all or opts.do_gather: if opts.do_all or opts.do_gather:
mygather = pypungi.gather.Gather(config, pkgdict) mygather = pypungi.gather.Gather(config, ksparser)
mygather.getPackageObjects() mygather.getPackageObjects()
mygather.downloadPackages() mygather.downloadPackages()
mygather.makeCompsFile() mygather.makeCompsFile()

View File

@ -47,7 +47,7 @@ class PungiYum(yum.YumBase):
pass pass
class Gather(pypungi.PungiBase): class Gather(pypungi.PungiBase):
def __init__(self, config, pkgdict): def __init__(self, config, ksparser):
pypungi.PungiBase.__init__(self, config) pypungi.PungiBase.__init__(self, config)
# Set our own logging name space # Set our own logging name space
@ -60,7 +60,7 @@ class Gather(pypungi.PungiBase):
console.setLevel(logging.INFO) console.setLevel(logging.INFO)
self.logger.addHandler(console) self.logger.addHandler(console)
self.pkgdict = pkgdict self.ksparser = ksparser
self.config.cachedir = os.path.join(self.workdir, 'yumcache') self.config.cachedir = os.path.join(self.workdir, 'yumcache')
self.polist = [] self.polist = []
self.srpmlist = [] self.srpmlist = []
@ -209,16 +209,26 @@ class Gather(pypungi.PungiBase):
searchlist = [] # The list of package names/globs to search for searchlist = [] # The list of package names/globs to search for
matchdict = {} # A dict of objects to names matchdict = {} # A dict of objects to names
# Build up a package dict.
pkgdict = {'groups': [], 'packages': [], 'excludes': [])
for group in self.ksparser.handler.packages.groupList:
if group.include == 1:
pkgdict['groups'].append(group.name)
pkgdict['packages'].extend(self.ksparser.handler.packages.packageList)
pkgdict['excludes'].extend(self.ksparser.handler.packages.excludedList)
# First remove the excludes # First remove the excludes
self.ayum.conf.exclude.extend(self.pkgdict['excludes']) self.ayum.conf.exclude.extend(pkgdict['excludes'])
self.ayum.excludePackages() self.ayum.excludePackages()
# Get a list of packages from groups # Get a list of packages from groups
for group in self.pkgdict['groups']: for group in pkgdict['groups']:
searchlist.extend(self.getPackagesFromGroup(group)) searchlist.extend(self.getPackagesFromGroup(group))
# Add the adds # Add the adds
searchlist.extend(self.pkgdict['packages']) searchlist.extend(pkgdict['packages'])
# Make the search list unique # Make the search list unique
searchlist = yum.misc.unique(searchlist) searchlist = yum.misc.unique(searchlist)