From 31399773dc3a64269714936f9f477628dc617eaa Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 17 Aug 2023 16:55:28 -0700 Subject: [PATCH] reduce size by bringing all spack commands into a single script that deletes everything but the view after successfully building --- .../{set-up-spack.sh => build-with-spack.sh} | 22 +++++++++++++++---- .../ubuntu/apt-install-defaults-plus-args.sh | 1 - ubuntu/20.04/Dockerfile | 16 ++++++-------- ubuntu/22.04/Dockerfile | 18 +++++++-------- ubuntu/23.04/Dockerfile | 17 +++++++------- ubuntu/clang/Dockerfile | 17 +++++--------- 6 files changed, 48 insertions(+), 43 deletions(-) rename scripts/{set-up-spack.sh => build-with-spack.sh} (62%) diff --git a/scripts/set-up-spack.sh b/scripts/build-with-spack.sh similarity index 62% rename from scripts/set-up-spack.sh rename to scripts/build-with-spack.sh index 3c02df31ad..5c55b51986 100755 --- a/scripts/set-up-spack.sh +++ b/scripts/build-with-spack.sh @@ -11,9 +11,8 @@ popd # temporary path update for this script export PATH=/opt/spack/bin:$PATH -# Install Clingo for Spack -python3 -m pip install --upgrade pip -python3 -m pip install clingo +# Bootstrap clingo +spack bootstrap now # Find packages already installed on system, e.g. autoconf # IMPORTANT: ensure that all binaries installed include their development files @@ -21,7 +20,7 @@ python3 -m pip install clingo # spack spack external find # NOTE no all # Find some packages out of the default check set that work -spack external find python perl binutils git tar xz bzip2 +spack external find python perl binutils git tar xz bzip2 hwloc ncurses # configure spack # build for the generic target spack config add 'packages:all:target:[x86_64]' @@ -29,6 +28,21 @@ spack config add 'packages:all:target:[x86_64]' spack config add 'concretizer:reuse:true' # Generate spack environment for packages spack env create --dir /opt/env --with-view /opt/view +# Activate created environment +spack env activate --without-view /opt/env +# Add binary mirror +spack mirror add develop https://binaries.spack.io/releases/develop +# Move install tree outside of spack directory so spack repo can be removed after +spack config add "config:install_tree:root:'/opt'" +# Concretize spec +spack spec --reuse $0 +# Add spec to environment +spack add $0 +spack buildcache keys --install --trust +spack install --fail-fast + +# delete spack to save space +rm -rf /opt/spack # ensure clangs and others that don't inject rpaths make working executables cat >/etc/ld.so.conf.d/spack_view.conf <