1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-04 02:26:16 +01:00

Add VM diskimage autosetup hooks to osc.

Signed-off-by: Martin Mohring <martinmohring@linuxfoundation.org>
Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
This commit is contained in:
Jan-Simon Möller 2010-03-28 21:13:04 +02:00
parent f37dfd6e8c
commit 35d0652d21
2 changed files with 60 additions and 3 deletions

View File

@ -683,16 +683,29 @@ def main(opts, argv):
vm_options = ''
if config['build-device'] and config['build-memory'] and config['build-type']:
my_build_device = config['build-device'] % { 'repo': repo, 'arch': arch,
'project' : prj, 'package' : pacname
}
if config['build-type'] == 'kvm':
vm_options = '--kvm ' + config['build-device']
vm_options = '--kvm ' + my_build_device
elif config['build-type'] == 'xen':
vm_options = '--xen ' + config['build-device']
vm_options = '--xen ' + my_build_device
else:
raise oscerr.WrongArgs('ERROR: unknown VM is set ! ("%s")' % config['build-type'])
if config['build-swap']:
vm_options += ' --swap ' + config['build-swap']
my_build_swap = config['build-swap'] % { 'repo': repo, 'arch': arch,
'project' : prj, 'package' : pacname
}
vm_options += ' --swap ' + my_build_swap
if config['build-memory']:
vm_options += ' --memory ' + config['build-memory']
if config['build-vmdisk-autosetup'] and config['build-vmdisk-autosetup'] == '1':
if config['build-vmdisk-rootsize'] and config['build-vmdisk-swapsize']:
vm_options += ' --vmdisk-autosetup '
vm_options += ' --vmdisk-rootsize ' + config['build-vmdisk-rootsize']
vm_options += ' --vmdisk-swapsize ' + config['build-vmdisk-swapsize']
if config['build-vmdisk-force']:
vm_options += ' --vmdisk-force '
print 'Running build'
cmd = '"%s" --root="%s" --rpmlist="%s" --dist="%s" %s --arch=%s %s "%s" %s' \

View File

@ -75,6 +75,11 @@ DEFAULTS = { 'apiurl': 'https://api.opensuse.org',
'build-device': '', # required for VM builds
'build-memory': '',# required for VM builds
'build-swap': '', # optional for VM builds
'build-vmdisk-autosetup': '', # optional for VM builds
'build-vmdisk-rootsize': '', # optional for VM builds
'build-vmdisk-swapsize': '', # optional for VM builds
'build-vmdisk-force': '', # optional for VM builds
'build-jobs': os.sysconf('SC_NPROCESSORS_ONLN'), # compile with N jobs
'icecream': '0',
@ -154,6 +159,45 @@ apiurl = %(apiurl)s
# compile with N jobs (default: "getconf _NPROCESSORS_ONLN")
#build-jobs = N
# build-type to use - values can be (depending on the capabilities of the 'build' script)
# empty - chroot build
# kvm - kvm VM build (needs build-device, build-swap, build-memory)
# xen - xen VM build (needs build-device, build-swap, build-memory)
# experimental:
# qemu - qemu VM build
# lxc - lxc build
#build-type =
# build-device is the disk-image file to use as root for VM builds
# e.g. /var/tmp/FILE.root
# if no build-vmdisk-autosetup is used, the file must be present/created
#build-device = /var/tmp/FILE.root
# build-swap is the disk-image to use as swap for VM builds
# if no build-vmdisk-autosetup is used, the file must be present/created
# e.g. /var/tmp/FILE.swap
#build-swap = /var/tmp/FILE.swap
# build-memory is the amount of memory used in the VM
# value in MB - e.g. 512
#build-memory = 512
# build-vmdisk-autosetup enabled the automatic creation of VM build disks
# possible values: 0 / 1
build-vmdisk-autosetup = 0
# build-vmdisk-rootsize is the size of the disk-image used as root in a VM build
# values in MB - e.g. 4096
#build-vmdisk-rootsize = 4096
# build-vmdisk-swapsize is the size of the disk-image used as swap in a VM build
# values in MB - e.g. 1024
#build-vmdisk-swapsize = 1024
# build-vmdisk-force can be set to 1 to force the (re-)setup of the VM disk images
# possible values: 0 / 1
#build-vmdisk-force = 0
# Numeric uid:gid to assign to the "abuild" user in the build-root
# or "caller" to use the current users uid:gid
# This is convenient when sharing the buildroot with ordinary userids