From 74cf2a1a139266f645690c7d9e9a0eed6b84cbaa Mon Sep 17 00:00:00 2001 From: Mikael Simberg Date: Thu, 21 Nov 2024 17:33:46 +0100 Subject: [PATCH 1/3] Make literal spack commit available in uenv --- stackinator/builder.py | 6 +++++- stackinator/etc/envvars.py | 8 ++++++-- stackinator/templates/Makefile | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/stackinator/builder.py b/stackinator/builder.py index c608322..372586a 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 = { + "commit_literal": 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..bdb9104 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_commit_literal, spack_version = args.spack.split(",") spack_path = f"{args.mount}/config".replace("//", "/") meta["views"]["spack"] = { "activate": "/dev/null", @@ -548,6 +548,7 @@ def meta_impl(args): "list": {}, "scalar": { "UENV_SPACK_CONFIG_PATH": spack_path, + "UENV_SPACK_COMMIT_LITERAL": spack_commit_literal, "UENV_SPACK_COMMIT": spack_version, "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_commit_literal,git_commit"', + type=str, + default=None, ) args = parser.parse_args() diff --git a/stackinator/templates/Makefile b/stackinator/templates/Makefile index 8404981..73927d2 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.commit_literal }},{{ spack_meta.commit }}' $(STORE) touch env-meta post-install: env-meta From c13b07f8409d035cccd5454fa65f8cfd95fb2b7e Mon Sep 17 00:00:00 2001 From: Mikael Simberg Date: Fri, 22 Nov 2024 12:04:31 +0100 Subject: [PATCH 2/3] Rename spack_version variable to spack_commit to match naming elsewhere --- stackinator/etc/envvars.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stackinator/etc/envvars.py b/stackinator/etc/envvars.py index bdb9104..18cbc76 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_commit_literal, spack_version = args.spack.split(",") + spack_url, spack_commit_literal, spack_commit = args.spack.split(",") spack_path = f"{args.mount}/config".replace("//", "/") meta["views"]["spack"] = { "activate": "/dev/null", @@ -549,7 +549,7 @@ def meta_impl(args): "scalar": { "UENV_SPACK_CONFIG_PATH": spack_path, "UENV_SPACK_COMMIT_LITERAL": spack_commit_literal, - "UENV_SPACK_COMMIT": spack_version, + "UENV_SPACK_COMMIT": spack_commit, "UENV_SPACK_URL": spack_url, }, }, From 5091c12611b8db7017408d2e5959fbeacbcbc701 Mon Sep 17 00:00:00 2001 From: Mikael Simberg Date: Fri, 22 Nov 2024 14:16:10 +0100 Subject: [PATCH 3/3] Rename commit literal to ref --- stackinator/builder.py | 2 +- stackinator/etc/envvars.py | 6 +++--- stackinator/templates/Makefile | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stackinator/builder.py b/stackinator/builder.py index ddc4a5a..6dea8f5 100644 --- a/stackinator/builder.py +++ b/stackinator/builder.py @@ -235,7 +235,7 @@ def generate(self, recipe): ["git", "-C", spack_path, "rev-parse", "HEAD"], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) spack_meta = { - "commit_literal": spack["commit"], + "ref": spack["commit"], "commit": git_commit_result.stdout.strip().decode("utf-8"), "url": spack["repo"], } diff --git a/stackinator/etc/envvars.py b/stackinator/etc/envvars.py index 18cbc76..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_commit_literal, spack_commit = 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,7 @@ def meta_impl(args): "list": {}, "scalar": { "UENV_SPACK_CONFIG_PATH": spack_path, - "UENV_SPACK_COMMIT_LITERAL": spack_commit_literal, + "UENV_SPACK_REF": spack_ref, "UENV_SPACK_COMMIT": spack_commit, "UENV_SPACK_URL": spack_url, }, @@ -588,7 +588,7 @@ def meta_impl(args): 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_literal,git_commit"', + help='configure a spack view. Format is "spack_url,git_ref,git_commit"', type=str, default=None, ) diff --git a/stackinator/templates/Makefile b/stackinator/templates/Makefile index 73927d2..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_literal }},{{ 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