spack/Adapt-shell-scripts-that-set-up-the-environment-for-different-shells.patch
Egbert Eich cb5a005ede Accepting request 1088985 from home:mslacken:sp
- Update to version 0.20.0 with the following features:
  * Exact versions: Spack did not previously have a way to distinguish a
    version if it was a prefix of some other version. For example, @3.2 would
    match 3.2, 3.2.1, 3.2.2, etc. You can now match exactly 3.2 with @=3.2.
    This is useful, for example, if you need to patch only the 3.2 version of a
    package
  * More stable concretization: Now, spack concretize will only concretize the
    new portions of the environment and will not change existing parts of an
    environment unless you specify --force.  This has always been true for
    unify:false, but not for unify:true and unify:when_possible environments.
  * The concretizer has a new --reuse-deps argument that only reuses dependencies.
    That is, it will always treat the roots of your environment as it would with
    --fresh. This allows you to upgrade just the roots of your environment while
    keeping everything else stable
  * Specs in buildcaches can be referenced by hash: Previously, you could run
    spack buildcache list and see the hashes in buildcaches, but referring to
    them by hash would fail.  You can now run commands like spack spec and
    spack install and refer to buildcache hashes directly, e.g. spack install
    /abc123
  * New package and buildcache index websites
    Our public websites for searching packages have been completely revamped
    and updated.  You can check them out here:
      Package Index: https://packages.spack.io
      Buildcache Index: https://cache.spack.io
    Both are searchable and more interactive than before. Currently major
    releases are shown; UI for browsing develop snapshots is coming soon.
  * Default CMake and Meson build types are now Release: Spack has historically
    defaulted to building with optimization and debugging, but packages like
    llvm can be enormous with debug turned on. Our default build type for all
    Spack packages is now Release. This has a number of benefits:

OBS-URL: https://build.opensuse.org/request/show/1088985
OBS-URL: https://build.opensuse.org/package/show/network:cluster/spack?expand=0&rev=72
2023-06-01 09:34:31 +00:00

157 lines
4.8 KiB
Diff

From 360dd5abda2e7f14c87ace831ff4c9756c9d0444 Mon Sep 17 00:00:00 2001
From: Egbert Eich <eich@suse.com>
Date: Wed, 10 Nov 2021 13:01:17 +0100
Subject: [PATCH] Adapt shell scripts that set up the environment for different
shells
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 ad20d346d1..91c48ecae9 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 e00d8e76bb..961ec39015 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 d3a97d9af6..45195fb36f 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
--
2.40.1