1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-09 00:40:11 +01:00

Merge branch 'caching-for-makebuildserver' into 'master'

two quick kinds of caching for makebuildserver

I've been running `./makebuildserver` on a machine that only connects to the internet via Tor.  That means slow internet and other issues.  These two small changes made it easier to run `./makebuildserver` in this setup.  In combination with !25, this would give good support for working in low bandwidth environments.

See merge request !67
This commit is contained in:
Ciaran Gultnieks 2015-08-26 12:49:35 +00:00
commit 76b86560f4
3 changed files with 19 additions and 3 deletions

View File

@ -1,5 +1,10 @@
user = node[:settings][:user] user = node[:settings][:user]
debian_mirror = node[:settings][:debian_mirror]
execute 'set_debian_mirror' do
command "sed -i 's,http://ftp.uk.debian.org/debian/,#{debian_mirror},g' /etc/apt/sources.list"
end
execute "apt-get-update" do execute "apt-get-update" do
command "apt-get update" command "apt-get update"

View File

@ -10,6 +10,8 @@ basebox = "jessie32"
# in a secure environment using trusted media (see the manual) but # in a secure environment using trusted media (see the manual) but
# you can use this default if you like... # you can use this default if you like...
baseboxurl = "https://f-droid.org/jessie32.box" 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 # The amount of RAM the build server will have
memory = 3584 memory = 3584

View File

@ -41,6 +41,8 @@ parser.add_option("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal") help="Spew out even more information than normal")
parser.add_option("-c", "--clean", action="store_true", default=False, parser.add_option("-c", "--clean", action="store_true", default=False,
help="Build from scratch, rather than attempting to update the existing server") help="Build from scratch, rather than attempting to update the existing server")
parser.add_option("--debian-mirror", default="http://ftp.uk.debian.org/debian/",
help="Use the specified Debian mirror in the box's /etc/apt/sources.list.")
options, args = parser.parse_args() options, args = parser.parse_args()
config = {} config = {}
@ -164,6 +166,11 @@ for f, src, shasum in cachefiles:
wanted.append(f) 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 # Generate an appropriate Vagrantfile for the buildserver, based on our
# settings... # settings...
@ -178,7 +185,7 @@ Vagrant.configure("2") do |config|
end end
config.vm.box = "{0}" config.vm.box = "{0}"
config.vm.box_url = "{1}" config.vm.box_url = {1}
config.vm.provider "virtualbox" do |v| config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", "{2}"] v.customize ["modifyvm", :id, "--memory", "{2}"]
@ -187,13 +194,14 @@ Vagrant.configure("2") do |config|
config.vm.provision :shell, :path => "fixpaths.sh" config.vm.provision :shell, :path => "fixpaths.sh"
""".format(config['basebox'], """.format(config['basebox'],
config['baseboxurl'], baseboxurl,
config['memory'], config['memory'],
config.get('cpus', 1)) config.get('cpus', 1))
if 'aptproxy' in config and config['aptproxy']: if 'aptproxy' in config and config['aptproxy']:
vagrantfile += """ vagrantfile += """
config.vm.provision :shell, :inline => 'sudo echo "Acquire::http {{ Proxy \\"{0}\\"; }};" > /etc/apt/apt.conf.d/02proxy && sudo apt-get update' config.vm.provision :shell, :inline => 'sudo echo "Acquire::http {{ Proxy \\"{0}\\"; }};" > /etc/apt/apt.conf.d/02proxy && sudo apt-get update'
""".format(config['aptproxy']) """.format(config['aptproxy'])
vagrantfile += """ vagrantfile += """
config.vm.provision :chef_solo do |chef| config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks" chef.cookbooks_path = "cookbooks"
@ -202,6 +210,7 @@ vagrantfile += """
:settings => { :settings => {
:sdk_loc => "/home/vagrant/android-sdk", :sdk_loc => "/home/vagrant/android-sdk",
:ndk_loc => "/home/vagrant/android-ndk", :ndk_loc => "/home/vagrant/android-ndk",
:debian_mirror => "%s",
:user => "vagrant" :user => "vagrant"
} }
} }
@ -212,7 +221,7 @@ vagrantfile += """
chef.add_recipe "kivy" chef.add_recipe "kivy"
end end
end end
""" """ % (options.debian_mirror)
# Check against the existing Vagrantfile, and if they differ, we need to # Check against the existing Vagrantfile, and if they differ, we need to
# create a new box: # create a new box: