Merge branch 'fixes-on-the-way-to-kvm' into 'master'

buildserver fixes on the way to KVM

Here are a couple of relatively basic fixes I found while working on the KVM support (merge request coming soon).

See merge request !174
This commit is contained in:
Ciaran Gultnieks 2016-10-05 18:09:18 +00:00
commit 749c04c66a
3 changed files with 16 additions and 17 deletions

View file

@ -15,8 +15,15 @@ Vagrant.configure("2") do |config|
config.vm.box = configfile['basebox'] config.vm.box = configfile['basebox']
config.vm.box_url = configfile['baseboxurl'] config.vm.box_url = configfile['baseboxurl']
# TODO detect if jessie64.box is libvirt, or `vagrant mutate jessie64 libvirt` if not configfile.has_key? "vm_provider" or configfile["vm_provider"] == "virtualbox"
if `systemd-detect-virt`.include? "qemu" or configfile["vm_provider"] == "libvirt" # default to VirtualBox if not set
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", configfile['memory']]
v.customize ["modifyvm", :id, "--cpus", configfile['cpus']]
v.customize ["modifyvm", :id, "--hwvirtex", configfile['hwvirtex']]
end
synced_folder_type = 'virtualbox'
elsif configfile["vm_provider"] == "libvirt"
# use KVM/QEMU if this is running in KVM/QEMU # use KVM/QEMU if this is running in KVM/QEMU
config.vm.provider :libvirt do |libvirt| config.vm.provider :libvirt do |libvirt|
libvirt.driver = "kvm" libvirt.driver = "kvm"
@ -27,14 +34,6 @@ Vagrant.configure("2") do |config|
end end
config.vm.synced_folder './', '/vagrant', type: '9p' config.vm.synced_folder './', '/vagrant', type: '9p'
synced_folder_type = '9p' synced_folder_type = '9p'
elsif not configfile.has_key? "vm_provider" or configfile["vm_provider"] == "virtualbox"
# default to VirtualBox if not set
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", configfile['memory']]
v.customize ["modifyvm", :id, "--cpus", configfile['cpus']]
v.customize ["modifyvm", :id, "--hwvirtex", configfile['hwvirtex']]
end
synced_folder_type = 'virtualbox'
else else
abort("No supported VM Provider found, set vm_provider in Vagrantfile.yaml!") abort("No supported VM Provider found, set vm_provider in Vagrantfile.yaml!")
end end

View file

@ -1,4 +1,3 @@
#!/bin/bash #!/bin/bash
if [ `dirname $0` != "." ]; then if [ `dirname $0` != "." ]; then

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
import pathlib
import requests import requests
import stat import stat
import sys import sys
@ -12,6 +13,11 @@ from clint.textui import progress
from optparse import OptionParser from optparse import OptionParser
if not os.path.exists('makebuildserver') and not os.path.exists('buildserver'):
print('This must be run as ./makebuildserver in fdroidserver.git!')
sys.exit(1)
def vagrant(params, cwd=None, printout=False): def vagrant(params, cwd=None, printout=False):
"""Run vagrant. """Run vagrant.
@ -52,9 +58,8 @@ options, args = parser.parse_args()
cachedir = os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver') cachedir = os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver')
config = { config = {
'basebox': 'jessie64', 'basebox': 'jessie64',
# TODO in py3, convert this to pathlib.Path(absolute_path_string).as_uri()
'baseboxurl': [ 'baseboxurl': [
'file://' + os.path.join(cachedir, 'jessie64.box'), pathlib.Path(os.path.join(cachedir, 'jessie64.box')).as_uri(),
'https://f-droid.org/jessie64.box', 'https://f-droid.org/jessie64.box',
], ],
'debian_mirror': 'http://http.debian.net/debian/', 'debian_mirror': 'http://http.debian.net/debian/',
@ -87,10 +92,6 @@ elif os.path.exists('makebs.config.py'):
if '__builtins__' in config: if '__builtins__' in config:
del(config['__builtins__']) # added by compile/exec del(config['__builtins__']) # added by compile/exec
if not os.path.exists('makebuildserver') or not os.path.exists(serverdir):
print('This must be run from the correct directory!')
sys.exit(1)
if os.path.exists(boxfile): if os.path.exists(boxfile):
os.remove(boxfile) os.remove(boxfile)