diff options
author | Nicolas Derumigny | 2021-03-03 13:26:16 +0100 |
---|---|---|
committer | Nicolas Derumigny | 2021-03-03 15:04:58 +0100 |
commit | 7b8b3a07aa22ec15b061f78b35719fc61e2e6a57 (patch) | |
tree | ae303975d5d86a260491e528f3d615c4b7f9a60d /spack.env.sh.patch | |
parent | 415e8c13400648b429b2eeda960d23a27d991fde (diff) | |
download | aur-7b8b3a07aa22ec15b061f78b35719fc61e2e6a57.tar.gz |
pkexec: passing (nearly) all env variables to spack
This resolves `spack unload` which was not working properly due
to `$SPACK_LOADED_HASHES` incorrectly set.
Diffstat (limited to 'spack.env.sh.patch')
-rw-r--r-- | spack.env.sh.patch | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/spack.env.sh.patch b/spack.env.sh.patch new file mode 100644 index 000000000000..26f9e4f3bc48 --- /dev/null +++ b/spack.env.sh.patch @@ -0,0 +1,92 @@ +--- share/spack/setup-env.sh 2021-02-19 20:06:33.000000000 +0100 ++++ share/spack/setup-env.sh 2021-03-03 12:23:39.557249552 +0100 +@@ -45,6 +45,9 @@ + fi + export _sp_initializing=true + ++_pkexec_env() { ++ /usr/bin/spack $@ ++} + + _spack_shell_wrapper() { + # Store LD_LIBRARY_PATH variables from spack shell function +@@ -75,7 +78,7 @@ + [ "${_sp_flags#*h}" != "${_sp_flags}" ] || \ + [ "${_sp_flags#*V}" != "${_sp_flags}" ]; + then +- command spack $_sp_flags "$@" ++ _pkexec_env $_sp_flags "$@" + return + fi + +@@ -96,7 +99,7 @@ + shift + fi + if [ "$_sp_arg" = "-h" ] || [ "$_sp_arg" = "--help" ]; then +- command spack cd -h ++ _pkexec_env cd -h + else + LOC="$(spack location $_sp_arg "$@")" + if [ -d "$LOC" ] ; then +@@ -115,7 +118,7 @@ + fi + + if [ "$_sp_arg" = "-h" ] || [ "$_sp_arg" = "--help" ]; then +- command spack env -h ++ _pkexec_env env -h + else + case $_sp_arg in + activate) +@@ -133,10 +136,10 @@ + [ "${_a#* --help}" != "$_a" ]; + then + # No args or args contain --sh, --csh, or -h/--help: just execute. +- command spack env activate "$@" ++ _pkexec_env env activate "$@" + else + # Actual call to activate: source the output. +- eval $(command spack $_sp_flags env activate --sh "$@") ++ eval $(_pkexec_env $_sp_flags env activate --sh "$@") + fi + ;; + deactivate) +@@ -151,17 +154,17 @@ + [ "${_a#* --csh}" != "$_a" ]; + then + # Args contain --sh or --csh: just execute. +- command spack env deactivate "$@" ++ _pkexec_env env deactivate "$@" + elif [ -n "$*" ]; then + # Any other arguments are an error or -h/--help: just run help. +- command spack env deactivate -h ++ _pkexec_env env deactivate -h + else + # No args: source the output of the command. +- eval $(command spack $_sp_flags env deactivate --sh) ++ eval $(_pkexec_env $_sp_flags env deactivate --sh) + fi + ;; + *) +- command spack env $_sp_arg "$@" ++ _pkexec_env env $_sp_arg "$@" + ;; + esac + fi +@@ -181,14 +184,14 @@ + [ "${_a#* --help}" != "$_a" ]; + then + # Args contain --sh, --csh, or -h/--help: just execute. +- command spack $_sp_flags $_sp_subcommand "$@" ++ _pkexec_env $_sp_flags $_sp_subcommand "$@" + else +- eval $(command spack $_sp_flags $_sp_subcommand --sh "$@" || \ ++ eval $(_pkexec_env $_sp_flags $_sp_subcommand --sh "$@" || \ + echo "return 1") # return 1 if spack command fails + fi + ;; + *) +- command spack $_sp_flags $_sp_subcommand "$@" ++ _pkexec_env $_sp_flags $_sp_subcommand "$@" + ;; + esac + } |