From 23e03ccba61bfb5580452b00eeb60cb9c5a5712c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck <wdconinc@gmail.com> Date: Tue, 4 Apr 2023 17:50:00 +0000 Subject: [PATCH] fix: readd purge; buildcache mirror support --- containers/jug/dev.Dockerfile | 12 +++++++++++- spack-environment/Makefile | 6 ++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/containers/jug/dev.Dockerfile b/containers/jug/dev.Dockerfile index 371973ac1..8fece770a 100644 --- a/containers/jug/dev.Dockerfile +++ b/containers/jug/dev.Dockerfile @@ -104,7 +104,17 @@ RUN rm -r /usr/local \ && cd /opt/spack-environment \ && source $SPACK_ROOT/share/spack/setup-env.sh \ && spack env activate --dir /opt/spack-environment/${ENV} \ - && make -C /opt/spack-environment BUILDCACHE=/var/cache/spack-mirror + && make -C /opt/spack-environment --keep-going SPACK_ENV=${ENV} \ + BUILDCACHE_DIR=/var/cache/spack-mirror \ + BUILDCACHE_MIRROR=eic-spack + +## 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 +RUN --mount=type=cache,target=/var/cache/spack-mirror,sharing=locked \ + cd /opt/spack-environment \ + && [ -z "${CACHE_NUKE}" ] \ + || rm -rf /var/cache/spack-mirror/build_cache/* \ ## Extra post-spack steps: ## - Python packages diff --git a/spack-environment/Makefile b/spack-environment/Makefile index da88e8992..1a2654fd7 100644 --- a/spack-environment/Makefile +++ b/spack-environment/Makefile @@ -7,7 +7,8 @@ export SPACK_COLOR = always SPACK_ENV ?= dev -BUILDCACHE := $(SPACK_ENV)/cache +BUILDCACHE_DIR := $(SPACK_ENV)/cache +BUILDCACHE_MIRROR := .PHONY: all clean @@ -19,7 +20,8 @@ endif $(SPACK_ENV)/push: $(addprefix $(SPACK_ENV)/push/,$($(SPACK_ENV)/SPACK_PACKAGE_IDS)) @mkdir -p $(BUILDCACHE) - $(foreach buildcache, $(BUILDCACHE), $(SPACK) buildcache update-index $(buildcache) ;) + $(foreach buildcache, $(BUILDCACHE_DIR), $(SPACK) buildcache update-index --directory $(buildcache) ;) + $(foreach buildcache, $(BUILDCACHE_MIRROR), $(SPACK) buildcache update-index --mirror-name $(buildcache) ;) $(SPACK_ENV)/push/%: $(SPACK_ENV)/install/% @mkdir -p $(dir $@) -- GitLab