File: setup_spack_cache.sh

package info (click to toggle)
cp2k 2025.2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 372,052 kB
  • sloc: fortran: 963,262; ansic: 64,495; f90: 21,676; python: 14,419; sh: 11,382; xml: 2,173; makefile: 953; pascal: 845; perl: 492; cpp: 345; lisp: 297; csh: 16
file content (24 lines) | stat: -rwxr-xr-x 821 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash -e

# author: Ole Schuett

if [[ -n "${SPACK_CACHE}" ]]; then
  if [[ "${SPACK_CACHE}" == *"http://localhost:9000"* ]]; then
    if ! wget -q --tries=1 "http://localhost:9000/spack-cache"; then
      echo ""
      echo "ERROR: Could not connect to local Spack cache."
      echo "       Start the cache by running ./spack_cache_start.sh and then pass --network=host to podman."
      echo "       Alternatively, disable the cache by passing --build-arg SPACK_CACHE=\"\" to podman."
      echo "       See also: https://manual.cp2k.org/trunk/getting-started/build-with-spack.html"
      echo ""
      exit 1
    fi
  fi
  echo "Adding Spack cache: ${SPACK_CACHE}"
  # shellcheck disable=SC2086
  spack mirror add --autopush --unsigned local-cache ${SPACK_CACHE}
else
  echo "No Spack cache provided."
fi

#EOF