From f4f42e608b0d3d532779b7480ba4127fb06bc4f1 Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Mon, 15 Apr 2024 13:23:41 +0300
Subject: [PATCH] feat: don't rm spack.lock file

by adding test dependencies in the hash calculation (see https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/spack/-/commit/01330d6328807175eda9504d02824fdd209e6c64) we can avoid the workaround of removing the lockfile every time before spack install --test root
---
 install_spack_env.sh | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/install_spack_env.sh b/install_spack_env.sh
index 70349615..9762ac9b 100644
--- a/install_spack_env.sh
+++ b/install_spack_env.sh
@@ -73,18 +73,12 @@ rm -rf $SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV/site-config && cp -
 spack-python $EBRAINS_REPO/site-config/ymerge.py $EBRAINS_REPO/spack.yaml $EBRAINS_REPO/site-config/$SYSTEMNAME/spack.yaml > /tmp/spack.yaml
 cp /tmp/spack.yaml $SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV/
 
-# There is a known spack bug (https://github.com/spack/spack/issues/29447) in installing test dependencies
-# for installation tests. The workaround suggested in the issue is to NOT concretize separately, but simply
-# remove the .lock file and let the environment be concretized by the spack install command:
-rm $SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV/spack.lock || echo "No spack.lock file"
-
 # activate environment
 spack env activate --without-view $EBRAINS_SPACK_ENV
 
 # fetch all sources
-spack concretize --fresh --test root
+spack concretize --force --fresh --test root
 spack-python -c "exit(not len(spack.environment.active_environment().uninstalled_specs()))" && spack fetch --dependencies --missing
-rm $SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV/spack.lock
 
 # install the environment, use 2 jobs to reduce the amount of required RAM
 spack install -y -j2 --fresh --test root
-- 
GitLab