diff --git a/Make-sure-spack-environment-is-set-up-in-Dockerfile-template.patch b/Make-sure-spack-environment-is-set-up-in-Dockerfile-template.patch new file mode 100644 index 0000000..3698809 --- /dev/null +++ b/Make-sure-spack-environment-is-set-up-in-Dockerfile-template.patch @@ -0,0 +1,40 @@ +From: Egbert Eich +Date: Tue Jan 31 09:24:46 2023 +0100 +Subject: Make sure spack environment is set up in Dockerfile template +Patch-mainline: Not yet +Git-commit: 865116877fe2536485326aa0fb53943160fa5e25 +References: + +The Dockerfile template did source the script +/opt/spack/share/spack/setup-env.sh +which lead to the binary 'spack' not being found and the +environment not being set up properly for `spack env activate .`. + +Signed-off-by: Egbert Eich +Signed-off-by: Egbert Eich +--- + share/spack/templates/container/Dockerfile | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) +diff --git a/share/spack/templates/container/Dockerfile b/share/spack/templates/container/Dockerfile +index b10dcf08..dc9b91e5 100644 +--- a/share/spack/templates/container/Dockerfile ++++ b/share/spack/templates/container/Dockerfile +@@ -19,7 +19,8 @@ RUN mkdir {{ paths.environment }} \ + {{ manifest }} > {{ paths.environment }}/spack.yaml + + # Install the software, remove unnecessary deps +-RUN cd {{ paths.environment }} && spack env activate . && spack install --fail-fast && spack gc -y ++RUN . /opt/spack/share/spack/setup-env.sh && \ ++ cd {{ paths.environment }} && spack env activate . && spack install --fail-fast && spack gc -y + {% if strip %} + + # Strip all the binaries +@@ -31,7 +32,7 @@ RUN find -L {{ paths.view }}/* -type f -exec readlink -f '{}' \; | \ + {% endif %} + + # Modifications to the environment that are necessary to run +-RUN cd {{ paths.environment }} && \ ++RUN . /opt/spack/share/spack/setup-env.sh && cd {{ paths.environment }} && \ + spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh + + {% if extra_instructions.build %} diff --git a/spack.changes b/spack.changes index f2da53b..179d250 100644 --- a/spack.changes +++ b/spack.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jan 31 08:29:00 UTC 2023 - Egbert Eich + +- Make sure the spack environment is set up correctly in + spack-generated Dockerfiles (boo#1207784): + Make-sure-spack-environment-is-set-up-in-Dockerfile-template.patch + ------------------------------------------------------------------- Wed Jan 11 13:04:37 UTC 2023 - Egbert Eich diff --git a/spack.spec b/spack.spec index 50ad8af..1b109a9 100644 --- a/spack.spec +++ b/spack.spec @@ -55,6 +55,7 @@ Patch6: Fix-error-during-documentation-build-due-to-recursive-module-inc Patch7: Fix-Spinx-configuration-to-avoid-throwing-errors.patch Patch8: Set-modules-default-to-lmod.patch Patch9: Add-support-for-container-building-using-a-SLE-base-container.patch +Patch100: Make-sure-spack-environment-is-set-up-in-Dockerfile-template.patch %if %{without doc} BuildRequires: fdupes BuildRequires: lua-lmod