From dd93505fceb3d4a8293a0b153f2e09f9483f1247 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 26 Jan 2016 11:21:21 +0100 Subject: [PATCH] allow setting up an apt package cache for the build server setup This creates a cache folder which will store the apt cache from the VM. --- examples/makebuildserver.config.py | 7 +++++++ makebuildserver | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/examples/makebuildserver.config.py b/examples/makebuildserver.config.py index cc536844..4747dc88 100644 --- a/examples/makebuildserver.config.py +++ b/examples/makebuildserver.config.py @@ -21,6 +21,13 @@ # # 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. diff --git a/makebuildserver b/makebuildserver index 77c6063c..6f476625 100755 --- a/makebuildserver +++ b/makebuildserver @@ -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" -- 2.30.2