diff --git a/bin/yashchiki b/bin/yashchiki index 420d5a8bd1485e018ae15bf542c5785bc9018975..c58ecb97bf79b6de6d33b1fbf548079b422d558e 100755 --- a/bin/yashchiki +++ b/bin/yashchiki @@ -51,6 +51,8 @@ parser = argparse.ArgumentParser( to OUTPUT. """)) +all_stages=["fetch", "build-base", "build-spack", "image"] + all_styles = list(os.listdir(os.path.dirname(os.path.realpath(__file__)) + "/../share/yashchiki/styles/")) # mandatory @@ -67,6 +69,9 @@ parser.add_argument( 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, + help="Stages of build to perform.") # optional with persistent default parser.add_argument( "--caches-dir", type=pathlib.Path, @@ -179,6 +184,22 @@ env.update({ "YASHCHIKI_JOBS": str(args.jobs), }) +if "fetch" in args.stages: + env.update({"YASHCHIKI_ENABLE_STAGE_FETCH": "1"}) + +if "build-base" in args.stages: + env.update({"YASHCHIKI_ENABLE_STAGE_BUILD_BASE": "1"}) + +if "build-spack" in args.stages: + env.update({"YASHCHIKI_ENABLE_STAGE_BUILD_SPACK": "1"}) + +if "image" in args.stages: + env.update({"YASHCHIKI_ENABLE_STAGE_IMAGE": "1"}) + +if args.stages != all_stages: + if not pathlib.Path(args.sandboxes_dir, args.style).exists(): + raise RuntimeError("Using yashchiki with incomplete set of stages is only possible for using an existing sandbox.") + if args.build_cache_on_failure_name: env.update({"YASHCHIKI_BUILD_CACHE_ON_FAILURE_NAME": args.build_cache_on_failure_name}) diff --git a/lib/yashchiki/fetch.sh b/lib/yashchiki/fetch.sh index a1e8195fc0c87d7dd05d7934a854f4fce527e4a3..d9f6f57506666f33ccb8fd2120a3b3a2f24d6fed 100755 --- a/lib/yashchiki/fetch.sh +++ b/lib/yashchiki/fetch.sh @@ -6,6 +6,11 @@ shopt -s inherit_errexit SOURCE_DIR="$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")" source "${SOURCE_DIR}/commons.sh" +if [ -z "${YASHCHIKI_ENABLE_STAGE_FETCH:-}" ]; then + echo "Skipping stage fetch." + exit 0 +fi + # temporary spack config scope directory for fetching tmp_config_scope=("$(mktemp -d)")