chiark / gitweb /
makebuildserver: allow a list/tuple for baseboxurl to support local copy
authorHans-Christoph Steiner <hans@eds.org>
Wed, 26 Aug 2015 10:23:41 +0000 (12:23 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Wed, 26 Aug 2015 12:46:53 +0000 (14:46 +0200)
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
makebuildserver

index 9220fb1269171825c08cc6f15177194d94fe4b5c..615029b34a742777bf448b180f4c19e27950bc9e 100644 (file)
@@ -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
index 5b4862f31bf3ddd13020196ad5b609b48d2fbb4f..cdac06fa31465996ea385b64295f08a180e992a9 100755 (executable)
@@ -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']: