refactor to get better data into .treeinfo

for https://fedorahosted.org/rel-eng/ticket/6008 refacter how we deal
with the data that feeds into .treeinfo
Deprecate --name for --family
Deprecate --flavor for --variant
rather than using --name as the iso base name use the value of
family if there is a variant add it with a - as the seperator
This commit is contained in:
Dennis Gilmore 2015-02-27 23:13:47 -06:00
parent f116d9384f
commit 0633eb29d3
3 changed files with 38 additions and 29 deletions

View File

@ -185,7 +185,7 @@ def main():
# we already have all the content gathered # we already have all the content gathered
mypungi.topdir = os.path.join(config.get('pungi', 'destdir'), mypungi.topdir = os.path.join(config.get('pungi', 'destdir'),
config.get('pungi', 'version'), config.get('pungi', 'version'),
config.get('pungi', 'flavor'), config.get('pungi', 'variant'),
'source', 'SRPMS') 'source', 'SRPMS')
mypungi.doCreaterepo(comps=False) mypungi.doCreaterepo(comps=False)
if opts.do_all or opts.do_createiso: if opts.do_all or opts.do_createiso:
@ -205,20 +205,23 @@ if __name__ == '__main__':
def set_config(option, opt_str, value, parser, config): def set_config(option, opt_str, value, parser, config):
config.set('pungi', option.dest, value) config.set('pungi', option.dest, value)
# When setting name, also set the iso_basename.
if option.dest == 'name':
config.set('pungi', 'iso_basename', value)
# Pulled in from config file to be cli options as part of pykickstart conversion # Pulled in from config file to be cli options as part of pykickstart conversion
parser.add_option("--name", dest="name", type="string", parser.add_option("--name", dest="family", type="string",
action="callback", callback=set_config, callback_args=(config, ), action="callback", callback=set_config, callback_args=(config, ),
help='the name for your distribution (defaults to "Fedora")') help='the name for your distribution (defaults to "Fedora"), DEPRECATED')
parser.add_option("--family", dest="family", type="string",
action="callback", callback=set_config, callback_args=(config, ),
help='the family name for your distribution (defaults to "Fedora")')
parser.add_option("--ver", dest="version", type="string", parser.add_option("--ver", dest="version", type="string",
action="callback", callback=set_config, callback_args=(config, ), action="callback", callback=set_config, callback_args=(config, ),
help='the version of your distribution (defaults to datestamp)') help='the version of your distribution (defaults to datestamp)')
parser.add_option("--flavor", dest="flavor", type="string", parser.add_option("--flavor", dest="variant", type="string",
action="callback", callback=set_config, callback_args=(config, ), action="callback", callback=set_config, callback_args=(config, ),
help='the flavor of your distribution spin (optional)') help='the flavor of your distribution spin (optional), DEPRECATED')
parser.add_option("--variant", dest="variant", type="string",
action="callback", callback=set_config, callback_args=(config, ),
help='the variant of your distribution spin (optional)')
parser.add_option("--destdir", dest="destdir", type="string", parser.add_option("--destdir", dest="destdir", type="string",
action="callback", callback=set_config, callback_args=(config, ), action="callback", callback=set_config, callback_args=(config, ),
help='destination directory (defaults to current directory)') help='destination directory (defaults to current directory)')
@ -299,8 +302,8 @@ if __name__ == '__main__':
if not opts.config: if not opts.config:
parser.error("Please specify a config file") parser.error("Please specify a config file")
if not config.get('pungi', 'flavor').isalnum() and not config.get('pungi', 'flavor') == '': if not config.get('pungi', 'variant').isalnum() and not config.get('pungi', 'variant') == '':
parser.error("Flavor must be alphanumeric") parser.error("Variant must be alphanumeric")
if opts.do_gather or opts.do_createrepo or opts.do_buildinstall or opts.do_createiso: if opts.do_gather or opts.do_createrepo or opts.do_buildinstall or opts.do_createiso:
opts.do_all = False opts.do_all = False
@ -308,6 +311,12 @@ if __name__ == '__main__':
if opts.arch and (opts.do_all or opts.do_buildinstall): if opts.arch and (opts.do_all or opts.do_buildinstall):
parser.error("Cannot override arch while the BuildInstall stage is enabled") parser.error("Cannot override arch while the BuildInstall stage is enabled")
# set the iso_basename.
if not config.get('pungi', 'variant') == '':
config.set('pungi', 'iso_basename', '%s-%s' % (config.get('pungi', 'family'), config.get('pungi', 'variant')))
else:
config.set('pungi', 'iso_basename', config.get('pungi', 'family'))
return (opts, args) return (opts, args)
main() main()

View File

