From d6c5bac7d5dcd4f6894c34a6c01f6c760a0466c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Oriol=20Tint=C3=B3=20Prims?= <oriol.tinto@lmu.de>
Date: Mon, 27 Mar 2023 10:29:54 +0200
Subject: [PATCH] Load bzip2 in a different place.

---
 templates/common/build_icon.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/templates/common/build_icon.sh b/templates/common/build_icon.sh
index 6d9bd83..68c7d1f 100644
--- a/templates/common/build_icon.sh
+++ b/templates/common/build_icon.sh
@@ -16,6 +16,10 @@ cd ${WORKDIR} || exit
 . ${WORKDIR}/proj/platforms/common/spack_utils.sh
 load_spack "%spack.init%" "%spack.root%" "%spack.url%" "%spack.branch%" "%spack.compiler%" "%spack.disable_local_config%" "%spack.user_cache_path%" "%spack.user_config_path%"
 
+if [ ! $(rpm -qa | grep bzip2) ]; then
+  spack install bzip2
+  spack load --first bzip2
+fi
 
 
 SPACK_BUILD_ICON="%spack.build_cmd%"
@@ -28,6 +32,7 @@ if [ ! -z "$SPACK_BUILD_ICON" ]; then
   else
     spack repo add ${WORKDIR}/proj/spack_repo
   fi
+
   spack install $SPACK_BUILD_ICON
   spack load $SPACK_BUILD_ICON
 else
@@ -42,11 +47,6 @@ if [ ! -f "${definitions_tar_file}" ]; then
   defs_url=https://opendata.dwd.de/weather/lib/grib/${definitions_tar_file}
   wget "${defs_url}"
 
-  if [ ! $(rpm -qa | grep bzip2) ]; then
-    spack install bzip2
-    spack load --first bzip2
-  fi
-
   # Decompress definitions file
   tar -xf "${definitions_tar_file}"
   # Create a file containing the environment variable that needs to be set in order to use DWD's definitions:
-- 
GitLab