From b5fd72291180899fe3d1367e22916ea1c8a269f8 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Wed, 10 Jul 2013 16:45:34 +0100 Subject: [PATCH] Fix non-cached buildserver build-tools install --- .../cookbooks/android-sdk/recipes/default.rb | 2 +- fdroidserver/build.py | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/buildserver/cookbooks/android-sdk/recipes/default.rb b/buildserver/cookbooks/android-sdk/recipes/default.rb index 78f5eccc..19ddda61 100644 --- a/buildserver/cookbooks/android-sdk/recipes/default.rb +++ b/buildserver/cookbooks/android-sdk/recipes/default.rb @@ -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" diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 3a051b52..f3c039aa 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -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) -- 2.30.2