From d12d5917f9ec1a3069203cb3b9b883ac1cc73d2b Mon Sep 17 00:00:00 2001
From: "Fabian.Jakub" <fabian@jakub.com>
Date: Wed, 14 Jun 2023 17:21:06 +0200
Subject: [PATCH] update install of dwd icon tools, now allowing to use hashed
 compiler versions

---
 conf/common/build.yml          | 5 +++++
 templates/common/build_icon.sh | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/conf/common/build.yml b/conf/common/build.yml
index e87dffb..baa307e 100644
--- a/conf/common/build.yml
+++ b/conf/common/build.yml
@@ -31,6 +31,11 @@ icon:
   load_cmd: build_cmd
   version: master # The latest release at the moment of creating this file was 2.6.5-nwp0
 
+dwdicontools:
+  build_cmd: "dwd-icon-tools% %SPACK.COMPILER%"
+  load_cmd: build_cmd
+
+
 python_environment:
   # Name of the virtual environment in the remote platform experiment folder
   folder_name: python_environment
diff --git a/templates/common/build_icon.sh b/templates/common/build_icon.sh
index 8a5f415..c73a72b 100644
--- a/templates/common/build_icon.sh
+++ b/templates/common/build_icon.sh
@@ -49,7 +49,13 @@ else
 fi
 
 # Build dwd-icon-tools
-spack install dwd-icon-tools % "%spack.compiler%"
+SPACK_BUILD_DWDICONTOOLS="%DWDICONTOOLS.BUILD_CMD%"
+SPACK_LOAD_DWDICONTOOLS="%DWDICONTOOLS.LOAD_CMD%"
+if [ "${SPACK_LOAD_DWDICONTOOLS}" == "build_cmd" ]; then SPACK_LOAD_DWDICONTOOLS=${SPACK_BUILD_DWDICONTOOLS}; fi
+if [ ! -z "$SPACK_BUILD_DWDICONTOOLS" ]; then
+  spack install --reuse $SPACK_BUILD_DWDICONTOOLS
+  spack load --first ${SPACK_LOAD_DWDICONTOOLS}
+fi
 
 # Need to get ECCODES DWD definitions:
 eccodes_version=$(spack spec $SPACK_BUILD_ICON | grep eccodes | grep -o "@.*%" | grep -o "[0-9\.]*")
-- 
GitLab