diff --git a/examples/makebuildserver.config.py b/examples/makebuildserver.config.py index 3c243899..ba373858 100644 --- a/examples/makebuildserver.config.py +++ b/examples/makebuildserver.config.py @@ -3,16 +3,7 @@ # You may want to alter these before running ./makebuildserver # Name of the base box to use -# basebox = "jessie64" - -# Location where testing32.box can be found, if you don't already have -# it. For security reasons, it's recommended that you make your own -# in a secure environment using trusted media (see the manual) but -# you can use this default if you like... -# baseboxurl = "https://f-droid.org/jessie64.box" -# -# or if you have a cached local copy, you can use that first: -# baseboxurl = ["file:///home/fdroid/fdroidserver/cache/jessie64.box", "https://f-droid.org/jessie64.box"] +# basebox = "fdroid-stretch64" # In the process of setting up the build server, many gigs of files # are downloaded (Android SDK components, gradle, etc). These are diff --git a/makebuildserver b/makebuildserver index 6fc3de23..2411afb1 100755 --- a/makebuildserver +++ b/makebuildserver @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import os -import pathlib import re import requests import stat @@ -56,10 +55,7 @@ cachedir = os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver') logger.debug('cachedir set to: %s', cachedir) config = { - 'basebox': 'jessie64', - 'baseboxurl': [ - pathlib.Path(os.path.join(cachedir, 'jessie64.box')).as_uri() - ], + 'basebox': 'fdroid-stretch64', 'debian_mirror': 'http://http.debian.net/debian/', 'apt_package_cache': False, 'copy_caches_from_host': False, @@ -535,23 +531,25 @@ def main(): with open(vf, 'w', encoding='utf-8') as f: yaml.dump(config, f) - if config['vm_provider'] == 'libvirt': - available_providers = [x.provider for x in v.box_list() if x.name == config['basebox']] - found_basebox = len(available_providers) > 0 - needs_mutate = 'libvirt' not in available_providers - if not found_basebox: - if isinstance(config['baseboxurl'], str): - baseboxurl = config['baseboxurl'] - else: - baseboxurl = config['baseboxurl'][0] - logger.info('Adding %s from %s', config['basebox'], baseboxurl) - v.box_add(config['basebox'], baseboxurl) - needs_mutate = True - if needs_mutate: - logger.info('Converting %s to libvirt format', config['basebox']) - v._call_vagrant_command(['mutate', config['basebox'], 'libvirt']) - logger.info('Removing virtualbox format copy of %s', config['basebox']) - v.box_remove(config['basebox'], 'virtualbox') + # Check if selected provider is supported + if config['vm_provider'] not in ['libvirt', 'virtualbox']: + logger.critical("Currently selected VM provider '{vm_provider}' " + "is not supported. (please choose from: " + "virtualbox, libvirt)" + .format(vm_provider=config['cm_provider'])) + sys.exit(1) + # Check if selected basebox is available + available_boxes_by_provider = [x.name for x in v.box_list() if x.provider == config['vm_provider']] + if config['basebox'] not in available_boxes_by_provider: + logger.critical("Vagrant box '{basebox}' not available " + "for '{vm_provider}' VM provider. " + "Please make sure it's added to vagrant. " + "(If you need a basebox to begin with, " + "here is how we're bootstrapping it: " + "https://gitlab.com/fdroid/basebox)" + .format(vm_provider=config['vm_provider'], + basebox=config['basebox'])) + sys.exit(1) logger.info("Configuring build server VM") debug_log_vagrant_vm(serverdir, config) @@ -559,7 +557,7 @@ def main(): v.up(provision=True) except subprocess.CalledProcessError: debug_log_vagrant_vm(serverdir, config) - logger.error("'vagrant up' failed, is the base box missing?") + logger.error("'vagrant up' failed.") sys.exit(1) if config['copy_caches_from_host']: