chiark / gitweb /
makebuildserver deal with apt cache lock
authorMichael Pöhn <michael.poehn@fsfe.org>
Sat, 8 Apr 2017 22:57:59 +0000 (00:57 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Tue, 23 May 2017 18:06:06 +0000 (20:06 +0200)
makebuildserver

index c88d665a47f1ce771b5ed810edc717e4565a51f3..02837239dfedc0c10434dda3cf5c7ee8d03b753a 100755 (executable)
@@ -6,6 +6,7 @@ import re
 import requests
 import stat
 import sys
+import shutil
 import subprocess
 import vagrant
 import hashlib
@@ -114,6 +115,14 @@ if config['vm_provider'] == 'libvirt':
 if config['apt_package_cache']:
     config['aptcachedir'] = cachedir + '/apt/archives'
     logger.debug('aptcachedir is set to %s', config['aptcachedir'])
+    aptcachelock = os.path.join(config['aptcachedir'], 'lock')
+    if os.path.isfile(aptcachelock):
+        logger.info('apt cache dir is locked, removing lock')
+        os.remove(aptcachelock)
+    aptcachepartial = os.path.join(config['aptcachedir'], 'partial')
+    if os.path.isdir(aptcachepartial):
+        logger.info('removing partial downloads from apt cache dir')
+        shutil.rmtree(aptcachepartial)
 
 cachefiles = [
     ('https://dl.google.com/android/repository/tools_r25.2.3-linux.zip',
@@ -486,9 +495,9 @@ def main():
     debug_log_vagrant_vm(serverdir, config['domain'])
     try:
         v.up(provision=True)
-    except subprocess.CalledProcessError as e:
+    except fdroidserver.vmtools.FDroidBuildVmException as e:
         debug_log_vagrant_vm(serverdir, config['domain'])
-        logger.critical('could not bring buildserver vm up. %s', e)
+        logger.exception('could not bring buildserver vm up. %s', e)
         sys.exit(1)
 
     if config['copy_caches_from_host']: