spack/Adapt-shell-scripts-that-set-up-the-environment-for-different-shells.patch
Christian Goll 1399716433 Accepting request 931785 from home:mslacken:sp
- updated to version 0.17.0
  (Upstream feature/bug references (<ID>) are relative to
   https://github.com/spack/spack/issues/<ID>).
  * New concretizer is now default
    The new concretizer introduced as an experimental feature in v0.16.0
    is now the default (#25502). The new concretizer is based on the
    clingo logic programming system,
    and it enables us to do much higher quality and faster dependency solving
    The old concretizer is still available via the concretizer: original
    setting, but it is deprecated and will be removed in v0.18.0.
  * Binary Bootstrapping
    To make it easier to use the new concretizer and binary packages,
    Spack now bootstraps clingo and GnuPG from public binaries. If it
    is not able to bootstrap them from binaries, it installs them from
    source code. With these changes, you should still be able to clone Spack
    and start using it almost immediately.
  * Reuse existing packages (experimental)
    The most wanted feature from our
    2020 user survey and
    the most wanted Spack feature of all time (#25310). spack install,
    spack spec, and spack concretize now have a --reuse option, which
    causes Spack to minimize the number of rebuilds it does. The --reuse
    option will try to find existing installations and binary packages locally
    and in registered mirrors, and will prefer to use them over building new
    versions. This will allow users to build from source far less than in
    prior versions of Spack. This feature will continue to be improved, with
    configuration options and better CLI expected in v0.17.1. It will become
    the default concretization mode in v0.18.0.
  * Better error messages
    We have improved the error messages generated by the new concretizer by

OBS-URL: https://build.opensuse.org/request/show/931785
OBS-URL: https://build.opensuse.org/package/show/network:cluster/spack?expand=0&rev=35
2021-11-16 14:32:55 +00:00

155 lines
4.9 KiB
Diff

From: Egbert Eich <eich@suse.com>
Date: Wed Nov 10 13:01:17 2021 +0100
Subject: Adapt shell scripts that set up the environment for different shells
Patch-mainline: Not yet
Git-repo: https://github.com/spack/spack
Git-commit: 565c91f4e3a40495fc470a8887df7dee9ced8c09
References:
Signed-off-by: Egbert Eich <eich@suse.com>
Signed-off-by: Egbert Eich <eich@suse.de>
---
share/spack/setup-env.csh | 5 +++-
share/spack/setup-env.fish | 15 +-----------
share/spack/setup-env.sh | 61 ++--------------------------------------------
3 files changed, 7 insertions(+), 74 deletions(-)
diff --git a/share/spack/setup-env.csh b/share/spack/setup-env.csh
index 4ac0503947..67fad7516c 100755
--- a/share/spack/setup-env.csh
+++ b/share/spack/setup-env.csh
@@ -12,6 +12,10 @@
#
# prevent infinite recursion when spack shells out (e.g., on cray for modules)
+if ($?SPACK_ROOT == 0) then
+ setenv SPACK_ROOT = @@_prefix@@
+endif
+
if ($?_sp_initializing) then
exit 0
endif
@@ -71,7 +75,6 @@ foreach cmd ("$SPACK_PYTHON" python3 python python2)
end
# Set variables needed by this script
-_spack_pathadd PATH "$SPACK_ROOT/bin"
eval `spack --print-shell-vars csh`
# Set up module search paths in the user environment
diff --git a/share/spack/setup-env.fish b/share/spack/setup-env.fish
index d16ee617df..84e3a9e044 100755
--- a/share/spack/setup-env.fish
+++ b/share/spack/setup-env.fish
@@ -671,12 +671,6 @@ end
-#
-# Figure out where this file is. Below code only needs to work in fish
-#
-set -l sp_source_file (status -f) # name of current file
-
-
#
# Identify and lock the python interpreter
@@ -691,14 +685,7 @@ end
-#
-# Find root directory and add bin to path.
-#
-set -l sp_share_dir (realpath (dirname $sp_source_file))
-set -l sp_prefix (realpath (dirname (dirname $sp_share_dir)))
-spack_pathadd PATH "$sp_prefix/bin"
-set -xg SPACK_ROOT $sp_prefix
-
+set -xg SPACK_ROOT @@_prefix@@
#
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index 5136e8a58a..6aef191129 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -249,64 +249,6 @@ _sp_shell=$(_spack_determine_shell)
alias spacktivate="spack env activate"
-#
-# Figure out where this file is.
-#
-if [ "$_sp_shell" = bash ]; then
- _sp_source_file="${BASH_SOURCE[0]:-}"
-elif [ "$_sp_shell" = zsh ]; then
- _sp_source_file="${(%):-%N}"
-else
- # Try to read the /proc filesystem (works on linux without lsof)
- # In dash, the sourced file is the last one opened (and it's kept open)
- _sp_source_file_fd="$(\ls /proc/$$/fd 2>/dev/null | sort -n | tail -1)"
- if ! _sp_source_file="$(readlink /proc/$$/fd/$_sp_source_file_fd)"; then
- # Last resort: try lsof. This works in dash on macos -- same reason.
- # macos has lsof installed by default; some linux containers don't.
- _sp_lsof_output="$(lsof -p $$ -Fn0 | tail -1)"
- _sp_source_file="${_sp_lsof_output#*n}"
- fi
-
- # If we can't find this script's path after all that, bail out with
- # plain old $0, which WILL NOT work if this is sourced indirectly.
- if [ ! -f "$_sp_source_file" ]; then
- _sp_source_file="$0"
- fi
-fi
-
-#
-# Find root directory and add bin to path.
-#
-# We send cd output to /dev/null to avoid because a lot of users set up
-# their shell so that cd prints things out to the tty.
-if [ "$_sp_shell" = zsh ]; then
- _sp_share_dir="${_sp_source_file:A:h}"
- _sp_prefix="${_sp_share_dir:h:h}"
-else
- _sp_share_dir="$(cd "$(dirname $_sp_source_file)" > /dev/null && pwd)"
- _sp_prefix="$(cd "$(dirname $(dirname $_sp_share_dir))" > /dev/null && pwd)"
-fi
-if [ -x "$_sp_prefix/bin/spack" ]; then
- export SPACK_ROOT="${_sp_prefix}"
-else
- # If the shell couldn't find the sourced script, fall back to
- # whatever the user set SPACK_ROOT to.
- if [ -n "$SPACK_ROOT" ]; then
- _sp_prefix="$SPACK_ROOT"
- _sp_share_dir="$_sp_prefix/share/spack"
- fi
-
- # If SPACK_ROOT didn't work, fail. We should need this rarely, as
- # the tricks above for finding the sourced file are pretty robust.
- if [ ! -x "$_sp_prefix/bin/spack" ]; then
- echo "==> Error: SPACK_ROOT must point to spack's prefix when using $_sp_shell"
- echo "Run this with the correct prefix before sourcing setup-env.sh:"
- echo " export SPACK_ROOT=</path/to/spack>"
- return 1
- fi
-fi
-_spack_pathadd PATH "${_sp_prefix%/}/bin"
-
#
# Check whether a function of the given name is defined
#
@@ -387,11 +329,12 @@ if [ -z "${SPACK_SKIP_MODULES+x}" ]; then
}
_sp_multi_pathadd MODULEPATH "$_sp_tcl_roots"
fi
+export SPACK_ROOT=@@_prefix@@
# Add programmable tab completion for Bash
#
if test "$_sp_shell" = bash || test -n "${ZSH_VERSION:-}"; then
- source $_sp_share_dir/spack-completion.bash
+ source $SPACK_ROOT/share/spack/spack-completion.bash
fi
# done: unset sentinel variable as we're no longer initializing