@ -33,17 +33,17 @@ class Config(SafeConfigParser):
self.set('pungi', 'sourcedir', 'source') self.set('pungi', 'sourcedir', 'source')
self.set('pungi', 'debugdir', 'debug') self.set('pungi', 'debugdir', 'debug')
self.set('pungi', 'isodir', 'iso') self.set('pungi', 'isodir', 'iso')
self.set('pungi', 'relnotefilere', 'GPL README-BURNING-ISOS-en_US.txt ^RPM-GPG') self.set('pungi', 'relnotefilere', 'LICENSE README-BURNING-ISOS-en_US.txt ^RPM-GPG')
self.set('pungi', 'relnotedirre', '') self.set('pungi', 'relnotedirre', '')
self.set('pungi', 'relnotepkgs', 'fedora-release fedora-release-notes') self.set('pungi', 'relnotepkgs', 'fedora-repos fedora-release fedora-release-notes')
self.set('pungi', 'product_path', 'Packages') self.set('pungi', 'product_path', 'Packages')
self.set('pungi', 'cachedir', '/var/cache/pungi') self.set('pungi', 'cachedir', '/var/cache/pungi')
self.set('pungi', 'compress_type', 'xz') self.set('pungi', 'compress_type', 'xz')
self.set('pungi', 'arch', yum.rpmUtils.arch.getBaseArch()) self.set('pungi', 'arch', yum.rpmUtils.arch.getBaseArch())
self.set('pungi', 'name', 'Fedora') self.set('pungi', 'family', 'Fedora')
self.set('pungi', 'iso_basename', 'Fedora') self.set('pungi', 'iso_basename', 'Fedora')
self.set('pungi', 'version', time.strftime('%Y%m%d', time.localtime())) self.set('pungi', 'version', time.strftime('%Y%m%d', time.localtime()))
self.set('pungi', 'flavor', '') self.set('pungi', 'variant', '')
self.set('pungi', 'destdir', os.getcwd()) self.set('pungi', 'destdir', os.getcwd())
self.set('pungi', 'workdirbase', "/work") self.set('pungi', 'workdirbase', "/work")
self.set('pungi', 'bugurl', 'https://bugzilla.redhat.com') self.set('pungi', 'bugurl', 'https://bugzilla.redhat.com')

View File

