chiark / gitweb /
Merge branch 'caching-for-makebuildserver' into 'master'
authorCiaran Gultnieks <ciaran@ciarang.com>
Wed, 26 Aug 2015 12:49:35 +0000 (12:49 +0000)
committerCiaran Gultnieks <ciaran@ciarang.com>
Wed, 26 Aug 2015 12:49:35 +0000 (12:49 +0000)
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

buildserver/cookbooks/fdroidbuild-general/recipes/default.rb
examples/makebs.config.py
makebuildserver

index 0a42dc367cdccc00e55b8c74dc9c2cce4581ce25..0b98cc598d7967a66ac5664c6e3e16fee52c63cf 100644 (file)
@@ -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"
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..1895c42144bb8487072ed4602a683fef6f8a09f9 100755 (executable)
@@ -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: