- Remove a lot of configurable items and hard set them

- Move some items to cli flags only (part of moving to pykickstart)
This commit is contained in:
Jesse Keating 2007-08-24 09:13:53 -04:00 committed by Jesse Keating
parent 9c64c98c8f
commit 54d3d6b809
3 changed files with 50 additions and 33 deletions

View File

@ -1,3 +1,7 @@
* Fri Aug 24 2007 Jesse Keating <jkeating@redhat.com>
- Remove a lot of configurable items and hard set them
- Move some items to cli flags only (part of moving to pykickstart)
* Thu Aug 23 2007 Jesse Keating <jkeating@redhat.com>
- Add a source config for the Fedora spin

6
ToDo
View File

@ -12,6 +12,8 @@ Working with Kickstart
relnotedirre
relnotepkgs
DONE ^^
* Move to CLI only:
name
version
@ -21,9 +23,13 @@ Working with Kickstart
discs (optional)
nosource (optional/debug)
DONE ^^
* Make the following transitions
product_name -> name
product path == 'Packages/"
get comps data from repos
cachedir == /var/cache/pungi ?
* From pykickstart
manifest -> %packages

73
pungi
View File

@ -23,7 +23,6 @@ def main():
# Set some default variables, can be overrided in config file
# Turn this into a dict someday, to iterate over when setting defaults
flavor = ""
osdir = "os"
sourcedir = "source"
debugdir = "debug"
@ -42,52 +41,42 @@ def main():
print ("Check that the file %s exists and that it has a 'default' section" % opts.config)
sys.exit(1)
if not config.has_option('default', 'flavor'):
config.set('default', 'flavor', flavor)
config.set('default', 'osdir', osdir)
if not config.has_option('default', 'osdir'):
config.set('default', 'osdir', osdir)
config.set('default', 'sourcedir', sourcedir)
if not config.has_option('default', 'sourcedir'):
config.set('default', 'sourcedir', sourcedir)
config.set('default', 'debugdir', debugdir)
if not config.has_option('default', 'debugdir'):
config.set('default', 'debugdir', debugdir)
config.set('default', 'isodir', isodir)
if not config.has_option('default', 'isodir'):
config.set('default', 'isodir', isodir)
config.set('default', 'cdsize', cdsize)
if not config.has_option('default', 'cdsize'):
config.set('default', 'cdsize', cdsize)
config.set('default', 'relnotefilere', relnotefilere)
if not config.has_option('default', 'relnotefilere'):
config.set('default', 'relnotefilere', relnotefilere)
config.set('default', 'relnotedirre', relnotedirre)
if not config.has_option('default', 'relnotedirre'):
config.set('default', 'relnotedirre', relnotedirre)
config.set('default', 'relnotepkgs', relnotepkgs)
if not config.has_option('default', 'relnotepkgs'):
config.set('default', 'relnotepkgs', relnotepkgs)
# set configs from cli options
config.set('default', 'product_name', opts.name)
config.set('default', 'version', opts.ver)
config.set('default', 'flavor', opts.flavor)
config.set('default', 'destdir', opts.destdir)
config.set('default', 'bugurl', opts.bugurl)
config.set('default', 'discs', opts.discs)
# set some other defaults
if not config.has_option('default', 'product_path'):
config.set('default', 'product_path', config.get('default', 'product_name'))
config.set('default', 'product_path', config.get('default', 'product_name'))
if not config.has_option('default', 'iso_basename'):
config.set('default', 'iso_basename', config.get('default', 'product_name'))
config.set('default', 'iso_basename', config.get('default', 'product_name'))
pkglist = get_packagelist(config.get('default', 'manifest'))
if not opts.destdir == "*CONFFILE*":
config.set('default', 'destdir', opts.destdir)
destdir = config.get('default', 'destdir')
if not os.path.exists(destdir):
if not os.path.exists(config.get('default', 'destdir')):
try:
os.makedirs(destdir)
os.makedirs(config.get('default', 'destdir'))
except OSError, e:
print >> sys.stderr, "Error: Cannot create destination dir %s" % destdir
print >> sys.stderr, "Error: Cannot create destination dir %s" % config.get('default', 'destdir')
sys.exit(1)
cachedir = config.get('default', 'cachedir')
@ -105,7 +94,7 @@ def main():
mygather = pypungi.gather.Gather(config, pkglist)
mygather.getPackageObjects()
mygather.downloadPackages()
if config.getboolean('default', 'getsource'):
if not opts.nosource:
mygather.getSRPMList()
mygather.downloadSRPMs()
@ -149,11 +138,29 @@ def main():
if __name__ == '__main__':
from optparse import OptionParser
import sys
import time
today = time.strftime('%Y%m%d', time.localtime())
def get_arguments():
parser = OptionParser(version="%prog 0.5.0")
parser.add_option("--destdir", default="*CONFFILE*", dest="destdir",
# Pulled in from config file to be cli options as part of pykickstart conversion
parser.add_option("--name", default="Fedora", dest="name",
help='the name for your distribution (defaults to "Fedora")')
parser.add_option("--ver", default=today, dest="ver",
help='the version of your distribution (defaults to datestamp)')
parser.add_option("--flavor", dest="flavor",
help='the flavor of your distribution spin (optional)')
parser.add_option("--destdir", default=".", dest="destdir",
help='destination directory (defaults to current directory)')
parser.add_option("--bugurl", default="http://bugzilla.redhat.com", dest="bugurl",
help='the url for your bug system (defaults to http://bugzilla.redhat.com)')
parser.add_option("--discs", default='1', dest="discs",
help='the number of discs you want to create (defaults to 1)')
parser.add_option("--nosource", action="store_true", dest="nosource",
help='the flavor of your distribution spin (optional)')
parser.add_option("-c", "--conf", default='/etc/pungi/pungi.conf', dest="config",
help='Config file to use')
parser.add_option("--all-stages", action="store_true", default=True, dest="do_all",