From 1051f7d349616c20e81e75447bffc35530f43933 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de>
Date: Fri, 16 Aug 2024 14:38:26 +0200
Subject: [PATCH] chore: add update-build-cache as a (non-default) stage
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(Keep old option for now…)

Change-Id: I65725572f3171f28e29673e26d22f45909a6e001
---
 bin/yashchiki | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/bin/yashchiki b/bin/yashchiki
index 4a904865..2f24443c 100755
--- a/bin/yashchiki
+++ b/bin/yashchiki
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 
 import argparse
+import copy
 import os
 import pathlib
 import subprocess
@@ -51,7 +52,9 @@ parser = argparse.ArgumentParser(
               to OUTPUT.
     """))
 
-all_stages=set(["fetch", "build-base-image", "build-base", "build-spack", "image"])
+all_stages=["fetch", "build-base-image", "build-base", "build-spack", "image", "update-build-cache"]
+default_stages = copy.copy(all_stages)
+default_stages.remove("update-build-cache")
 
 all_styles = list(os.listdir(os.path.dirname(os.path.realpath(__file__)) + "/../share/yashchiki/styles/"))
 
@@ -72,7 +75,7 @@ parser.add_argument(
     "--update-build-cache", action="store_true",
     help="Update build cache.")
 parser.add_argument(
-    "--stages", type=str, nargs="+", choices=all_stages, default=all_stages,
+    "--stages", type=str, nargs="+", choices=all_stages, default=default_stages,
     help="Stages of build to perform.")
 # optional with persistent default
 parser.add_argument(
@@ -351,7 +354,8 @@ run(str(pathlib.Path("share", "yashchiki", "styles", args.style,
     env)
 run("lib/yashchiki/build_sandbox.sh", env)
 run("lib/yashchiki/build_image.sh", env)
-if args.update_build_cache:
+
+if args.update_build_cache or "update-build-cache" in args.stages:
     run("lib/yashchiki/update_build_cache.sh", env, ["-c", args.output])
 
 if args.tmpdir is None:
-- 
GitLab