mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-17 18:50:11 +02:00
Compatibility with vagrant 1.2
This commit is contained in:
parent
b9fa583c99
commit
398cebd400
@ -34,9 +34,17 @@ from common import VCSException
|
|||||||
|
|
||||||
|
|
||||||
def get_builder_vm_id():
|
def get_builder_vm_id():
|
||||||
with open(os.path.join('builder', '.vagrant')) as vf:
|
vd = os.path.join('builder', '.vagrant')
|
||||||
v = json.load(vf)
|
if os.path.isdir(vd):
|
||||||
return v['active']['default']
|
# Vagrant 1.2 (and maybe 1.1?) it's a directory tree...
|
||||||
|
with open(os.path.join(vd, 'machines', 'default', 'virtualbox', 'id')) as vf:
|
||||||
|
id = vf.read()
|
||||||
|
return id
|
||||||
|
else:
|
||||||
|
# Vagrant 1.0 - it's a json file...
|
||||||
|
with open(os.path.join('builder', '.vagrant')) as vf:
|
||||||
|
v = json.load(vf)
|
||||||
|
return v['active']['default']
|
||||||
|
|
||||||
|
|
||||||
# Note that 'force' here also implies test mode.
|
# Note that 'force' here also implies test mode.
|
||||||
@ -82,11 +90,19 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
|
|||||||
subprocess.call(['vagrant', 'destroy', '-f'], cwd='builder')
|
subprocess.call(['vagrant', 'destroy', '-f'], cwd='builder')
|
||||||
shutil.rmtree('builder')
|
shutil.rmtree('builder')
|
||||||
os.mkdir('builder')
|
os.mkdir('builder')
|
||||||
with open('builder/Vagrantfile', 'w') as vf:
|
|
||||||
vf.write('Vagrant::Config.run do |config|\n')
|
p = subprocess.Popen('vagrant --version', shell=True, stdout=subprocess.PIPE)
|
||||||
vf.write('config.vm.box = "buildserver"\n')
|
vver = p.communicate()[0]
|
||||||
vf.write('config.vm.customize ["modifyvm", :id, "--memory", "768"]\n')
|
if vver.startswith('Vagrant version 1.2'):
|
||||||
vf.write('end\n')
|
with open('builder/Vagrantfile', 'w') as vf:
|
||||||
|
vf.write('Vagrant.configure("2") do |config|\n')
|
||||||
|
vf.write('config.vm.box = "buildserver"\n')
|
||||||
|
vf.write('end\n')
|
||||||
|
else:
|
||||||
|
with open('builder/Vagrantfile', 'w') as vf:
|
||||||
|
vf.write('Vagrant::Config.run do |config|\n')
|
||||||
|
vf.write('config.vm.box = "buildserver"\n')
|
||||||
|
vf.write('end\n')
|
||||||
|
|
||||||
print "Starting new build server"
|
print "Starting new build server"
|
||||||
if subprocess.call(['vagrant', 'up'], cwd='builder') != 0:
|
if subprocess.call(['vagrant', 'up'], cwd='builder') != 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user