diff --git a/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb b/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb index 0a42dc36..0b98cc59 100644 --- a/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb +++ b/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb @@ -1,5 +1,10 @@ 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 command "apt-get update" 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..1895c421 100755 --- a/makebuildserver +++ b/makebuildserver @@ -41,6 +41,8 @@ parser.add_option("-v", "--verbose", action="store_true", default=False, help="Spew out even more information than normal") parser.add_option("-c", "--clean", action="store_true", default=False, 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() config = {} @@ -164,6 +166,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 +185,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,13 +194,14 @@ 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']: vagrantfile += """ config.vm.provision :shell, :inline => 'sudo echo "Acquire::http {{ Proxy \\"{0}\\"; }};" > /etc/apt/apt.conf.d/02proxy && sudo apt-get update' """.format(config['aptproxy']) + vagrantfile += """ config.vm.provision :chef_solo do |chef| chef.cookbooks_path = "cookbooks" @@ -202,6 +210,7 @@ vagrantfile += """ :settings => { :sdk_loc => "/home/vagrant/android-sdk", :ndk_loc => "/home/vagrant/android-ndk", + :debian_mirror => "%s", :user => "vagrant" } } @@ -212,7 +221,7 @@ vagrantfile += """ chef.add_recipe "kivy" end end -""" +""" % (options.debian_mirror) # Check against the existing Vagrantfile, and if they differ, we need to # create a new box: