From eb71a115c54267e6840f17b792595e03a77b5ecc Mon Sep 17 00:00:00 2001
From: Nicolas Richart <networms@gmail.ch>
Date: Thu, 11 Jul 2024 16:22:24 +0200
Subject: [PATCH] Merging files

---
 ci/setup_spack.sh                 | 11 +++++++++--
 dockerfiles/rhel9-kuma/Dockerfile |  2 ++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ci/setup_spack.sh b/ci/setup_spack.sh
index c220750..8122933 100755
--- a/ci/setup_spack.sh
+++ b/ci/setup_spack.sh
@@ -82,11 +82,13 @@ cp "${SPACK_SYSTEM_CONFIG_PATH}/mirrors.yaml" spack/etc/spack
 
 echo "Setting up packages"
 
-if [ ! -e ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml ]
+if [ -e ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml ]
 then
-  echo "packages:" > ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml
+  mv ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml packages.yaml.old
 fi
 
+echo "packages:" > ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml
+
 export system_compiler=$(jq -Mrc '
 .stack
  | .system_arch as $arch
@@ -102,6 +104,11 @@ jq -Mrc '
  | .[]
 ' ${STACK_CONFIG} >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml
 
+if [ -e ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml.old ]
+then
+  yq '. *= load("packages.yaml.old")' ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml
+fi
+
 cp "${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml" spack/etc/spack
 
 echo "Setting up extra repos"
diff --git a/dockerfiles/rhel9-kuma/Dockerfile b/dockerfiles/rhel9-kuma/Dockerfile
index 0a2f053..1584409 100644
--- a/dockerfiles/rhel9-kuma/Dockerfile
+++ b/dockerfiles/rhel9-kuma/Dockerfile
@@ -49,3 +49,5 @@ RUN yum install -y --enablerepo=$CUDA_REPO \
 RUN yum install -y --enablerepo=$GPFS_REPO \
     gpfs.base \
     && yum -y clean all && rm -fr /var/cache 
+
+RUN pip3 install yq
-- 
GitLab