1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-20 13:50:12 +01:00

use overhauled mv destroy code in build.py

This commit is contained in:
Michael Pöhn 2017-03-26 01:51:28 +01:00 committed by Hans-Christoph Steiner
parent 92fada803e
commit a414aa00ff
2 changed files with 6 additions and 22 deletions

View File

@ -37,6 +37,7 @@ from . import common
from . import net
from . import metadata
from . import scanner
from . import vmtools
from .common import FDroidPopen, SdkToolsPopen
from .exception import FDroidException, BuildException, VCSException
@ -289,8 +290,10 @@ def vm_get_clean_builder(reset=False):
# If we can't use the existing machine for any reason, make a
# new one from scratch.
if not vm_ok:
vm_destroy_builder(provider)
if os.path.isdir('builder'):
vm = vmtools.get_build_vm('builder')
vm.destroy()
else:
os.mkdir('builder')
p = subprocess.Popen(['vagrant', '--version'],
@ -348,24 +351,6 @@ def vm_suspend_builder():
subprocess.call(['vagrant', 'suspend'], cwd='builder')
def vm_destroy_builder(provider):
"""Savely destroy the builder vm.
"""
logging.info("Removing broken/incomplete/unwanted build server")
if os.path.exists(os.path.join('builder', 'Vagrantfile')):
vagrant(['destroy', '-f'], cwd='builder')
if os.path.isdir('builder'):
shutil.rmtree('builder')
# get rid of vm and related disk images
FDroidPopen(('virsh', '-c', 'qemu:///system', 'destroy', 'builder_default'))
logging.info("...waiting a sec...")
time.sleep(10)
FDroidPopen(('virsh', '-c', 'qemu:///system', 'undefine', 'builder_default', '--nvram', '--managed-save', '--remove-all-storage', '--snapshots-metadata'))
logging.info("...waiting a sec...")
time.sleep(10)
# Note that 'force' here also implies test mode.
def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
"""Do a build on the builder vm.

View File

@ -14,7 +14,6 @@ import hashlib
import yaml
import math
import json
import time
import logging
from clint.textui import progress
from optparse import OptionParser