From 560c9e2e81919b2517d3941a61bc224b4abe88ee69d0e71cd4547ec031d52a96 Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Thu, 4 May 2023 10:15:58 +0000 Subject: [PATCH] Accepting request 1084566 from home:eeich:branches:network:cluster OBS-URL: https://build.opensuse.org/request/show/1084566 OBS-URL: https://build.opensuse.org/package/show/network:cluster/spack?expand=0&rev=70 --- ...valid-container.os_packages-commands.patch | 39 ++++++ ...ent-is-set-up-in-Dockerfile-template.patch | 40 ------ spack-0.19.1.tar.gz | 3 - spack-0.19.2.tar.gz | 3 + spack.changes | 58 ++++++++ spack.spec | 13 +- spack_get_libs.sh | 124 ++++++++++++++++++ 7 files changed, 234 insertions(+), 46 deletions(-) create mode 100644 Add-zypper-to-the-valid-container.os_packages-commands.patch delete mode 100644 Make-sure-spack-environment-is-set-up-in-Dockerfile-template.patch delete mode 100644 spack-0.19.1.tar.gz create mode 100644 spack-0.19.2.tar.gz create mode 100644 spack_get_libs.sh diff --git a/Add-zypper-to-the-valid-container.os_packages-commands.patch b/Add-zypper-to-the-valid-container.os_packages-commands.patch new file mode 100644 index 0000000..88de987 --- /dev/null +++ b/Add-zypper-to-the-valid-container.os_packages-commands.patch @@ -0,0 +1,39 @@ +From: Egbert Eich +Date: Thu Apr 6 11:29:30 2023 +0200 +Subject: Add 'zypper' to the valid container.os_packages commands +Patch-mainline: Not yet +Git-commit: 0614150f86a3554118f60614e9b0cfaf8fb2aa12 +References: + +Signed-off-by: Egbert Eich +Signed-off-by: Egbert Eich +--- + lib/spack/docs/containers.rst | 2 +- + lib/spack/spack/schema/container.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) +diff --git a/lib/spack/docs/containers.rst b/lib/spack/docs/containers.rst +index 9c6f8a26..1452b6a0 100644 +--- a/lib/spack/docs/containers.rst ++++ b/lib/spack/docs/containers.rst +@@ -498,7 +498,7 @@ to customize the generation of container recipes: + - No + * - ``os_packages:command`` + - Tool used to manage system packages +- - ``apt``, ``yum`` ++ - ``apt``, ``yum``, ``zypper`` + - Only with custom base images + * - ``os_packages:update`` + - Whether or not to update the list of available packages +diff --git a/lib/spack/spack/schema/container.py b/lib/spack/spack/schema/container.py +index b05199f8..7c98a1db 100644 +--- a/lib/spack/spack/schema/container.py ++++ b/lib/spack/spack/schema/container.py +@@ -54,7 +54,7 @@ + "os_packages": { + "type": "object", + "properties": { +- "command": {"type": "string", "enum": ["apt", "yum"]}, ++ "command": {"type": "string", "enum": ["apt", "yum", "zypper"]}, + "update": {"type": "boolean"}, + "build": _list_of_packages, + "final": _list_of_packages, 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 deleted file mode 100644 index 3698809..0000000 --- a/Make-sure-spack-environment-is-set-up-in-Dockerfile-template.patch +++ /dev/null @@ -1,40 +0,0 @@ -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-0.19.1.tar.gz b/spack-0.19.1.tar.gz deleted file mode 100644 index eb0986f..0000000 --- a/spack-0.19.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c9666f0b22ccf3cbda2736104d5d4e3b9cad5b4b4f01874a501e97d2c9477452 -size 9420035 diff --git a/spack-0.19.2.tar.gz b/spack-0.19.2.tar.gz new file mode 100644 index 0000000..815bcd5 --- /dev/null +++ b/spack-0.19.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4978b37da50f5690f4e1aa0cfe3975a89ccef85d96c68d417ea0716a8ce3aa98 +size 9424447 diff --git a/spack.changes b/spack.changes index 8449c43..820e603 100644 --- a/spack.changes +++ b/spack.changes @@ -1,3 +1,61 @@ +------------------------------------------------------------------- +Mon Apr 17 06:59:15 UTC 2023 - Egbert Eich + +- Update to version 0.19.2 with the following bug fixes: + * Ignore global variant requirement for packages that do not define it. + * Compiler wrapper: improved parsing of linker arguments. + * Views: fix support for optional Python extensions. + * Views: fix issue where Python executable gets symlinked instead of copied. + * Fix a bug where tests were not added when concretizing together. + * Increase db timeout from 3s to 60s to improve stability of parallel + installs. + * Buildcache: improve error handling in downloads. + * Module files for packages installed from buildcache have long placeholder + paths abbreviated in configure args section. + * Ensure file with build environment variables is truncated when writing + to it. + * spack config update now works on active environments; +- Add: + Add-zypper-to-the-valid-container.os_packages-commands.patch + This adds `zypper` to the valid OS package managers that can + be specified in a slack.yaml container description like: + spack: + ... + container: + .. + os_packages: + command: zypper + .. +- Add: spack_get_libs.sh + This scripts obtains library and include paths for spack-build + libraries and outputs shell commands which set these as + environment variables. + Additionally, it generates a command line to prepend these lib + directories to LD_LIBRARY_PATH. Thus, the variables can be set + in the current shell by running `source $(spack_get_libs.sh foo)`. + When using `bash` this script may also be sourced directly. + The names of the environment variables are the upper-cased library + names with the strings 'LIB_' and 'INC_' prepended. Thus, for a + library 'foo', they would be 'INC_FOO' and 'LIB_FOO'. + These variables may be used at build time to point the compiler + to the include and library files (bsc#1208751). +- Drop: + Make-sure-spack-environment-is-set-up-in-Dockerfile-template.patch + This patch should not be needed. When building using `podman` use: + `podman build --format docker ...` to enable the non-OCI compliant + instructions in a Dockerfile. +- Add info, makeinfo, libcurl-devel, patchelf to the recommended + packages to add. + Fix: openssl-devel -> libopenssl-devel + +------------------------------------------------------------------- +Thu Apr 6 09:30:50 UTC 2023 - Egbert Eich + +- Add 'zypper' as valid command to container.os_packages. This + allows to build SUSE container using non-default registries. +- Add 'awk', 'git', 'gzip' and 'gunzip' to the requires. +- Add 'patchelf' to the recommended packages. + ------------------------------------------------------------------- Thu Mar 30 09:34:39 UTC 2023 - Egbert Eich diff --git a/spack.spec b/spack.spec index ce487cf..dc2d8f9 100644 --- a/spack.spec +++ b/spack.spec @@ -31,7 +31,7 @@ ExclusiveArch: do_not_build # These packages are found and can be used by spack, %{_sysconfdir}/spack/packages-yaml # needs to be updated when one of these packages is updated or uninstalled. # Distinguish between packages we recommend and packages which -%define spack_trigger_recommended_packages autoconf bash bison bzip2 libzip-devel cmake-full ccache cpio diffutils findutils flex git-lfs make m4 ncurses-devel libtool openssl-devel perl-base pkgconf pkg-config python3-base tar info xz xz-devel +%define spack_trigger_recommended_packages autoconf bash bison bzip2 libzip-devel cmake-full ccache cpio diffutils findutils flex git-lfs info make makeinfo m4 ncurses-devel libtool libcurl-devel libopenssl-devel perl-base pkgconf pkg-config python3-base tar xz xz-devel patchelf %define spack_trigger_recommended_compilers gcc gcc-c++ gcc-fortran @@ -43,7 +43,7 @@ ExclusiveArch: do_not_build # non oss packages %define spack_trigger_external cuda-nvcc Name: spack -Version: 0.19.1 +Version: 0.19.2 Release: 0 Summary: Package manager for HPC systems License: Apache-2.0 AND MIT AND Python-2.0 AND BSD-3-Clause @@ -55,6 +55,7 @@ Source3: run-find-external.sh.in Source4: https://en.opensuse.org/index.php?title=Spack&action=raw&ref=157522#/README-oo-wiki # Source5 is from https://docs.python.org/3/objects.inv, but has permanent changes so using a static version Source5: objects.inv +Source6: spack_get_libs.sh Patch2: Adapt-shell-scripts-that-set-up-the-environment-for-different-shells.patch Patch4: added-target-and-os-calls-to-output-of-spack-spec-co.patch Patch5: Make-spack-paths-compliant-to-distro-installation.patch @@ -62,7 +63,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 +Patch10: Add-zypper-to-the-valid-container.os_packages-commands.patch %if %{without doc} BuildRequires: fdupes BuildRequires: lua-lmod @@ -71,12 +72,15 @@ BuildRequires: python3-urllib3 BuildRequires: sudo BuildRequires: sysuser-tools Requires: %{name}-recipes = %{version} +Requires: awk Requires: bzip2 Requires: coreutils Requires: curl Requires: gcc-c++ Requires: gcc-fortran +Requires: git Requires: gpg2 +Requires: gzip Requires: libbz2-devel Requires: lua-lmod Requires: make @@ -85,6 +89,7 @@ Requires: polkit Requires: python3-clingo Requires: sudo Requires: tar +Requires: unzip Requires: xz Recommends: %spack_trigger_recommended_packages %spack_trigger_recommended_compilers %else @@ -304,6 +309,8 @@ cp -r var/spack/* %{buildroot}%{_localstatedir}/lib/spack mv %{buildroot}%{_localstatedir}/lib/spack/repos %{buildroot}%{_datarootdir}/spack cp -r bin/sbang %{buildroot}/%{_bindir} cp -r bin/spack* %{buildroot}%{_bindir}/ +cp %{S:6} %{buildroot}%{_bindir}/ +chmod 0755 %{buildroot}%{_bindir}/%{basename:%{S:6}} cp etc/spack/defaults/config.yaml %{buildroot}%{_sysconfdir}/skel/.spack/ install -m 755 %{S:3} %{buildroot}/%{spack_dir}/run-find-external.sh sed -i -e 's#@@_sysconfdir@@#%{_sysconfdir}#' %{buildroot}/%{spack_dir}/run-find-external.sh diff --git a/spack_get_libs.sh b/spack_get_libs.sh new file mode 100644 index 0000000..5beced0 --- /dev/null +++ b/spack_get_libs.sh @@ -0,0 +1,124 @@ +#! /bin/bash +#set -x + +spack_shtyp=bash + +help() { + echo -e "$0 [--help][--csh] lib ... + Print set commands to set or set LD_LIBRARY_PATH to libraries + specified as arguments as well as variables holding each library + directory individually. These are usful when linking applications + against these libraries. + The variable names of the latter begin with 'LIB_' followed by + the upper cased library name." +} + +error() { + echo -e "$1" >&2 +} + +contains() { + local a=$1 + shift + local -a b=($@) + local i + for i in ${b[*]}; do + [ "$i" == "$a" ] && return 0 + done + return 1 +} + +path_contains() { + local a=$1 + local i + [ -n "$2" ] || return 1 + OFS=$IFS + IFS=: + for i in $2; do + IFS=$OFS + [ "$i" == "$a" ] && return 0 + done + return 1 +} + +print_env() { + case $spack_shtyp in + csh) + echo "setenv $1 $2" ;; + bash) + if $spack_srcd; then + eval $1=$2 + export $1 + else + echo -e "$1=$2\nexport $1" + fi ;; + esac +} + +get_paths() +{ + local -A libpaths includepaths + local OFS=$IFS + local ld_exist=$LD_LIBRARY_PATH + IFS=" +" + local package_list="$1" + local format="> {hash:7} {name}{@version}{%compiler}{arch=architecture}" + + local l i + for l in $(spack find --format "{name}" --paths $package_list); do + local lib=${l%% *} + local path=${l##* } + if contains $lib "${!libpaths[@]}"; then + error "$lib matches multiple packages\n Matching packages:" + spack find --format ${format} ${lib} >&2 + error " Use a more specific spec (e.g., prepend '/' to the hash)." + $spack_srcd || exit 1 + fi + for i in lib64 lib; do + if [ -d $path/$i ]; then + libpaths[$lib]="$path/$i" + break + fi + done + if [ -d $path/include ]; then + includepaths[$lib]="$path/include" + fi + done + IFS=$OFS + + local -A libs + local ld_library_path + for i in ${!libpaths[@]}; do + libs[LIB_${i^^*}]="${libpaths[$i]}" + path_contains ${libpaths[$i]} "${ld_exist}" || \ + ld_library_path+="${libpaths[$i]}:" + done + for i in ${!includepaths[@]}; do + eval [ "unset" = "\${INC_${i}:-unset}" ] && + print_env "INC_${i^^*}" "${includepaths[$i]}" + done + for i in ${!libs[@]}; do + eval [ "unset" = "\${${i}:-unset}" ] && print_env $i "${libs[$i]}" + done + [ -n "$ld_library_path" ] && \ + print_env LD_LIBRARY_PATH "${ld_library_path}\$LD_LIBRARY_PATH" +} + +spack_srcd=false +( + [[ -n $ZSH_VERSION && $ZSH_EVAL_CONTEXT =~ :file$ ]] || + [[ -n $BASH_VERSION ]] && (return 0 2>/dev/null) +) && spack_srcd=true + +while [ -n "$1" ]; do + case $1 in + *-help|*-h) help; $spack_srcd || exit 0 ;; + *-csh|*-tcsh) + spack_shtyp=csh ;; + *) package_list+=" $1" ;; + esac + shift +done + +get_paths "$package_list"