diff --git a/bin/yashchiki b/bin/yashchiki index 8970d3f17029682e24419f1cc6dd490b45b41ef6..6d17e3a9e1d408bb6a12e95e0fdd15b7e82393c8 100755 --- a/bin/yashchiki +++ b/bin/yashchiki @@ -134,9 +134,6 @@ args = parser.parse_args() root_dir = pathlib.Path(__file__).parent.parent # check provided paths -if not args.spack_dir.is_dir(): - raise NotADirectoryError("spack_dir is required to be a path to an " - "existing directory.") if (args.meta_dir is not None) and (not args.meta_dir.is_dir()): raise NotADirectoryError("meta-dir is required to be a path to an " "existing directory.") @@ -191,14 +188,19 @@ env.update({ "YASHCHIKI_JOBS": str(args.jobs), }) +needs_spackdir = False + if "fetch" in args.stages: env.update({"YASHCHIKI_ENABLE_STAGE_FETCH": "1"}) + needs_spackdir = True if "build-base" in args.stages: env.update({"YASHCHIKI_ENABLE_STAGE_BUILD_BASE": "1"}) + needs_spackdir = True if "build-spack" in args.stages: env.update({"YASHCHIKI_ENABLE_STAGE_BUILD_SPACK": "1"}) + needs_spackdir = True if "image" in args.stages: env.update({"YASHCHIKI_ENABLE_STAGE_IMAGE": "1"}) @@ -207,6 +209,11 @@ 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 needs_spackdir: + if not args.spack_dir.is_dir(): + raise NotADirectoryError("spack_dir is required to be a path to an " + "existing directory.") + if args.build_cache_on_failure_name: env.update({"YASHCHIKI_BUILD_CACHE_ON_FAILURE_NAME": args.build_cache_on_failure_name})