update the generated mock config file to me compatible with mock >= 0.8.7
This commit is contained in:
parent
0e3b95f199
commit
e69612f123
2 changed files with 38 additions and 39 deletions
|
|
@ -878,6 +878,7 @@ def genMockConfig(name, arch, managed=False, repoid=None, tag_name=None, **opts)
|
|||
"""Generate a mock config
|
||||
|
||||
Returns a string containing the config
|
||||
The generated config is compatible with mock >= 0.8.7
|
||||
"""
|
||||
mockdir = opts.get('mockdir', '/var/lib/mock')
|
||||
url = opts.get('url')
|
||||
|
|
@ -897,28 +898,19 @@ def genMockConfig(name, arch, managed=False, repoid=None, tag_name=None, **opts)
|
|||
if managed:
|
||||
buildroot_id = opts.get('buildroot_id')
|
||||
|
||||
# FIXME - get more of this into a config
|
||||
# rely on the mock defaults being correct
|
||||
# and only includes changes from the defaults here
|
||||
config_opts = {
|
||||
'root' : name,
|
||||
'basedir' : mockdir,
|
||||
'chroot' : '/usr/sbin/mock-helper chroot',
|
||||
'mount' : '/usr/sbin/mock-helper mount',
|
||||
'umount' : '/usr/sbin/mock-helper umount',
|
||||
'rm' : '/usr/sbin/mock-helper rm',
|
||||
'mknod' : '/usr/sbin/mock-helper mknod',
|
||||
'yum' : '/usr/sbin/mock-helper yum',
|
||||
'runuser' : '/sbin/runuser',
|
||||
'buildgroup' : 'build',
|
||||
'chroot_dep_package' : 'buildsys-build',
|
||||
'chrootuser' : 'kojibuilder',
|
||||
'chrootgroup' : 'kojibuilder',
|
||||
'chroothome' : '/builddir',
|
||||
'clean' : True,
|
||||
'target_arch' : arch,
|
||||
'chroothome': '/builddir',
|
||||
'chroot_setup_cmd': 'install buildsys-build',
|
||||
# don't encourage network access from the chroot
|
||||
'use_host_resolv': False
|
||||
}
|
||||
|
||||
config_opts['yum.conf'] = """
|
||||
[main]
|
||||
config_opts['yum.conf'] = """[main]
|
||||
cachedir=/var/cache/yum
|
||||
debuglevel=1
|
||||
logfile=/var/log/yum.log
|
||||
|
|
@ -930,42 +922,49 @@ assumeyes=1
|
|||
|
||||
# repos
|
||||
|
||||
[core]
|
||||
name=core
|
||||
[build]
|
||||
name=build
|
||||
baseurl=%(url)s
|
||||
""" % locals()
|
||||
#XXX - this needs to be configurable
|
||||
|
||||
plugin_conf = {
|
||||
'ccache_enable': False,
|
||||
'yum_cache_enable': False,
|
||||
'root_cache_enable': False
|
||||
}
|
||||
|
||||
#XXX - this needs to be configurable
|
||||
macros = {
|
||||
'_topdir' : '%s/build' % config_opts['chroothome'],
|
||||
'_rpmfilename' : '%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm',
|
||||
'vendor' : opts.get('vendor', 'Koji'),
|
||||
'packager' : opts.get('packager', 'Koji'),
|
||||
'_host_cpu' : arch,
|
||||
'_host': '%s-%s' % (arch, opts.get('mockhost', 'koji-linux-gnu')),
|
||||
'%_topdir' : '%s/build' % config_opts['chroothome'],
|
||||
'%_rpmfilename' : '%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm',
|
||||
'%_host_cpu' : arch,
|
||||
'%_host': '%s-%s' % (arch, opts.get('mockhost', 'koji-linux-gnu')),
|
||||
'%vendor' : opts.get('vendor', 'Koji'),
|
||||
'%packager' : opts.get('packager', 'Koji'),
|
||||
'%distribution': opts.get('distribution', 'Unknown')
|
||||
#TODO - track some of these in the db instead?
|
||||
}
|
||||
if opts.has_key('distribution'):
|
||||
macros['distribution'] = opts.get('distribution')
|
||||
config_opts['macros'] = '\n'.join(["%%%s %s" % (k, v) for k,v in macros.iteritems()])
|
||||
|
||||
parts = ["""#!/usr/bin/python -tt
|
||||
# Auto-generated by the build system
|
||||
parts = ["""# Auto-generated by the Koji build system
|
||||
"""]
|
||||
if managed:
|
||||
parts.append("""
|
||||
# Koji buildroot id: %(buildroot_id)s
|
||||
# Koji buildroot name: %(name)s
|
||||
# Koji repo id: %(repoid)s
|
||||
# Koji tag: %(tag_name)s""" % locals())
|
||||
# Koji tag: %(tag_name)s
|
||||
""" % locals())
|
||||
|
||||
parts.append("\n")
|
||||
for key, value in config_opts.iteritems():
|
||||
parts.append("config_opts[%r] = %r\n" % (key, value))
|
||||
parts.append("\n")
|
||||
for key, value in plugin_conf.iteritems():
|
||||
parts.append("config_opts['plugin_conf'][%r] = %r\n" % (key, value))
|
||||
parts.append("\n")
|
||||
for key, value in macros.iteritems():
|
||||
parts.append("config_opts['macros'][%r] = %r\n" % (key, value))
|
||||
|
||||
parts.append("""
|
||||
import os
|
||||
config_opts['chrootuid'] = os.geteuid()
|
||||
config_opts['chrootgid'] = os.getegid()
|
||||
""")
|
||||
for (key,value) in config_opts.iteritems():
|
||||
parts.append("config_opts[%r] = %r\n" % (key,value))
|
||||
return ''.join(parts)
|
||||
|
||||
def get_sequence_value(cursor, sequence):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue