From dab47b1e10ccbe66696e6de8634047f019b085f8 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Sat, 27 Jan 2024 20:16:30 +0000
Subject: [PATCH] Update 3 files

- /containers/jug/dev.Dockerfile
- /.gitlab-ci.yml
- /spack.sh
---
 .gitlab-ci.yml                |  1 +
 containers/jug/dev.Dockerfile | 10 +++++++++-
 spack.sh                      |  6 ++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6b864a3d2..a8ca701d3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -325,6 +325,7 @@ jug_dev:
                    --build-arg SPACK_ORGREPO=${SPACK_ORGREPO}
                    --build-arg SPACK_VERSION=${SPACK_VERSION}
                    --build-arg SPACK_CHERRYPICKS="${SPACK_CHERRYPICKS}"
+                   --build-arg SPACK_CHERRYPICKS_FILES="${SPACK_CHERRYPICKS_FILES}"
                    --build-arg EICSPACK_ORGREPO=${EICSPACK_ORGREPO}
                    --build-arg EICSPACK_VERSION=${EICSPACK_VERSION}
                    --build-arg EICSPACK_CHERRYPICKS="${EICSPACK_CHERRYPICKS}"
diff --git a/containers/jug/dev.Dockerfile b/containers/jug/dev.Dockerfile
index 1ddbced22..9f372fe17 100644
--- a/containers/jug/dev.Dockerfile
+++ b/containers/jug/dev.Dockerfile
@@ -33,6 +33,7 @@ ENV SPACK_ROOT=/opt/spack
 ARG SPACK_ORGREPO="spack/spack"
 ARG SPACK_VERSION="releases/v0.20"
 ARG SPACK_CHERRYPICKS=""
+ARG SPACK_CHERRYPICKS_FILES=""
 ADD https://api.github.com/repos/${SPACK_ORGREPO}/commits/${SPACK_VERSION} /tmp/spack.json
 RUN <<EOF
 git config --global advice.detachedHead false
@@ -40,7 +41,14 @@ git clone --filter=tree:0 https://github.com/${SPACK_ORGREPO}.git ${SPACK_ROOT}
 git -C ${SPACK_ROOT} checkout ${SPACK_VERSION}
 if [ -n "${SPACK_CHERRYPICKS}" ] ; then
   SPACK_CHERRYPICKS=$(git -C ${SPACK_ROOT} rev-list --topo-order ${SPACK_CHERRYPICKS} | grep -m $(echo ${SPACK_CHERRYPICKS} | wc -w)  "${SPACK_CHERRYPICKS}" | tac)
-  git -C ${SPACK_ROOT} cherry-pick -n ${SPACK_CHERRYPICKS}
+  eval "declare -A SPACK_CHERRYPICKS_FILES_ARRAY=(${SPACK_CHERRYPICKS})"
+  for hash in ${SPACK_CHERRYPICKS} ; do
+    if [ -n ${SPACK_CHERRYPICKS_FILES_ARRAY["${hash}"]+found} ] ; then
+      git -C ${SPACK_ROOT} show ${hash} -- ${SPACK_CHERRYPICKS_FILES_ARRAY[${hash}]//,/ } | patch -p1 -d ${SPACK_ROOT}
+    else
+      git -C ${SPACK_ROOT} cherry-pick -n ${hash}
+    fi
+  done
 fi
 ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash /usr/bin/docker-shell
 ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash /usr/bin/interactive-shell
diff --git a/spack.sh b/spack.sh
index a1e4492b2..df4edd160 100644
--- a/spack.sh
+++ b/spack.sh
@@ -30,6 +30,11 @@ c07ddf83c32b7129247fe90eed486dd844047087
 0fed2d66bf0eec799707dd1b88ac9419f6ae14e1
 963e2ca82883cdc1287f1035c15d1a7e9a6fe612
 ---
+## Optional hash table with comma-separated file list
+read -r -d '' SPACK_CHERRYPICKS_FILES <<- \
+--- || true
+[19c20563cc86140aaf352d72079bd9de292be0ac]=var/spack/repos/builtin/packages/pythia8/package.py
+---
 ## Ref: https://github.com/spack/spack/commit/[hash]
 ## [hash]: [description]
 ## ed8ecc469e7b87842a876323878831e301f136a2: podio: Add the latest tag (0.17.2)
@@ -53,3 +58,4 @@ c07ddf83c32b7129247fe90eed486dd844047087
 ## 1255620a14afa3ad4aad681a847a3a1704141976: Fix infinite recursion when computing concretization errors
 ## 0fed2d66bf0eec799707dd1b88ac9419f6ae14e1: (py-)onnx: new version 1.14.{0,1}, 1.15.0
 ## 963e2ca82883cdc1287f1035c15d1a7e9a6fe612: edm4hep: add latest tag 0.10.3
+## 19c20563cc86140aaf352d72079bd9de292be0ac: Initial License Checkin
\ No newline at end of file
-- 
GitLab