Skip to content

Commit

Permalink
Add "default" configuration scope.
Browse files Browse the repository at this point in the history
- Default scope is versioned with spack and can be overridden by site
  or user config.

- Default scope provides sensible default concretization preferences
  for all of Spack.

- per-platform concretization scope can be added later (to force a
  particular MPI on, e.g., Cray systems)
  • Loading branch information
tgamblin committed Jul 20, 2016
1 parent a64a2e7 commit 26480f1
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*~
.DS_Store
.idea
/etc/spack/*
/etc/spack/*.yaml
/etc/spackconfig
/share/spack/dotkit
/share/spack/modules
Expand Down
15 changes: 12 additions & 3 deletions etc/spack/modules.yaml → etc/spack/defaults/modules.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# -------------------------------------------------------------------------
# This is the default spack module files generation configuration.
# This is the default configuration for Spack's module file generation.
#
# Changes to this file will affect all users of this spack install,
# although users can override these settings in their ~/.spack/modules.yaml.
# Settings here are versioned with Spack and are intended to provide
# sensible defaults out of the box. Spack maintainers should edit this
# file to keep it current.
#
# Users can override these settings by editing the following files.
#
# Per-spack-instance settings (overrides defaults):
# $SPACK_ROOT/etc/spack/modules.yaml
#
# Per-user settings (overrides default and site settings):
# ~/.spack/modules.yaml
# -------------------------------------------------------------------------
modules:
enable:
Expand Down
21 changes: 21 additions & 0 deletions etc/spack/defaults/packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -------------------------------------------------------------------------
# This file controls default concretization preferences for Spack.
#
# Settings here are versioned with Spack and are intended to provide
# sensible defaults out of the box. Spack maintainers should edit this
# file to keep it current.
#
# Users can override these settings by editing the following files.
#
# Per-spack-instance settings (overrides defaults):
# $SPACK_ROOT/etc/spack/packages.yaml
#
# Per-user settings (overrides default and site settings):
# ~/.spack/packages.yaml
# -------------------------------------------------------------------------
packages:
all:
providers:
mpi: [openmpi, mpich]
blas: [openblas]
lapack: [openblas]
14 changes: 14 additions & 0 deletions etc/spack/defaults/repos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -------------------------------------------------------------------------
# This is the default spack repository configuration. It includes the
# builtin spack package repository.
#
# Users can override these settings by editing the following files.
#
# Per-spack-instance settings (overrides defaults):
# $SPACK_ROOT/etc/spack/repos.yaml
#
# Per-user settings (overrides default and site settings):
# ~/.spack/repos.yaml
# -------------------------------------------------------------------------
repos:
- $spack/var/spack/repos/builtin
8 changes: 0 additions & 8 deletions etc/spack/repos.yaml

This file was deleted.

9 changes: 8 additions & 1 deletion lib/spack/spack/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,15 @@ def clear(self):
"""Empty cached config information."""
self.sections = {}

"""Default configuration scope is the lowest-level scope. These are
versioned with Spack and can be overridden by sites or users."""
ConfigScope('defaults', os.path.join(spack.etc_path, 'spack', 'defaults'))

ConfigScope('site', os.path.join(spack.etc_path, 'spack')),
"""Site configuration is per spack instance, for sites or projects.
No site-level configs should be checked into spack by default."""
ConfigScope('site', os.path.join(spack.etc_path, 'spack'))

"""User configuration can override both spack defaults and site config."""
ConfigScope('user', os.path.expanduser('~/.spack'))


Expand Down

0 comments on commit 26480f1

Please sign in to comment.