chiark / gitweb /
allow setting up an apt package cache for the build server setup
authorHans-Christoph Steiner <hans@eds.org>
Tue, 26 Jan 2016 10:21:21 +0000 (11:21 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Wed, 3 Feb 2016 13:54:14 +0000 (14:54 +0100)
This creates a cache folder which will store the apt cache from the VM.

examples/makebuildserver.config.py
makebuildserver

index cc536844b5dfb7dec8beaae02755dded096f0420..4747dc885136d397102bf2ccee2f05d87e7b8ace 100644 (file)
 #
 # cachedir = 'buildserver/cache'
 
+# A big part of creating a new instance is downloading packages from Debian.
+# This setups up a folder in ~/.cache/fdroidserver to cache the downloaded
+# packages when rebuilding the build server from scratch.  This requires
+# that virtualbox-guest-utils is installed.
+#
+# apt_package_cache = True
+
 # To specify which Debian mirror the build server VM should use, by
 # default it uses http.debian.net, which auto-detects which is the
 # best mirror to use.
index 77c6063cce22fe792ce22e64ce477b4af79f62ad..6f476625f84944a9b5421cc71667076a87b93b70 100755 (executable)
@@ -54,6 +54,7 @@ config = {
         'https://f-droid.org/jessie32.box',
     ],
     'debian_mirror': 'http://http.debian.net/debian/',
+    'apt_package_cache': False,
     'boot_timeout': 600,
     'cachedir': cachedir,
     'cpus': 1,
@@ -374,6 +375,14 @@ if cachedir != 'buildserver/cache':
   config.vm.synced_folder '{0}', '/vagrant/cache'
 """.format(cachedir)
 
+# cache .deb packages on the host via a mount trick
+if config['apt_package_cache']:
+    aptcachedir = cachedir + '/apt/archives'
+    vagrantfile += """
+  config.vm.synced_folder "{0}", "/var/cache/apt/archives",
+    owner: 'root', group: 'root', create: true
+""".format(aptcachedir)
+
 vagrantfile += """
   config.vm.provision :chef_solo do |chef|
     chef.cookbooks_path = "cookbooks"