Features: Improve Spec format strings (#10556)
* Update spec format to simpler syntax, maintain backwards compatibility * Switch to new spec.format method throughout internals * update package files for new format strings * documentation and minor code cleanup. removed nonsensical variant sigils
This commit is contained in:

committed by
Todd Gamblin

parent
49334f006d
commit
f242f5f8a9
@@ -39,7 +39,7 @@ default path uses the full 32 characters.
|
||||
Secondly, it is
|
||||
also possible to modify the entire installation scheme. By default
|
||||
Spack uses
|
||||
``${ARCHITECTURE}/${COMPILERNAME}-${COMPILERVER}/${PACKAGE}-${VERSION}-${HASH}``
|
||||
``{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}``
|
||||
where the tokens that are available for use in this directive are the
|
||||
same as those understood by the ``Spec.format`` method. Using this parameter it
|
||||
is possible to use a different package layout or reduce the depth of
|
||||
@@ -48,7 +48,7 @@ the installation paths. For example
|
||||
.. code-block:: yaml
|
||||
|
||||
config:
|
||||
install_path_scheme: '${PACKAGE}/${VERSION}/${HASH:7}'
|
||||
install_path_scheme: '{name}/{version}/{hash:7}'
|
||||
|
||||
would install packages into sub-directories using only the package
|
||||
name, version and a hash length of 7 characters.
|
||||
|
@@ -459,7 +459,7 @@ account all scopes. For example, to see the fully merged
|
||||
install_tree: $spack/opt/spack
|
||||
template_dirs:
|
||||
- $spack/templates
|
||||
directory_layout: ${ARCHITECTURE}/${COMPILERNAME}-${COMPILERVER}/${PACKAGE}-${VERSION}-${HASH}
|
||||
directory_layout: {architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}
|
||||
module_roots:
|
||||
tcl: $spack/share/spack/modules
|
||||
lmod: $spack/share/spack/lmod
|
||||
@@ -510,7 +510,7 @@ down the problem:
|
||||
./my-scope/config.yaml:2 install_tree: /path/to/some/tree
|
||||
/home/myuser/spack/etc/spack/defaults/config.yaml:23 template_dirs:
|
||||
/home/myuser/spack/etc/spack/defaults/config.yaml:24 - $spack/templates
|
||||
/home/myuser/spack/etc/spack/defaults/config.yaml:28 directory_layout: ${ARCHITECTURE}/${COMPILERNAME}-${COMPILERVER}/${PACKAGE}-${VERSION}-${HASH}
|
||||
/home/myuser/spack/etc/spack/defaults/config.yaml:28 directory_layout: {architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}
|
||||
/home/myuser/spack/etc/spack/defaults/config.yaml:32 module_roots:
|
||||
/home/myuser/spack/etc/spack/defaults/config.yaml:33 tcl: $spack/share/spack/modules
|
||||
/home/myuser/spack/etc/spack/defaults/config.yaml:34 lmod: $spack/share/spack/lmod
|
||||
|
@@ -535,10 +535,10 @@ most likely via the ``+blas`` variant specification.
|
||||
|
||||
modules:
|
||||
tcl:
|
||||
naming_scheme: '${PACKAGE}/${VERSION}-${COMPILERNAME}-${COMPILERVER}'
|
||||
naming_scheme: '{name}/{version}-{compiler.name}-{compiler.version}'
|
||||
all:
|
||||
conflict:
|
||||
- '${PACKAGE}'
|
||||
- '{name}'
|
||||
- 'intel/14.0.1'
|
||||
|
||||
will create module files that will conflict with ``intel/14.0.1`` and with the
|
||||
|
@@ -646,14 +646,14 @@ modules that refer to different flavors of the same library/application:
|
||||
modules:
|
||||
tcl:
|
||||
hash_length: 0
|
||||
naming_scheme: '${PACKAGE}/${VERSION}-${COMPILERNAME}-${COMPILERVER}'
|
||||
naming_scheme: '{name}/{version}-{compiler.name}-{compiler.version}'
|
||||
whitelist:
|
||||
- gcc
|
||||
blacklist:
|
||||
- '%gcc@5.4.0'
|
||||
all:
|
||||
conflict:
|
||||
- '${PACKAGE}'
|
||||
- '{name}'
|
||||
suffixes:
|
||||
'^openblas': openblas
|
||||
'^netlib-lapack': netlib
|
||||
@@ -713,14 +713,14 @@ is installed. You can achieve this with Spack by adding an
|
||||
modules:
|
||||
tcl:
|
||||
hash_length: 0
|
||||
naming_scheme: '${PACKAGE}/${VERSION}-${COMPILERNAME}-${COMPILERVER}'
|
||||
naming_scheme: '{name}/{version}-{compiler.name}-{compiler.version}'
|
||||
whitelist:
|
||||
- gcc
|
||||
blacklist:
|
||||
- '%gcc@5.4.0'
|
||||
all:
|
||||
conflict:
|
||||
- '${PACKAGE}'
|
||||
- '{name}'
|
||||
suffixes:
|
||||
'^openblas': openblas
|
||||
'^netlib-lapack': netlib
|
||||
@@ -728,7 +728,7 @@ is installed. You can achieve this with Spack by adding an
|
||||
environment_blacklist: ['CPATH', 'LIBRARY_PATH']
|
||||
environment:
|
||||
set:
|
||||
'${PACKAGE}_ROOT': '${PREFIX}'
|
||||
'{name}_ROOT': '{prefix}'
|
||||
netlib-scalapack:
|
||||
suffixes:
|
||||
'^openmpi': openmpi
|
||||
@@ -737,8 +737,9 @@ is installed. You can achieve this with Spack by adding an
|
||||
Under the hood Spack uses the :meth:`~spack.spec.Spec.format` API to substitute
|
||||
tokens in either environment variable names or values. There are two caveats though:
|
||||
|
||||
- The set of allowed tokens in variable names is restricted to ``PACKAGE``,
|
||||
``VERSION``, ``COMPILER``, ``COMPILERNAME``, ``COMPILERVER``, ``ARCHITECTURE``
|
||||
- The set of allowed tokens in variable names is restricted to
|
||||
``name``, ``version``, ``compiler``, ``compiler.name``,
|
||||
``compiler.version``, ``architecture``
|
||||
- Any token expanded in a variable name is made uppercase, but other than that
|
||||
case sensitivity is preserved
|
||||
|
||||
@@ -784,14 +785,14 @@ etc. in the ``gcc`` module file and apply other custom modifications to the
|
||||
modules:
|
||||
tcl:
|
||||
hash_length: 0
|
||||
naming_scheme: '${PACKAGE}/${VERSION}-${COMPILERNAME}-${COMPILERVER}'
|
||||
naming_scheme: '{name}/{version}-{compiler.name}-{compiler.version}'
|
||||
whitelist:
|
||||
- gcc
|
||||
blacklist:
|
||||
- '%gcc@5.4.0'
|
||||
all:
|
||||
conflict:
|
||||
- '${PACKAGE}'
|
||||
- '{name}'
|
||||
suffixes:
|
||||
'^openblas': openblas
|
||||
'^netlib-lapack': netlib
|
||||
@@ -799,7 +800,7 @@ etc. in the ``gcc`` module file and apply other custom modifications to the
|
||||
environment_blacklist: ['CPATH', 'LIBRARY_PATH']
|
||||
environment:
|
||||
set:
|
||||
'${PACKAGE}_ROOT': '${PREFIX}'
|
||||
'{name}_ROOT': '{prefix}'
|
||||
gcc:
|
||||
environment:
|
||||
set:
|
||||
@@ -896,14 +897,14 @@ directive and assigning it the value ``direct``:
|
||||
tcl:
|
||||
verbose: True
|
||||
hash_length: 0
|
||||
naming_scheme: '${PACKAGE}/${VERSION}-${COMPILERNAME}-${COMPILERVER}'
|
||||
naming_scheme: '{name}/{version}-{compiler.name}-{compiler.version}'
|
||||
whitelist:
|
||||
- gcc
|
||||
blacklist:
|
||||
- '%gcc@5.4.0'
|
||||
all:
|
||||
conflict:
|
||||
- '${PACKAGE}'
|
||||
- '{name}'
|
||||
suffixes:
|
||||
'^openblas': openblas
|
||||
'^netlib-lapack': netlib
|
||||
@@ -911,7 +912,7 @@ directive and assigning it the value ``direct``:
|
||||
environment_blacklist: ['CPATH', 'LIBRARY_PATH']
|
||||
environment:
|
||||
set:
|
||||
'${PACKAGE}_ROOT': '${PREFIX}'
|
||||
'{name}_ROOT': '{prefix}'
|
||||
gcc:
|
||||
environment:
|
||||
set:
|
||||
@@ -1089,7 +1090,7 @@ After these modifications your configuration file should look like:
|
||||
environment_blacklist: ['CPATH', 'LIBRARY_PATH']
|
||||
environment:
|
||||
set:
|
||||
'${PACKAGE}_ROOT': '${PREFIX}'
|
||||
'{name}_ROOT': '{prefix}'
|
||||
gcc:
|
||||
environment:
|
||||
set:
|
||||
@@ -1298,7 +1299,7 @@ Coming back to our example, let's add ``lapack`` to the hierarchy and remove any
|
||||
environment_blacklist: ['CPATH', 'LIBRARY_PATH']
|
||||
environment:
|
||||
set:
|
||||
'${PACKAGE}_ROOT': '${PREFIX}'
|
||||
'{name}_ROOT': '{prefix}'
|
||||
gcc:
|
||||
environment:
|
||||
set:
|
||||
@@ -1534,7 +1535,7 @@ it's ``netlib-scalapack``:
|
||||
environment_blacklist: ['CPATH', 'LIBRARY_PATH']
|
||||
environment:
|
||||
set:
|
||||
'${PACKAGE}_ROOT': '${PREFIX}'
|
||||
'{name}_ROOT': '{prefix}'
|
||||
gcc:
|
||||
environment:
|
||||
set:
|
||||
|
@@ -541,9 +541,9 @@ spec format strings, as shown in the example below.
|
||||
.. code-block:: yaml
|
||||
|
||||
projections:
|
||||
zlib: ${PACKAGE}-${VERSION}
|
||||
^mpi: ${PACKAGE}-${VERSION}/${DEP:mpi:PACKAGE}-${DEP:mpi:VERSION}-${COMPILERNAME}-${COMPILERVER}
|
||||
all: ${PACKAGE}-${VERSION}/${COMPILERNAME}-${COMPILERVER}
|
||||
zlib: {name}-{version}
|
||||
^mpi: {name}-{version}/{^mpi.name}-{^mpi.version}-{compiler.name}-{compiler.version}
|
||||
all: {name}-{version}/{compiler.name}-{compiler.version}
|
||||
|
||||
The entries in the projections configuration file must all be either
|
||||
specs or the keyword ``all``. For each spec, the projection used will
|
||||
|
Reference in New Issue
Block a user