From 3f7ce6684e8c5f93bf3ac3aa3e94cbcd6c7b2f21 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Wed, 19 Apr 2023 21:44:24 +0000
Subject: [PATCH] fix: disable view until after all packages built

---
 containers/jug/dev.Dockerfile    | 9 ++++++++-
 spack-environment/dev/spack.yaml | 6 +-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/containers/jug/dev.Dockerfile b/containers/jug/dev.Dockerfile
index 98008cf00..ce384b625 100644
--- a/containers/jug/dev.Dockerfile
+++ b/containers/jug/dev.Dockerfile
@@ -102,13 +102,20 @@ COPY --from=spack spack-environment/ /opt/spack-environment/
 ARG ENV=dev
 RUN --mount=type=cache,target=/var/cache/spack-mirror,sharing=locked    \
     cd /opt/spack-environment                                           \
- && rm -r /usr/local                                                    \
  && source $SPACK_ROOT/share/spack/setup-env.sh                         \
  && spack env activate --dir /opt/spack-environment/${ENV}              \
  && make -C /opt/spack-environment SPACK_ENV=${ENV}                     \
     BUILDCACHE_DIR=/var/cache/spack-mirror                              \
     BUILDCACHE_MIRROR=eic-spack
 
+## Create view at /usr/local
+RUN --mount=type=cache,target=/var/cache/spack-mirror,sharing=locked    \
+    cd /opt/spack-environment                                           \
+ && source $SPACK_ROOT/share/spack/setup-env.sh                         \
+ && spack env activate --dir /opt/spack-environment/${ENV}              \
+ && rm -r /usr/local                                                    \
+ && spack env view enable /usr/local
+
 ## Optional, nuke the buildcache after install, before (re)caching
 ## This is useful when going to completely different containers,
 ## or intermittently to keep the buildcache step from taking too much time
diff --git a/spack-environment/dev/spack.yaml b/spack-environment/dev/spack.yaml
index 7addddadf..16b588390 100644
--- a/spack-environment/dev/spack.yaml
+++ b/spack-environment/dev/spack.yaml
@@ -76,8 +76,4 @@ spack:
     - stow@2.3.1
     - tensorflow-lite@2.8.0 -xnnpack
     - xrootd@5.5.1 cxxstd=17 +python +scitokens-cpp
-  view:
-    default:
-      root: /usr/local
-      link: all
-      link_type: symlink
+  view: false
-- 
GitLab