chiark / gitweb /
Fix non-cached buildserver build-tools install
authorCiaran Gultnieks <ciaran@ciarang.com>
Wed, 10 Jul 2013 15:45:34 +0000 (16:45 +0100)
committerCiaran Gultnieks <ciaran@ciarang.com>
Wed, 10 Jul 2013 15:45:34 +0000 (16:45 +0100)
buildserver/cookbooks/android-sdk/recipes/default.rb
fdroidserver/build.py

index 78f5eccc07e18a0a68546afd79601a8134e03caf..19ddda61f2ab60f0701d343e6d151146836ecae8 100644 (file)
@@ -37,7 +37,7 @@ script "add_build_tools" do
       echo Installing from cache
       tar -C #{sdk_loc}/build-tools -z -x -f /vagrant/cache/build-tools/17.0.0.tar.gz
     else
-      echo Need the right install filter for this
+      #{sdk_loc}/tools/android update sdk --no-ui -a -t build-tools-17.0.0
     fi
   "
   not_if "test -d #{sdk_loc}/build-tools/17.0.0"
index 3a051b52db49f8d3856dd5fde1a8f14fb9741be5..f3c039aa9a87e10100ff0924aafc6d107fa9b89f 100644 (file)
@@ -46,6 +46,22 @@ def get_builder_vm_id():
             v = json.load(vf)
         return v['active']['default']
 
+def got_valid_builder_vm():
+    """Returns True if we have a valid-looking builder vm
+    """
+    if not os.path.exists(os.path.join('builder', 'Vagrantfile')):
+        return False
+    vd = os.path.join('builder', '.vagrant')
+    if not os.path.exists(vd):
+        return False
+    if not os.path.isdir(vd):
+        # Vagrant 1.0 - if the directory is there, it's valid...
+        return True
+    # Vagrant 1.2 - the directory can exist, but the id can be missing...
+    if not os.path.exists(os.path.join(vd, 'machines', 'default', 'virtualbox', 'id')):
+        return False
+    return True
+
 
 # Note that 'force' here also implies test mode.
 def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
@@ -57,8 +73,7 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
     vm_ok = False
     if not options.resetserver:
         print "Checking for valid existing build server"
-        if (os.path.exists(os.path.join('builder', 'Vagrantfile')) and 
-                os.path.exists(os.path.join('builder', '.vagrant'))):
+        if got_valid_builder_vm():
             print "...VM is present"
             p = subprocess.Popen(['VBoxManage', 'snapshot', get_builder_vm_id(), 'list', '--details'],
                 cwd='builder', stdout=subprocess.PIPE)