spack/run-find-external.sh.in
Egbert Eich 56ffc9a15e - Update to version v0.23.0. This is a major release.
* Features in this Release
    + Spec splicing
      To make binary installation more seamless in Spack, `v0.23`
      introduces "splicing", which allows users to deploy binaries
      using local, optimized versions of a binary interface, even
      if they were not built with that interface. For example, this
      would allow you to build binaries in the cloud using `mpich`
      and install them on a system using a local, optimized version
      of `mvapich2` *without rebuilding*. Spack preserves full
      provenance for the installed packages and knows that they
      were built one way but deployed another.
      The intent is to leverage this across many key HPC binary
      packages, e.g. MPI, CUDA, ROCm, and libfabric.
      Fundamentally, splicing allows Spack to redeploy an existing
      spec with different dependencies than how it was built. There
      are two interfaces to splicing.
      a. Explicit Splicing
         In the concretizer config, you can specify a target spec
	 and a replacement by hash.
         ```yaml
         concretizer:
           splice:
             explicit:
             - target: mpi
               replacement: mpich/abcdef
         ```
         Here, every installation that would normally use the target
	 spec will instead use its replacement. Above, any spec using
	 *any* `mpi` will be spliced to depend on the specific `mpich`

OBS-URL: https://build.opensuse.org/package/show/network:cluster/spack?expand=0&rev=111
2025-01-03 18:43:58 +00:00

97 lines
3.2 KiB
Bash

#!/bin/bash
scope=system
what=$1
addpath() {
path=$1
shift
while [ -n "$1" ]; do
eval "${path}"=${1}:${!path}
shift
done
}
find_packages() {
if [ $scope = user ]; then
# In case a packages.yaml is left in the system scope
# from an old installation get it out of the way.
if [ ! -e /usr/etc/spack/packages.yaml ]; then
test -e /etc/spack/packages.yaml -a ! -e /etc/packages.yaml.rpmsave && \
mv /etc/spack/packages.yaml /etc/spack/packages.yaml.rpmsave
rm -f /etc/spack/packages.yaml
fi
test -e /usr/etc/spack/packages.yaml -a ! -e /usr/etc/packages.yaml.rpmsave && \
mv /usr/etc/spack/packages.yaml /usr/etc/spack/packages.yaml.rpmsave
# drop all root rights, when calling external find
sudo -u nobody PATH=${mypath}:${PATH} spack external find --scope user --all #--exclude 'installdbgsymbols'
if [ -e /var/lib/nobody/.spack/packages.yaml ] ; then
chown root:root /var/lib/nobody/.spack/packages.yaml
mv -v /var/lib/nobody/.spack/packages.yaml /usr/etc/spack/packages.yaml
rm -rf /var/lib/nobody/.spack
fi
else
# May run in a container...
PATH=${mypath}:${PATH} spack external find --scope system --all #--exclude 'installdbgsymbols'
fi
test -e /usr/etc/spack/packages.yaml.rpmsave && \
{ diff -q /usr/etc/spack/packages.yaml.rpmsave /usr/etc/spack/packages.yaml &> /dev/null && \
rm /usr/etc/spack/packages.yaml.rpmsave; } || true
}
find_compilers() {
if [ $scope = user ]; then
test -e /etc/spack/compilers.yaml \
-a ! -e /etc/spack/compilers.yaml.rpmsave && \
mv /etc/spack/compilers.yaml /etc/spack/compilers.yaml.rpmsave
rm -f /etc/spack/compilers.yaml
fi
diff -q /etc/spack/compilers.yaml.rpmsave /etc/spack/compilers.yaml &> /dev/null \
&& rm /etc/spack/compilers.yaml.rpmsave
test -e /etc/spack/compilers.yaml.rpmsave && \
echo -e "/etc/spack/compilers.yaml.rpmsave exists,\n"\
" compilers are handled in /etc/spack/packages.yaml, now.\n"\
" Please check files for compilers you may have added manually" || true
}
if [ -e /etc/spack/no_rpm_trigger ] ; then
exit 0
fi
if [ "x$(id -u)" != "x0" ] ; then
echo "Must run as root, in order to copy back the configuration files and use sudo"
exit 0
fi
echo "Create /etc/spack/no_rpm_trigger to stop spack to search for new packages after a rpm install"
# save old packages.yml, it has to be removed as when not
# the new and old packages.yaml files would have to be
# combined
# prepare the path
shopt -s nullglob
addpath mypath /usr/lib64/mpi/gcc/openmpi4/bin
addpath mypath /usr/lib64/mpi/gcc/openmpi3/bin
addpath mypath /usr/lib64/mpi/gcc/openmpi2/bin
addpath mypath /usr/lib64/mpi/gcc/openmpi1/bin
addpath mypath /usr/lib64/mpi/gcc/mvapich2/bin
addpath mypath /usr/lib64/mpi/gcc/mpich/bin
addpath mypath /usr/lib/hpc/gnu*/mpi/openmpi/[2-9].*/bin
addpath mypath /usr/lib/hpc/gnu*/mpi/mpich/[3-9].*/bin
addpath mypath /usr/lib/hpc/gnu*/mpi/mvapich2/[2-9].*/bin
addpath cpath /usr/lib/hpc/compiler/gnu/*/bin
# test if we can run as nobody
getent passwd nobody &> /dev/null
if [ "x$?" == "x0" ] ; then
scope=user
fi
case $what in
packages) find_packages $scope ;;
compilers) find_compilers $scope ;;
'') find_packages $scope
find_compilers $scope ;;
*) exit 1 ;;
esac