chiark / gitweb /
buildserver: consolidate boxfile export code into one block
authorHans-Christoph Steiner <hans@eds.org>
Mon, 26 Sep 2016 09:22:05 +0000 (05:22 -0400)
committerHans-Christoph Steiner <hans@eds.org>
Tue, 23 May 2017 18:04:08 +0000 (20:04 +0200)
This is just for clarity, and moving more code into the main() function.

makebuildserver

index 4985b22fbc81bbfb5a16c93b31a80ea0ea102b98..48828925f04b509daa6b9a3e8d3d987e3b44050e 100755 (executable)
@@ -20,7 +20,6 @@ if not os.path.exists('makebuildserver') and not os.path.exists('buildserver'):
     sys.exit(1)
 
 
-boxfile = os.path.join(os.getcwd(), 'buildserver.box')
 tail = None
 
 parser = OptionParser()
@@ -69,9 +68,6 @@ elif os.path.exists('makebs.config.py'):
 if '__builtins__' in config:
     del(config['__builtins__'])  # added by compile/exec
 
-if os.path.exists(boxfile):
-    os.remove(boxfile)
-
 # Update cached files.
 cachedir = config['cachedir']
 if not os.path.exists(cachedir):
@@ -471,6 +467,9 @@ def main():
     v.halt()
 
     print("Packaging")
+    boxfile = os.path.join(os.getcwd(), 'buildserver.box')
+    if os.path.exists(boxfile):
+        os.remove(boxfile)
     v.package(output=boxfile)
 
     print("Adding box")