Skip to content

Commit

Permalink
add official support for spack v0.21; allow per-version feature suppo…
Browse files Browse the repository at this point in the history
…rt; update docs
  • Loading branch information
bcumming committed Dec 8, 2023
1 parent c89745c commit 8f43ae9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 23 deletions.
12 changes: 9 additions & 3 deletions docs/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ The following flags are optional:

## Using Spack's `develop` branch

We support the latest two minor versions of Spack. Since Spack has no stable major release yet, it has a short gap between deprecation and removal.
Stackinator supports the latest two minor versions of Spack. Since Spack has no stable major release yet, it has a short gap between deprecation and removal.

!!! note
Currently v0.20 and v0.21 of Spack are supported, with best effort support of the latest developments in the `develop` branch of Spack (see below).

In order to use Spack's `develop` branch it is possible to configure the Spack stacks using the `--develop`.

Expand All @@ -39,9 +42,12 @@ In order to use Spack's `develop` branch it is possible to configure the Spack s

### Current Support

The `--develop` option does the following:
The `--develop` option currently handles the following the following:

* Use build cache mirror name as positional argument instead of using the removed `-m` option ([stackinator#115](https://github.com/eth-cscs/stackinator/issues/115))
* `spack env --with-view <name>` requires an argument.
* v0.20 and earlier did not accept a named argument to `spack env --with-view`, instead requiring the presence of a view named `default`.
* v0.21 requires the name of the view be passed as a positional argument.
* if `--develop` is passed, or `v0.21` is detected.
* will be removed when v0.21 is the oldest supported version of Spack.

Once the supported Spack releases are updated, the changes introduced by `--develop` will be used by default.
2 changes: 2 additions & 0 deletions stackinator/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def generate(self, recipe):
tmp_path.mkdir(exist_ok=True)

# check out the version of spack
spack_version = recipe.spack_version
spack = recipe.config["spack"]
spack_path = self.path / "spack"

Expand Down Expand Up @@ -234,6 +235,7 @@ def generate(self, recipe):
post_install_hook=recipe.post_install_hook,
pre_install_hook=recipe.pre_install_hook,
develop=self.spack_develop,
spack_version=spack_version,
verbose=False,
)
)
Expand Down
21 changes: 21 additions & 0 deletions stackinator/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,26 @@ def config(self, config_path):
schema.config_validator.validate(raw)
self._config = raw

@property
def spack_version(self):
# determine the "major" version, if it can be inferred.
# one of "0.20", "0.21", "develop" or "unknown".
commit = self.config["spack"]["commit"]
if commit is None or commit=="develop":
return "develop"
# currently supported
if commit.find("0.20")>=0:
return "0.20"
# currently supported
if commit.find("0.21")>=0:
return "0.21"
# branches that contain wip for the next v0.22 release
if commit.find("0.22")>=0:
return "0.22"
spack_version=spack_version,

return "unknown"

@property
def environment_view_meta(self):
# generate the view meta data that is presented in the squashfs image meta data
Expand Down Expand Up @@ -475,6 +495,7 @@ def environment_files(self):
environments=self.environments,
push_to_cache=push_to_cache,
develop=self.spack_develop,
spack_version=self.spack_version
)

files["config"] = {}
Expand Down
5 changes: 0 additions & 5 deletions stackinator/templates/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,8 @@ cache-force: mirror-setup
$(warning likely have to start a fresh build (but that's okay, because build caches FTW))
$(warning ================================================================================)
$(SANDBOX) $(MAKE) -C generate-config
{% if develop %}
$(SANDBOX) $(SPACK) -C $(STORE)/config buildcache create --rebuild-index --allow-root --only=package alpscache \
$$($(SANDBOX) $(SPACK) --color=never -C $(STORE)/config find --format '{/hash}')
{% else %}
$(SANDBOX) $(SPACK) -C $(STORE)/config buildcache create --rebuild-index --allow-root --only=package -m alpscache \
$$($(SANDBOX) $(SPACK) --color=never -C $(STORE)/config find --format '{/hash}')
{% endif %}
{% else %}
$(warning "pushing to the build cache is not enabled. See the documentation on how to add a key: https://eth-cscs.github.io/stackinator/build-caches/")
{% endif %}
Expand Down
7 changes: 0 additions & 7 deletions stackinator/templates/Makefile.compilers
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,10 @@ all:{% for compiler in compilers %} {{ compiler }}/generated/build_cache{% endfo
{% for compiler, config in compilers.items() %}
{{ compiler }}/generated/build_cache: {{ compiler }}/generated/env
{% if push_to_cache %}
{% if develop %}
$(SPACK) -e ./{{ compiler }} buildcache create --rebuild-index --allow-root --only=package alpscache \
$$($(SPACK) --color=never -e ./{{ compiler }} find --format '{name};{/hash}' \
| grep -v -E '^({% for p in config.exclude_from_cache %}{{ pipejoiner() }}{{ p }}{% endfor %});'\
| cut -d ';' -f2)
{% else %}
$(SPACK) -e ./{{ compiler }} buildcache create --rebuild-index --allow-root --only=package -m alpscache \
$$($(SPACK) --color=never -e ./{{ compiler }} find --format '{name};{/hash}' \
| grep -v -E '^({% for p in config.exclude_from_cache %}{{ pipejoiner() }}{{ p }}{% endfor %});'\
| cut -d ';' -f2)
{% endif %}
{% endif %}
touch $@

Expand Down
9 changes: 1 addition & 8 deletions stackinator/templates/Makefile.environments
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,10 @@ all:{% for env in environments %} {{ env }}/generated/build_cache{% endfor %}
{% for env, config in environments.items() %}
{{ env }}/generated/build_cache: {{ env }}/generated/view_config
{% if push_to_cache %}
{% if develop %}
$(SPACK) -e ./{{ env }} buildcache create --rebuild-index --allow-root --only=package alpscache \
$$($(SPACK) --color=never -e ./{{ env }} find --format '{name};{/hash}' \
| grep -v -E '^({% for p in config.exclude_from_cache %}{{ pipejoiner() }}{{ p }}{% endfor %});'\
| cut -d ';' -f2)
{% else %}
$(SPACK) -e ./{{ env }} buildcache create --rebuild-index --allow-root --only=package -m alpscache \
$$($(SPACK) --color=never -e ./{{ env }} find --format '{name};{/hash}' \
| grep -v -E '^({% for p in config.exclude_from_cache %}{{ pipejoiner() }}{{ p }}{% endfor %});'\
| cut -d ';' -f2)
{% endif %}
{% endif %}
touch $@

Expand All @@ -38,7 +31,7 @@ all:{% for env in environments %} {{ env }}/generated/build_cache{% endfor %}
{% for env, config in environments.items() %}
{{ env }}/generated/view_config: {{ env }}/generated/env
{% if config.view %}
{% if develop %}
{% if develop or (spack_version=="0.21") %}
$(SPACK) env activate --with-view default --sh ./{{ env }} > $(STORE)/env/{{ config.view.name }}/activate.sh
$(SOFTWARE_STACK_PROJECT)/add-compiler-links.py ./{{ env }}/compilers.yaml $(STORE)/env/{{ config.view.name }}/activate.sh $(SOFTWARE_STACK_PROJECT)
{% else %}
Expand Down

0 comments on commit 8f43ae9

Please sign in to comment.