diff --git a/stackinator/builder.py b/stackinator/builder.py index 33d4727..6dea8f5 100644 --- a/stackinator/builder.py +++ b/stackinator/builder.py @@ -234,7 +234,11 @@ def generate(self, recipe): git_commit_result = subprocess.run( ["git", "-C", spack_path, "rev-parse", "HEAD"], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) - spack_meta = {"commit": git_commit_result.stdout.strip().decode("utf-8"), "url": spack["repo"]} + spack_meta = { + "ref": spack["commit"], + "commit": git_commit_result.stdout.strip().decode("utf-8"), + "url": spack["repo"], + } # load the jinja templating environment template_path = self.root / "templates" diff --git a/stackinator/etc/envvars.py b/stackinator/etc/envvars.py index 384fc9b..63ca1a0 100755 --- a/stackinator/etc/envvars.py +++ b/stackinator/etc/envvars.py @@ -535,7 +535,7 @@ def meta_impl(args): } if args.spack is not None: - spack_url, spack_version = args.spack.split(",") + spack_url, spack_ref, spack_commit = args.spack.split(",") spack_path = f"{args.mount}/config".replace("//", "/") meta["views"]["spack"] = { "activate": "/dev/null", @@ -548,7 +548,8 @@ def meta_impl(args): "list": {}, "scalar": { "UENV_SPACK_CONFIG_PATH": spack_path, - "UENV_SPACK_COMMIT": spack_version, + "UENV_SPACK_REF": spack_ref, + "UENV_SPACK_COMMIT": spack_commit, "UENV_SPACK_URL": spack_url, }, }, @@ -586,7 +587,10 @@ def meta_impl(args): uenv_parser.add_argument("mount", help="mount point of the image", type=str) uenv_parser.add_argument("--modules", help="configure a module view", action="store_true") uenv_parser.add_argument( - "--spack", help='configure a spack view. Format is "spack_url,git_commit"', type=str, default=None + "--spack", + help='configure a spack view. Format is "spack_url,git_ref,git_commit"', + type=str, + default=None, ) args = parser.parse_args() diff --git a/stackinator/templates/Makefile b/stackinator/templates/Makefile index 8404981..f43595d 100644 --- a/stackinator/templates/Makefile +++ b/stackinator/templates/Makefile @@ -69,7 +69,7 @@ modules-done: environments generate-config env-meta: generate-config environments{% if modules %} modules-done{% endif %} - $(SANDBOX) $(BUILD_ROOT)/envvars.py uenv {% if modules %}--modules{% endif %} --spack={{ spack_meta.url }},{{ spack_meta.commit }} $(STORE) + $(SANDBOX) $(BUILD_ROOT)/envvars.py uenv {% if modules %}--modules{% endif %} --spack='{{ spack_meta.url }},{{ spack_meta.ref }},{{ spack_meta.commit }}' $(STORE) touch env-meta post-install: env-meta