From 4b0a6ed29f82467f3274e16c5ba8a3368ee044c0 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 26 Aug 2015 12:23:41 +0200 Subject: [PATCH] makebuildserver: allow a list/tuple for baseboxurl to support local copy config.vm.box_url can be a list/tuple of URLs, which is useful to specific a locally cached copy. This is needed on slow connections, so that if it fails, the download of jessie32.box does not have to start from the beginning of the file again. --- examples/makebs.config.py | 2 ++ makebuildserver | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/makebs.config.py b/examples/makebs.config.py index 9220fb12..615029b3 100644 --- a/examples/makebs.config.py +++ b/examples/makebs.config.py @@ -10,6 +10,8 @@ basebox = "jessie32" # in a secure environment using trusted media (see the manual) but # you can use this default if you like... baseboxurl = "https://f-droid.org/jessie32.box" +# or if you have a cached local copy, you can use that first: +# baseboxurl = ["file:///home/fdroid/fdroidserver/cache/jessie32.box", "https://f-droid.org/jessie32.box"] # The amount of RAM the build server will have memory = 3584 diff --git a/makebuildserver b/makebuildserver index 5b4862f3..cdac06fa 100755 --- a/makebuildserver +++ b/makebuildserver @@ -164,6 +164,11 @@ for f, src, shasum in cachefiles: wanted.append(f) +# allow specifying a list/tuple that includes cached local copy +if type(config['baseboxurl']) in (list, tuple) or config['baseboxurl'][0] in ('(', '['): + baseboxurl = config['baseboxurl'] +else: + baseboxurl = '"{0}"'.format(config['baseboxurl']) # Generate an appropriate Vagrantfile for the buildserver, based on our # settings... @@ -178,7 +183,7 @@ Vagrant.configure("2") do |config| end config.vm.box = "{0}" - config.vm.box_url = "{1}" + config.vm.box_url = {1} config.vm.provider "virtualbox" do |v| v.customize ["modifyvm", :id, "--memory", "{2}"] @@ -187,7 +192,7 @@ Vagrant.configure("2") do |config| config.vm.provision :shell, :path => "fixpaths.sh" """.format(config['basebox'], - config['baseboxurl'], + baseboxurl, config['memory'], config.get('cpus', 1)) if 'aptproxy' in config and config['aptproxy']: