import rpm-mpi-hooks-8-3.el9

This commit is contained in:
CentOS Sources 2021-11-03 16:50:21 -04:00 committed by Stepan Oksanichenko
commit fd6ce67905
8 changed files with 360 additions and 0 deletions

0
.gitignore vendored Normal file
View File

0
.rpm-mpi-hooks.metadata Normal file
View File

19
SOURCES/LICENSE Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2015 Sandro Mani <manisandro@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

6
SOURCES/mpi.attr Normal file
View File

@ -0,0 +1,6 @@
%__mpi_provides %{_rpmconfigdir}/mpi.prov %{?__filter_GLIBC_PRIVATE:--filter-private}
%__mpi_requires %{_rpmconfigdir}/mpi.req %{?__filter_GLIBC_PRIVATE:--filter-private}
%__mpi_path ^%{_prefix}/lib(64)?/.*$
%__mpi_magic ^(setuid )?(setgid )?(sticky )?ELF (32|64)-bit.*$
%__mpi_flags exeonly,magic_and_path
%__elf_exclude_path ^%{_prefix}/lib(64)?/.*$

88
SOURCES/mpi.prov Executable file
View File

@ -0,0 +1,88 @@
#!/bin/bash
# Copyright (c) 2015-2016 Sandro Mani <manisandro@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE
buildroot="$RPM_BUILD_ROOT"
if [ ! -d "$buildroot" ]; then
>&2 echo "Invalid buildroot"
exit 1
fi
# Arguments are passed to elfdeps
elfdepsargs="$@"
# Search for all MPI implementations:
# - Search all modules which start with mpi
# - For each module, store $MPI_DIR -> $MPI_COMPILER in assoc. array
declare -A mpi_compiler_for_dir
if [ -e /etc/profile.d/modules.sh ]; then
. /etc/profile.d/modules.sh;
# Add moduledirs in buildroot also for cases where an MPI implementation
# package is being built, meaning that its module files are not yet installed
IFS=':' read -ra _MODULEPATH <<< "$MODULEPATH"
for i in "${!_MODULEPATH[@]}"; do
_MODULEPATH[$i]=$buildroot${_MODULEPATH[$i]}
done
export MODULEPATH="$MODULEPATH:$(IFS=:; echo "${_MODULEPATH[*]}")"
for module in $(module -t avail 2>&1 | grep "^mpi/." | sed "s/(default)$//"); do
module load $module
mpi_compiler_for_dir[${MPI_HOME}]=${MPI_COMPILER}
mpi_compiler_for_dir[${MPI_FORTRAN_MOD_DIR}]=${MPI_COMPILER}
if [ -n "${MPI_PYTHON2_SITEARCH}" ]; then
mpi_compiler_for_dir[${MPI_PYTHON2_SITEARCH}]=${MPI_COMPILER}
elif [ -n "${MPI_PYTHON_SITEARCH}" ]; then
mpi_compiler_for_dir[${MPI_PYTHON_SITEARCH}]=${MPI_COMPILER}
fi
if [ -n "${MPI_PYTHON3_SITEARCH}" ]; then
mpi_compiler_for_dir[${MPI_PYTHON3_SITEARCH}]=${MPI_COMPILER}
fi
module unload $module
done
fi
# Read file list from stdin
filelist=$(sed "s/['\"]/\\\&/g")
# List provides:
if [ -x /usr/lib/rpm/elfdeps -a -n "$filelist" ]; then
for file in $(echo $filelist | tr '[:blank:]' \\n); do
# Get the default provides string from elfdeps
prov=$(echo $file | /usr/lib/rpm/elfdeps --provides $elfdepsargs)
if [ -z "$prov" ]; then
continue
fi
# If the path to the scanned binary starts with a known mpi binary directory,
# append the corresponding ($MPI_COMPILER) to the provides string
for mpi_dir in "${!mpi_compiler_for_dir[@]}"; do
if [[ "$file" == "$buildroot$mpi_dir"* ]]; then
prov="${prov}(${mpi_compiler_for_dir[$mpi_dir]})"
break
fi
done
echo "$prov"
done
fi

102
SOURCES/mpi.req Executable file
View File

@ -0,0 +1,102 @@
#!/bin/bash
# Copyright (c) 2015-2016 Sandro Mani <manisandro@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE
buildroot="$RPM_BUILD_ROOT"
if [ ! -d "$buildroot" ]; then
>&2 echo "Invalid buildroot"
exit 1
fi
# Arguments are passed to elfdeps
elfdepsargs="$@"
# Search for all MPI implementations:
# - Search all modules which start with mpi
# - For each module, store $MPI_DIR -> $MPI_COMPILER and
# $MPI_COMPILER -> $MPI_LIB in assoc. array
declare -A mpi_compiler_for_dir
declare -A mpi_lib_for_compiler
if [ -e /etc/profile.d/modules.sh ]; then
. /etc/profile.d/modules.sh;
# Add moduledirs in buildroot also for cases where an MPI implementation
# package is being built, meaning that its module files are not yet installed
IFS=':' read -ra _MODULEPATH <<< "$MODULEPATH"
for i in "${!_MODULEPATH[@]}"; do
_MODULEPATH[$i]=$buildroot${_MODULEPATH[$i]}
done
export MODULEPATH="$MODULEPATH:$(IFS=:; echo "${_MODULEPATH[*]}")"
for module in $(module -t avail 2>&1 | grep "^mpi/." | sed "s/(default)$//"); do
module load $module
mpi_compiler_for_dir[${MPI_HOME}]=${MPI_COMPILER}
mpi_compiler_for_dir[${MPI_FORTRAN_MOD_DIR}]=${MPI_COMPILER}
if [ -n "${MPI_PYTHON2_SITEARCH}" ]; then
mpi_compiler_for_dir[${MPI_PYTHON2_SITEARCH}]=${MPI_COMPILER}
elif [ -n "${MPI_PYTHON_SITEARCH}" ]; then
mpi_compiler_for_dir[${MPI_PYTHON_SITEARCH}]=${MPI_COMPILER}
fi
if [ -n "${MPI_PYTHON3_SITEARCH}" ]; then
mpi_compiler_for_dir[${MPI_PYTHON3_SITEARCH}]=${MPI_COMPILER}
fi
mpi_lib_for_compiler[${MPI_COMPILER}]=${MPI_LIB}
module unload $module
done
fi
# Read file list from stdin
filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"`
# List requires:
if [ -x /usr/lib/rpm/elfdeps -a -n "$filelist" ]; then
for file in $(echo $filelist | tr '[:blank:]' \\n); do
# Get the default requres string from elfdeps
reqs=$(echo $file | /usr/lib/rpm/elfdeps --requires $elfdepsargs)
# Check whether the scanned binary is inside a know mpi binary dir
mpi_comp=
for mpi_dir in "${!mpi_compiler_for_dir[@]}"; do
if [[ "$file" == "$buildroot$mpi_dir"* ]]; then
mpi_comp="${mpi_compiler_for_dir[$mpi_dir]}"
break
fi
done
# If the scanned binary is inside an mpi dir, for each dependency, check
# whether the library exists in $MPI_LIB, and if yes, append
# ($MPI_COMPILER) to each requires string
if [ ! -z "$mpi_comp" ]; then
mpi_lib=${mpi_lib_for_compiler[$mpi_comp]}
for req in $reqs; do
lib=$(echo $req | grep -Eo '^.*\.so[^(]*')
if [ ! -z "$lib" ] && ( [ -e "$mpi_lib/$lib" ] || [ -e "$buildroot$mpi_lib/$lib" ] ); then
req="${req}($mpi_comp)"
fi
echo "$req"
done
else
echo "$reqs"
fi
done
fi

View File

@ -0,0 +1,6 @@
# Make libfoo.so symlinks require the soname-provide of the target library
%__mpilibsymlink_requires %{_rpmconfigdir}/mpi.prov %{buildroot} --soname-only
%__mpilibsymlink_magic ^symbolic link to .*lib.*\.so\..*$
%__mpilibsymlink_path ^%{_prefix}/lib(64)?/.*\.so$
%__mpilibsymlink_flags magic_and_path
%__libsymlink_exclude_path ^%{_prefix}/lib(64)?/.*$

139
SPECS/rpm-mpi-hooks.spec Normal file
View File

@ -0,0 +1,139 @@
Name: rpm-mpi-hooks
Version: 8
Release: 3%{?dist}
Summary: RPM dependency generator hooks for MPI packages
License: MIT
BuildArch: noarch
Source0: mpi.attr
Source1: mpilibsymlink.attr
Source2: mpi.prov
Source3: mpi.req
Source4: LICENSE
Requires: filesystem
# Instead of adding a BuildRequires to every MPI implementation spec
Requires: environment(modules)
%description
RPM dependency generator hooks for MPI packages. This package should be added
as a BuildRequires to all mpi implementations (i.e. openmpi, mpich) as well as
a Requires to the their -devel packages.
%prep
cp -a %SOURCE4 .
%build
# Nothing to build
%install
install -Dpm 0644 %{SOURCE0} %{buildroot}%{_rpmconfigdir}/fileattrs/mpi.attr
install -Dpm 0644 %{SOURCE1} %{buildroot}%{_rpmconfigdir}/fileattrs/mpilibsymlink.attr
install -Dpm 0755 %{SOURCE2} %{buildroot}%{_rpmconfigdir}/mpi.prov
install -Dpm 0755 %{SOURCE3} %{buildroot}%{_rpmconfigdir}/mpi.req
%files
%license LICENSE
%{_rpmconfigdir}/fileattrs/mpi.attr
%{_rpmconfigdir}/fileattrs/mpilibsymlink.attr
%{_rpmconfigdir}/mpi.req
%{_rpmconfigdir}/mpi.prov
%changelog
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 8-3
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Jul 02 2021 Honggang Li <honli@redhat.com> - 8-2
- Sync with latest Fedora repo
- Resolves: rhbz#1972736
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 7-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Thu Feb 18 2021 Sandro Mani <manisandro@gmail.com> 7-1
- Fix left-over argument shift in mpi.prov and mpi.req (#1930096)
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 6-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 6-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Nov 15 2019 Orion Poplawski <orion@nwra.com> - 6-4
- Allow for no MPI_PYTHON{2}_SITEARCH
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Tue Dec 4 2018 Orion Poplawski <orion@nwra.com> - 6-1
- Avoid trying to load mpi/ directory as a module
- Handle old MPI_PYTHON_SITEARCH and MPI_PYTHON3_SITEARCH conditionally for EL7
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon Apr 17 2017 Orion Poplawski <orion@cora.nwra.com> - 5-1
- Exclude build-id files from symlink requires path (bug #1435690)
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu May 12 2016 Sandro Mani <manisandro@gmail.com> 4-1
- Use RPM_BUILD_ROOT directly instead of passing it as an argument
- Use MPI_PYTHON3_SITEARCH
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Fri Jan 08 2016 Sandro Mani <manisandro@gmail.com> 3-5
- Add quotes around strings which may contain spaces
* Tue Dec 22 2015 Orion Poplawski <orion@cora.nwra.com> - 3-4
- Require environment(modules)
* Mon Nov 2 2015 Orion Poplawski <orion@cora.nwra.com> - 3-3
- Drop requires rpm-build, fileattrs now owned by rpm
* Mon Aug 17 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3-2
- Also handle modules for Python 3
* Mon Aug 10 2015 Sandro Mani <manisandro@gmail.com> 3-1
- Also handle binaries in $MPI_FORTRAN_MOD_DIR and $MPI_PYTHON_SITEARCH
* Sun Jul 26 2015 Sandro Mani <manisandro@gmail.com> 2-1
- Add %%__mpi_magic, %%__mpi_flags to mpi.attrs
- Add mpilibsymlink.attr
* Thu Jul 09 2015 Sandro Mani <manisandro@gmail.com> 1.0-4
- mpi.prov, mpi.req: Use "module -t avail" instead of "module avail"
- mpi.prov, mpi.req: Also look in moduledirs in %%buildroot
- mpi.attrs: add %%__libsymlink_exclude_path
* Thu Jul 09 2015 Sandro Mani <manisandro@gmail.com> 1.0-3
- Add LICENSE
* Thu Jul 09 2015 Sandro Mani <manisandro@gmail.com> 1.0-2
- BuildRequires: rpm -> rpm-build
- Change license to MIT
* Thu Jul 09 2015 Sandro Mani <manisandro@gmail.com> 1.0-1
- Initial package