@ -125,7 +125,7 @@ class PungiBase(object):
self.doLoggerSetup() self.doLoggerSetup()
self.workdir = os.path.join(self.config.get('pungi', 'workdirbase'), self.workdir = os.path.join(self.config.get('pungi', 'workdirbase'),
self.config.get('pungi', 'flavor'), self.config.get('pungi', 'variant'),
self.tree_arch) self.tree_arch)
@ -137,8 +137,8 @@ class PungiBase(object):
pungi.util._ensuredir(logdir, None, force=True) # Always allow logs to be written out pungi.util._ensuredir(logdir, None, force=True) # Always allow logs to be written out
if self.config.get('pungi', 'flavor'): if self.config.get('pungi', 'variant'):
logfile = os.path.join(logdir, '%s.%s.log' % (self.config.get('pungi', 'flavor'), logfile = os.path.join(logdir, '%s.%s.log' % (self.config.get('pungi', 'variant'),
self.tree_arch)) self.tree_arch))
else: else:
logfile = os.path.join(logdir, '%s.log' % (self.tree_arch)) logfile = os.path.join(logdir, '%s.log' % (self.tree_arch))
@ -169,8 +169,8 @@ class PungiYum(yum.YumBase):
logdir = os.path.join(self.pungiconfig.get('pungi', 'destdir'), 'logs') logdir = os.path.join(self.pungiconfig.get('pungi', 'destdir'), 'logs')
if not os.path.exists(logdir): if not os.path.exists(logdir):
os.makedirs(logdir) os.makedirs(logdir)
if self.pungiconfig.get('pungi', 'flavor'): if self.pungiconfig.get('pungi', 'variant'):
logfile = os.path.join(logdir, '%s.%s.log' % (self.pungiconfig.get('pungi', 'flavor'), logfile = os.path.join(logdir, '%s.%s.log' % (self.pungiconfig.get('pungi', 'variant'),
self.pungiconfig.get('pungi', 'arch'))) self.pungiconfig.get('pungi', 'arch')))
else: else:
logfile = os.path.join(logdir, '%s.log' % (self.pungiconfig.get('pungi', 'arch'))) logfile = os.path.join(logdir, '%s.log' % (self.pungiconfig.get('pungi', 'arch')))
@ -216,7 +216,7 @@ class Pungi(PungiBase):
self.destdir = self.config.get('pungi', 'destdir') self.destdir = self.config.get('pungi', 'destdir')
self.archdir = os.path.join(self.destdir, self.archdir = os.path.join(self.destdir,
self.config.get('pungi', 'version'), self.config.get('pungi', 'version'),
self.config.get('pungi', 'flavor'), self.config.get('pungi', 'variant'),
self.tree_arch) self.tree_arch)
self.topdir = os.path.join(self.archdir, 'os') self.topdir = os.path.join(self.archdir, 'os')
@ -1068,7 +1068,7 @@ class Pungi(PungiBase):
pkgdir = os.path.join(self.config.get('pungi', 'destdir'), pkgdir = os.path.join(self.config.get('pungi', 'destdir'),
self.config.get('pungi', 'version'), self.config.get('pungi', 'version'),
self.config.get('pungi', 'flavor'), self.config.get('pungi', 'variant'),
relpkgdir) relpkgdir)
# Ensure the pkgdir exists, force if requested, and make sure we clean it out # Ensure the pkgdir exists, force if requested, and make sure we clean it out
@ -1122,7 +1122,7 @@ class Pungi(PungiBase):
def makeCompsFile(self): def makeCompsFile(self):
"""Gather any comps files we can from repos and merge them into one.""" """Gather any comps files we can from repos and merge them into one."""
ourcompspath = os.path.join(self.workdir, '%s-%s-comps.xml' % (self.config.get('pungi', 'name'), self.config.get('pungi', 'version'))) ourcompspath = os.path.join(self.workdir, '%s-%s-comps.xml' % (self.config.get('pungi', 'family'), self.config.get('pungi', 'version')))
# Filter out things we don't include # Filter out things we don't include
ourgroups = [] ourgroups = []
@ -1314,7 +1314,7 @@ class Pungi(PungiBase):
compsfile = None compsfile = None
if comps: if comps:
compsfile = os.path.join(self.workdir, '%s-%s-comps.xml' % (self.config.get('pungi', 'name'), self.config.get('pungi', 'version'))) compsfile = os.path.join(self.workdir, '%s-%s-comps.xml' % (self.config.get('pungi', 'family'), self.config.get('pungi', 'version')))
# setup the cache dirs # setup the cache dirs
for target in ['createrepocache', 'repoviewcache']: for target in ['createrepocache', 'repoviewcache']:
@ -1323,7 +1323,7 @@ class Pungi(PungiBase):
self.logger, self.logger,
force=True) force=True)
repoviewtitle = '%s %s - %s' % (self.config.get('pungi', 'name'), repoviewtitle = '%s %s - %s' % (self.config.get('pungi', 'family'),
self.config.get('pungi', 'version'), self.config.get('pungi', 'version'),
self.tree_arch) self.tree_arch)
@ -1353,7 +1353,7 @@ class Pungi(PungiBase):
'Alpha': 'A', 'Alpha': 'A',
'Beta': 'B', 'Beta': 'B',
'TC': 'T'} 'TC': 'T'}
name = self.config.get('pungi', 'name') name = self.config.get('pungi', 'family')
version = self.config.get('pungi', 'version') version = self.config.get('pungi', 'version')
arch = self.tree_arch arch = self.tree_arch
@ -1379,11 +1379,11 @@ class Pungi(PungiBase):
'file://%s' % self.topdir, 'file://%s' % self.topdir,
cost=10) cost=10)
product = self.config.get('pungi', 'name') product = self.config.get('pungi', 'family')
version = self.config.get('pungi', 'version') version = self.config.get('pungi', 'version')
release = '%s %s' % (self.config.get('pungi', 'name'), self.config.get('pungi', 'version')) release = '%s %s' % (self.config.get('pungi', 'family'), self.config.get('pungi', 'version'))
variant = self.config.get('pungi', 'flavor') variant = self.config.get('pungi', 'variant')
bugurl = self.config.get('pungi', 'bugurl') bugurl = self.config.get('pungi', 'bugurl')
isfinal = self.config.get('pungi', 'isfinal') isfinal = self.config.get('pungi', 'isfinal')
@ -1606,7 +1606,7 @@ class Pungi(PungiBase):
treesize = int(subprocess.Popen(mkisofs + ['-print-size', '-quiet', self.topdir], stdout=subprocess.PIPE).communicate()[0]) treesize = int(subprocess.Popen(mkisofs + ['-print-size', '-quiet', self.topdir], stdout=subprocess.PIPE).communicate()[0])
else: else:
srcdir = os.path.join(self.config.get('pungi', 'destdir'), self.config.get('pungi', 'version'), srcdir = os.path.join(self.config.get('pungi', 'destdir'), self.config.get('pungi', 'version'),
self.config.get('pungi', 'flavor'), 'source', 'SRPMS') self.config.get('pungi', 'variant'), 'source', 'SRPMS')
treesize = int(subprocess.Popen(mkisofs + ['-print-size', '-quiet', srcdir], stdout=subprocess.PIPE).communicate()[0]) treesize = int(subprocess.Popen(mkisofs + ['-print-size', '-quiet', srcdir], stdout=subprocess.PIPE).communicate()[0])
# Size returned is 2KiB clusters or some such. This translates that to MiB. # Size returned is 2KiB clusters or some such. This translates that to MiB.