From fc992ad2cfb41921a36a96f0e0e7c8db62c8024e Mon Sep 17 00:00:00 2001 From: Harshula Jayasuriya Date: Fri, 24 Nov 2023 09:30:59 +1100 Subject: [PATCH] Move the configuration files to versioned target directories (#10) * Add more information to the README * Use symlinking of configurations files instead of $SPACK_USER_CONFIG_PATH * Use $SPACK_DISABLE_LOCAL_CONFIG to disable ~/spack --- README.md | 24 ++++++++++++++++++++- spack-start.bash | 17 ++++++--------- v0.20/ci/concretizer.yaml | 1 + {config => v0.20/ci}/config.yaml | 0 v0.20/ci/repos.yaml | 1 + {config => v0.20/common}/concretizer.yaml | 0 {config => v0.20/common}/repos.yaml | 0 v0.20/gadi/concretizer.yaml | 1 + v0.20/gadi/config.yaml | 4 ++++ {config => v0.20/gadi}/linux/compilers.yaml | 0 {config => v0.20/gadi}/packages.yaml | 0 v0.20/gadi/repos.yaml | 1 + 12 files changed, 38 insertions(+), 11 deletions(-) create mode 120000 v0.20/ci/concretizer.yaml rename {config => v0.20/ci}/config.yaml (100%) create mode 120000 v0.20/ci/repos.yaml rename {config => v0.20/common}/concretizer.yaml (100%) rename {config => v0.20/common}/repos.yaml (100%) create mode 120000 v0.20/gadi/concretizer.yaml create mode 100644 v0.20/gadi/config.yaml rename {config => v0.20/gadi}/linux/compilers.yaml (100%) rename {config => v0.20/gadi}/packages.yaml (100%) create mode 120000 v0.20/gadi/repos.yaml diff --git a/README.md b/README.md index 57ca853..188f796 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,25 @@ # Spack Config -Shared spack configuration for building software on gadi@NCI +This repository contains: + +* Spack configuration files required by the Spack instance(s) maintained by ACCESS-NRI on Gadi and ACCESS-NRI's [CI Docker image](https://github.com/ACCESS-NRI/build-ci/). + * The `ci` directory is to be used by the CI Docker image. + * The `gadi` directory is to be used in Gadi deployments. + * The `common` directory is a subset of required configuration files and should not be used directly. + +* `spack-start.bash` is for general users to set their `bash` environment to directly run `spack` commands using ACCESS-NRI's Spack instance(s). Execute: `. spack-start.bash`. It disables local configuration changes in `~/.spack`. Advanced users should use the methods described in the Spack documentation, including setting `$SPACK_INSTALL_TREE` to a writeable directory. + +## Usage + +`ln -s -r -v //* /etc/spack/` + +Where, +* is the spack major version. e.g. `v0.20`. +* is `ci` or `gadi`. +* is the root directory of the Spack instance. + +## References + +* [Spack Configuration Scopes](https://spack.readthedocs.io/en/latest/configuration.html#configuration-scopes) +* [Spack Settings (config.yaml)](https://spack.readthedocs.io/en/latest/config_yaml.html) +* [Spack extended YAML Format](https://spack-tutorial.readthedocs.io/en/latest/tutorial_configuration.html#yaml-format) diff --git a/spack-start.bash b/spack-start.bash index d05ed77..52e74ff 100644 --- a/spack-start.bash +++ b/spack-start.bash @@ -1,18 +1,16 @@ # This is not an executable! Do not enable execute permissions. # You need to be running a bash shell, then execute: . spack-start.bash +# This file is in $PREFIX/spack_config/ # Required layout: # $PREFIX/spack # $PREFIX/spack_config # $PREFIX/spack_packages -# $PREFIX/release (defined in $PREFIX/spack_config/config.yaml) - -# This file is located at $PREFIX/spack_config/$0 +# $PREFIX/release (defined in $PREFIX/spack_config/*/*/config.yaml) set -x PREFIX="$(dirname $BASH_SOURCE)/.." SPACK="$PREFIX/spack" -CONFIG="$PREFIX/spack_config/config" set +x # https://spack-tutorial.readthedocs.io/en/latest/tutorial_configuration.html#yaml-format @@ -25,14 +23,13 @@ set +x # adding that section, Spack replaces what was in that section with the new # value. -# Don't disable local config, we need to use SPACK_USER_CONFIG_PATH. -#export SPACK_DISABLE_LOCAL_CONFIG="" +# Disable ~/.spack because we have seen compiler misconfiguration by users. +# This also disables /etc/spack . +export SPACK_DISABLE_LOCAL_CONFIG="true" -# No need to override, because it defaults to a non-existent /etc/spack on Gadi. +# Setting SPACK_DISABLE_LOCAL_CONFIG disables the following: #export SPACK_SYSTEM_CONFIG_PATH="" - -# Override ~/.spack because we have seen compiler misconfiguration by users. -export SPACK_USER_CONFIG_PATH="$CONFIG" +#export SPACK_USER_CONFIG_PATH="" # TODO: Decide on the version of Python that we approve. #export SPACK_PYTHON= diff --git a/v0.20/ci/concretizer.yaml b/v0.20/ci/concretizer.yaml new file mode 120000 index 0000000..28c1767 --- /dev/null +++ b/v0.20/ci/concretizer.yaml @@ -0,0 +1 @@ +../common/concretizer.yaml \ No newline at end of file diff --git a/config/config.yaml b/v0.20/ci/config.yaml similarity index 100% rename from config/config.yaml rename to v0.20/ci/config.yaml diff --git a/v0.20/ci/repos.yaml b/v0.20/ci/repos.yaml new file mode 120000 index 0000000..7f98e2a --- /dev/null +++ b/v0.20/ci/repos.yaml @@ -0,0 +1 @@ +../common/repos.yaml \ No newline at end of file diff --git a/config/concretizer.yaml b/v0.20/common/concretizer.yaml similarity index 100% rename from config/concretizer.yaml rename to v0.20/common/concretizer.yaml diff --git a/config/repos.yaml b/v0.20/common/repos.yaml similarity index 100% rename from config/repos.yaml rename to v0.20/common/repos.yaml diff --git a/v0.20/gadi/concretizer.yaml b/v0.20/gadi/concretizer.yaml new file mode 120000 index 0000000..28c1767 --- /dev/null +++ b/v0.20/gadi/concretizer.yaml @@ -0,0 +1 @@ +../common/concretizer.yaml \ No newline at end of file diff --git a/v0.20/gadi/config.yaml b/v0.20/gadi/config.yaml new file mode 100644 index 0000000..f884da7 --- /dev/null +++ b/v0.20/gadi/config.yaml @@ -0,0 +1,4 @@ +config: + install_tree: + # Completely ignoring higher-level configuration options is supported with the :: notation for keys ... + root:: $spack/../release diff --git a/config/linux/compilers.yaml b/v0.20/gadi/linux/compilers.yaml similarity index 100% rename from config/linux/compilers.yaml rename to v0.20/gadi/linux/compilers.yaml diff --git a/config/packages.yaml b/v0.20/gadi/packages.yaml similarity index 100% rename from config/packages.yaml rename to v0.20/gadi/packages.yaml diff --git a/v0.20/gadi/repos.yaml b/v0.20/gadi/repos.yaml new file mode 120000 index 0000000..7f98e2a --- /dev/null +++ b/v0.20/gadi/repos.yaml @@ -0,0 +1 @@ +../common/repos.yaml \ No newline at end of file