From f5f48843826dfed91b46afa14928987f3dd8a9a7 Mon Sep 17 00:00:00 2001 From: Matthias Krack Date: Tue, 17 Feb 2026 16:58:55 +0100 Subject: [PATCH] Minor fixes for make_cp2k.sh - Silence (garbage) output of spack compiler find - Process only non-empty SED_PATTERN_LIST - Add -e flag to sed command --- make_cp2k.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/make_cp2k.sh b/make_cp2k.sh index c88690b993..c6144cd040 100755 --- a/make_cp2k.sh +++ b/make_cp2k.sh @@ -816,10 +816,12 @@ if [[ ! -d "${SPACK_BUILD_PATH}" ]]; then fi # Apply feature selection to spack configuration file - eval sed -E "${SED_PATTERN_LIST}" -i "${CP2K_CONFIG_FILE}" + if [[ -n "${SED_PATTERN_LIST}" ]]; then + eval sed -E "${SED_PATTERN_LIST}" -i "${CP2K_CONFIG_FILE}" + fi # Find all compilers - if ! spack compiler find; then + if ! spack compiler find &> /dev/null; then echo "ERROR: The compiler detection of spack failed" ${EXIT_CMD} 1 fi @@ -827,7 +829,7 @@ if [[ ! -d "${SPACK_BUILD_PATH}" ]]; then # Retrieve the newest compiler version found by spack GCC_VERSION_NEWEST="$(spack compilers | awk '/gcc/ {print $2}' | sort -V | tail -n 1)" echo "The newest GCC compiler version found by spack is ${GCC_VERSION_NEWEST}" - GCC_VERSION_NEWEST="$(echo "${GCC_VERSION_NEWEST}" | sed -E 's/.*@([0-9]+).*/\1/' | cut -d. -f1)" + GCC_VERSION_NEWEST="$(echo "${GCC_VERSION_NEWEST}" | sed -E -e 's/.*@([0-9]+).*/\1/' | cut -d. -f1)" # Check if the newest compiler version found on the host system is new enough GCC_VERSION_MINIMUM="10"