diff --git a/lib/yashchiki/commons.sh b/lib/yashchiki/commons.sh index 4cefda69d5d53eeea3181742ede4a3ff8c3376d8..6529a50a569f4093ea806d764a3564ab3e8e33ce 100755 --- a/lib/yashchiki/commons.sh +++ b/lib/yashchiki/commons.sh @@ -129,13 +129,9 @@ if [ -n "${YASHCHIKI_SPACK_VERBOSE:-}" ]; then SPACK_ARGS_REINDEX+=("--verbose") fi -# TODO: Keep in sync with <spack-repo>/lib/spack/spack/cmd/bootstrap.py since -# there is no straight-forward way to extract bootstrap dependencies -# automatically. If bootstrap dependencies should change we will notice because -# they won't be able to be fetched inside the container because of missing -# permissions. -spack_bootstrap_dependencies=( - "environment-modules~X" +# Dependencies needed by yashchiki +yashchiki_dependencies=( + "environment-modules~X" # needed for module generation ) ######### diff --git a/lib/yashchiki/complete_spack_install_routine_called_in_post_as_root.sh b/lib/yashchiki/complete_spack_install_routine_called_in_post_as_root.sh index b39dde97720c2afe966774835e09cfcca1712fb5..0c36b37772c239bc7c7768934e5c5a2f5ef770b8 100755 --- a/lib/yashchiki/complete_spack_install_routine_called_in_post_as_root.sh +++ b/lib/yashchiki/complete_spack_install_routine_called_in_post_as_root.sh @@ -12,7 +12,7 @@ SOURCE_DIR="$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")" source "${SOURCE_DIR}/commons.sh" "${SPACK_INSTALL_SCRIPTS}/prepare_spack_as_root.sh" -sudo -Eu spack "${SPACK_INSTALL_SCRIPTS}/bootstrap_spack.sh" +sudo -Eu spack "${SPACK_INSTALL_SCRIPTS}/install_dependencies.sh" sudo -Eu spack "${SPACK_INSTALL_SCRIPTS}/install_spack.sh" && \ sudo -Eu spack ${MY_SPACK_CMD} compiler add --scope site /usr/bin && \ diff --git a/lib/yashchiki/fetch.sh b/lib/yashchiki/fetch.sh index 362dce959d102c6b38c9d60eee4451d38ae30d0d..bba3071c7c9006f4388e7f27d2a770200adab289 100755 --- a/lib/yashchiki/fetch.sh +++ b/lib/yashchiki/fetch.sh @@ -51,7 +51,7 @@ echo "FETCHING..." # concretize all spack packages in parallel packages_to_fetch=( "${YASHCHIKI_SPACK_GCC}" - "${spack_bootstrap_dependencies[@]}" + "${yashchiki_dependencies[@]}" "${spack_packages[@]}" ) # verify that all concretizations were successful diff --git a/lib/yashchiki/bootstrap_spack.sh b/lib/yashchiki/install_dependencies.sh similarity index 65% rename from lib/yashchiki/bootstrap_spack.sh rename to lib/yashchiki/install_dependencies.sh index 18bfa9ded904719c9b9ba310174edb185269ef1a..d2a48626e3f934f913870da6f9da50060d99ee34 100755 --- a/lib/yashchiki/bootstrap_spack.sh +++ b/lib/yashchiki/install_dependencies.sh @@ -1,6 +1,7 @@ #!/bin/bash # -# Prepare spack by bootstrapping and installing the compiler via spack +# Install dependencies needed during the spack install +# process and the container creation. # set -euo pipefail shopt -s inherit_errexit 2>/dev/null || true @@ -25,33 +26,9 @@ ccache -s # add system compiler ${MY_SPACK_CMD} compiler add --scope site /usr/bin -# provide spack support for environment modules -echo "BOOTSTRAPPING" - # add build_cache ${MY_SPACK_CMD} mirror add --scope site build_mirror file://${BUILD_CACHE_DIR} -install_from_buildcache "${spack_bootstrap_dependencies[@]}" - -# We install all packages needed by boostrap here -for bootstrap_spec in "${spack_bootstrap_dependencies[@]}"; do - ${MY_SPACK_CMD} "${SPACK_ARGS_INSTALL[@]+"${SPACK_ARGS_INSTALL[@]}"}" install --no-cache --show-log-on-error "${bootstrap_spec}" -done - -num_packages_pre_boostrap="$(${MY_SPACK_CMD} find 2>&1 | head -n 1 | awk '/installed packages/ { print $2 }')" - - -num_packages_post_boostrap="$(${MY_SPACK_CMD} find 2>&1 | head -n 1 | awk '/installed packages/ { print $2 }')" - -if (( num_packages_pre_boostrap < num_packages_post_boostrap )); then -cat <<EOF | tr '\n' ' ' >&2 -ERROR: spack bootstrap command did install some packages on its own, this -should not happen, aborting..! -EOF -echo "" - exit 1 -fi - if [ ${YASHCHIKI_BUILD_SPACK_GCC} -eq 1 ]; then # check if it can be specialized spec_compiler="${YASHCHIKI_SPACK_GCC}" @@ -74,3 +51,12 @@ if [ ${YASHCHIKI_BUILD_SPACK_GCC} -eq 1 ]; then # add fresh compiler to spack ${MY_SPACK_CMD} compiler add --scope site ${MY_SPACK_FOLDER}/opt/spack/linux-*/*/gcc-${YASHCHIKI_SPACK_GCC_VERSION}-* fi + +echo "INSTALL YASHCHIKI DEPENDENCIES" + +install_from_buildcache "${yashchiki_dependencies[@]}" + +# We install all packages needed by yashchiki here +for dep_spec in "${yashchiki_dependencies[@]}"; do + ${MY_SPACK_CMD} "${SPACK_ARGS_INSTALL[@]+"${SPACK_ARGS_INSTALL[@]}"}" install --no-cache --show-log-on-error "${dep_spec}" +done