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

Allow spack-stack to define external packages that should be automatically detected #706

Merged
Merged
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
32 changes: 31 additions & 1 deletion var/ramble/repos/builtin/applications/spack-stack/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class SpackStack(ExecutableApplication):
"create",
executables=[
"builtin::remove_env_files",
"builtin::find_externals",
"configure",
"install",
"builtin::remove_packages",
Expand All @@ -68,11 +69,18 @@ class SpackStack(ExecutableApplication):

workload_variable(
"install_flags",
default="",
default="--fail-fast",
description="Flags to use for `spack install`",
workloads=["create"],
)

workload_variable(
"external_packages",
default=[],
description="List of packages to `spack external find` and mark not buildable",
workloads=["create"],
)

workload_variable(
"removed_packages",
default=[],
Expand Down Expand Up @@ -146,6 +154,28 @@ def remove_env_files(self):
cmds = ["rm -f {env_path}/spack.lock", "rm -rf {env_path}/.spack-env"]
return cmds

register_builtin("find_externals", required=False)

def find_externals(self):
"""Inject commands to find external non buildable packages

This allows spack find external system packages before building,
to ensure system packages are used for some dependencies.
"""
cmds = []

# Package finding is only supported in bash or sh
if ramble.config.get("config:shell") in ["sh", "bash"]:
# Do not expand the `external_packages` variable, so it will not be
# used to render experiments.
external_packages = self.expander.expand_var_name(
"external_packages", merge_used_stage=False, typed=True
)
self.expander.flush_used_variable_stage()
for pkg in external_packages:
cmds.append(f"spack external find --not-buildable {pkg}")
return cmds

register_builtin("remove_packages", required=False)

def remove_packages(self):
Expand Down