From a121cd7a372a0e188fd3b66e732d028e32370184 Mon Sep 17 00:00:00 2001
From: Nicolas Richart <nicolas.richart@epfl.ch>
Date: Tue, 18 Jun 2024 11:00:23 +0200
Subject: [PATCH] "simplifying" the system packages

---
 ci/setup_spack.sh             | 16 ++++++++++++++++
 stacks/pinot-noir/config.json | 29 +++++++++++++++++++++++++++--
 stacks/pinot-noir/spack.yaml  |  2 +-
 3 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/ci/setup_spack.sh b/ci/setup_spack.sh
index ba9fa94..1f1e245 100755
--- a/ci/setup_spack.sh
+++ b/ci/setup_spack.sh
@@ -84,3 +84,19 @@ spack/bin/spack buildcache keys \
 #spack/bin/spack buildcache update-index /buildcache
 
 cp ${STACK_CONFIG_PATH}/packages_${environment}.yaml ${SPACK_SYSTEM_CONFIG_PATH}/packages_env.yaml
+
+echo "packages:" > ${SPACK_SYSTEM_CONFIG_PATH}/packages_system.yaml
+export system_compiler=$(jq -Mrc '
+.stack
+ | .system_arch as $arch
+ | .system_compiler
+ | to_entries
+ | .[].value
+ | "\(.compiler)@\(.version) \($arch)"
+' ${STACK_CONFIG})
+
+jq -Mrc '
+.stack.system_packages
+ | map("  \(.):\n    require:\n    - spec: \"%\(env.system_compiler)\"")
+ | .[]
+' ${STACK_CONFIG} >> ${SPACK_SYSTEM_CONFIG_PATH}/packages_system.yaml
diff --git a/stacks/pinot-noir/config.json b/stacks/pinot-noir/config.json
index 37dbbe3..4be26e5 100644
--- a/stacks/pinot-noir/config.json
+++ b/stacks/pinot-noir/config.json
@@ -45,7 +45,32 @@
                 "version": "4.2.0",
                 "constraint": "env['environment'] in ['jed']"
             }
-
-        }
+        },
+        "system_packages": [
+            "autoconf",
+            "automake",
+            "autotools",
+            "ca-certificates-mozilla",
+            "cmake",
+            "diffutils",
+            "expat",
+            "findutils",
+            "freetype",
+            "gettext",
+            "glibc",
+            "gmake",
+            "gnuplot",
+            "libevent",
+            "m4",
+            "ncurses",
+            "openssl",
+            "pcre",
+            "perl",
+            "pkgconf",
+            "readline",
+            "sqlite",
+            "texinfo",
+            "zlib-ng"
+        ]
     }
 }
diff --git a/stacks/pinot-noir/spack.yaml b/stacks/pinot-noir/spack.yaml
index d22afaf..b691dab 100644
--- a/stacks/pinot-noir/spack.yaml
+++ b/stacks/pinot-noir/spack.yaml
@@ -2,7 +2,7 @@ spack:
   include:
       - compiler_definitions.yaml
       - packages_env.yaml
-
+      - packages_system.yaml
   definitions:
     # -------------------------------------------------------------------------
     # PE definition
-- 
GitLab