]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
mkosi: properly remove root tree and /var/tmp between first and second build 55/head
authorLennart Poettering <lennart@poettering.net>
Thu, 22 Dec 2016 15:26:02 +0000 (16:26 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 21 Feb 2017 19:40:05 +0000 (20:40 +0100)
Let's make sure to remove both the old OS tree and its /var/tmp file
after the first build finished and we ran the build script inside of it,
but before we start the next iteration.

This fixes "-t directory" builds.

mkosi

diff --git a/mkosi b/mkosi
index cc3fffcd3268cf0cbb4914fe05ea7b8bb72d0989..3da363fab44d410f87c8eba6d4272d58edf9ee7f 100755 (executable)
--- a/mkosi
+++ b/mkosi
@@ -2291,10 +2291,6 @@ def build_image(args, workspace, run_build_script):
 
     tar = make_tar(args, workspace.name, run_build_script)
 
-    # Remove the root directory again, if this is the build script build
-    if run_build_script:
-        unlink_try_hard(os.path.join(workspace.name, "root"))
-
     return raw, tar, root_hash
 
 def var_tmp(workspace):
@@ -2363,6 +2359,11 @@ def build_stuff(args):
     if tar is not None:
         del tar
 
+    if args.build_script is not None:
+        with complete_step("Removing artifacts from development build"):
+            unlink_try_hard(os.path.join(workspace.name, "root"))
+            unlink_try_hard(os.path.join(workspace.name, "var-tmp"))
+
     raw, tar, root_hash = build_image(args, workspace, run_build_script=False)
 
     raw = xz_output(args, raw)