X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=fdroidserver%2Fbuild.py;h=cb030ebb4abb8981d697dd67948694bf3495481f;hb=85985074d45832c8e0fb9295eda1f2614b42f7e3;hp=61cda139e88407f5961427824c689b2ef249b45a;hpb=9a4f3ac019d3dc3d9154db6b434f717623c4c0e2;p=fdroidserver.git diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 61cda139..cb030ebb 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -25,6 +25,7 @@ import re import resource import sys import tarfile +import threading import traceback import time import requests @@ -978,6 +979,13 @@ def trybuild(app, build, build_dir, output_dir, log_dir, also_check_dir, return True +def force_halt_build(): + """Halt the currently running Vagrant VM, to be called from a Timer""" + logging.error(_('Force halting build after timeout!')) + vm = vmtools.get_build_vm('builder') + vm.halt() + + def parse_commandline(): """Parse the command line. Returns options, parser.""" @@ -1143,6 +1151,12 @@ def main(): first = True for build in app.builds: + if options.server: # enable watchdog timer + timer = threading.Timer(7200, force_halt_build) + timer.start() + else: + timer = None + wikilog = None build_starttime = common.get_wiki_timestamp() tools_version_log = '' @@ -1283,6 +1297,9 @@ def main(): except Exception as e: logging.error("Error while attempting to publish build log: %s" % e) + if timer: + timer.cancel() # kill the watchdog timer + for app in build_succeeded: logging.info("success: %s" % (app.id))