1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 02:50:12 +01:00

vmtools: use whatever buildserver box is available

When we don't have an already working builder/.vagrant directory
look for available buildserver vagrant boxes because we'll need to
import one.

Abort if there's no buildserver box.

Fixes: #497
This commit is contained in:
Marcus Hoffmann 2018-09-12 14:04:09 +02:00
parent ad9a07b47e
commit 1b95452c14

View File

@ -149,8 +149,25 @@ def get_build_vm(srvdir, provider=None):
logging.debug('build vm provider lookup found \'virtualbox\'')
return VirtualboxBuildVm(abssrvdir)
logging.info('build vm provider lookup could not determine provider, defaulting to \'virtualbox\'')
return VirtualboxBuildVm(abssrvdir)
# try guessing provider from available buildserver boxes
available_boxes = []
import vagrant
boxes = vagrant.Vagrant().box_list()
for box in boxes:
if box.name == "buildserver":
available_boxes.append(box.provider)
if "libvirt" in available_boxes and "virtualbox" in available_boxes:
logging.info('basebox lookup found virtualbox and libvirt boxes, defaulting to \'virtualbox\'')
return VirtualboxBuildVm(abssrvdir)
elif "libvirt" in available_boxes:
logging.info('\'libvirt\' buildserver box available, using that')
return LibvirtBuildVm(abssrvdir)
elif "virtualbox" in available_boxes:
logging.info('\'virtualbox\' buildserver box available, using that')
return VirtualboxBuildVm(abssrvdir)
else:
logging.error('No available \'buildserver\' box. Cannot proceed')
os._exit(1)
class FDroidBuildVmException(FDroidException):