Move arch setup to __init__.py so that it is done if

gather is not used.
This commit is contained in:
Jesse Keating 2007-08-27 10:02:03 -04:00 committed by Jesse Keating
parent a578d93a9e
commit 5c70f43906
3 changed files with 33 additions and 10 deletions

View File

@ -1,3 +1,6 @@
* Mon Aug 27 2007 Jesse Keating <jkeating@redhat.com>
- Set up arch in __init__.py as it's needed for logging
* Sun Aug 26 2007 Jesse Keating <jkeating@redhat.com>
- Add better support for %packages syntax using native pykickstart
- Add a cache dir for pungi (/var/cache/pungi) and a cli option to override

View File

@ -15,12 +15,25 @@
import logging
import os
import subprocess
import yum
import os
class PungiBase():
"""The base Pungi class. Set up config items and logging here"""
def __init__(self, config):
self.config = config
hostarch = os.uname()[4]
if hostarch in yum.rpmUtils.arch.getArchList('athlon'):
config.set('default', 'arch', 'i386')
elif hostarch == 'ppc':
config.set('default', 'arch', 'ppc')
elif hostarch == 'sparc':
config.set('default', 'arch', 'sparc')
else:
config.set('default', 'arch', hostarch)
self.doLoggerSetup()
self.workdir = os.path.join(self.config.get('default', 'destdir'),

View File

@ -48,20 +48,16 @@ class PungiYum(yum.YumBase):
class Gather(pypungi.PungiBase):
def __init__(self, config, ksparser):
# Set up arches, needed for log file name
hostarch = os.uname()[4]
if hostarch in yum.rpmUtils.arch.getArchList('athlon'):
config.set('default', 'arch', 'i386')
arch = self.config.get('default', 'arch')
if arch == 'i386'
yumarch = 'athlon'
elif hostarch == 'ppc':
config.set('default', 'arch', 'ppc')
elif arch == 'ppc':
yumarch = 'ppc64'
elif hostarch == 'sparc':
config.set('default', 'arch', 'sparc')
elif arch == 'sparc':
yumarch = 'sparc64v'
else:
config.set('default', 'arch', hostarch)
yumarch = hostarch
yumarch = arch
pypungi.PungiBase.__init__(self, config)
@ -96,6 +92,17 @@ class Gather(pypungi.PungiBase):
self.ayum.cleanMetadata() # clean metadata that might be in the cache from previous runs
self.ayum.cleanSqlite() # clean metadata that might be in the cache from previous runs
arch = self.config.get('default', 'arch')
if arch == 'i386'
yumarch = 'athlon'
elif arch == 'ppc':
yumarch = 'ppc64'
elif arch == 'sparc':
yumarch = 'sparc64v'
else:
yumarch = arch
self.ayum.compatarch = yumarch
arches = yum.rpmUtils.arch.getArchList(yumarch)
arches.append('src') # throw source in there, filter it later