Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make literal spack commit available in spack view #203

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion stackinator/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
bcumming marked this conversation as resolved.
Show resolved Hide resolved
"commit": git_commit_result.stdout.strip().decode("utf-8"),
"url": spack["repo"],
}

# load the jinja templating environment
template_path = self.root / "templates"
Expand Down
10 changes: 7 additions & 3 deletions stackinator/etc/envvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
},
},
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion stackinator/templates/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading