import rpm-mpi-hooks-5-4.el8
This commit is contained in:
commit
0e8f00c1e9
0
.gitignore
vendored
Normal file
0
.gitignore
vendored
Normal file
0
.rpm-mpi-hooks.metadata
Normal file
0
.rpm-mpi-hooks.metadata
Normal file
19
SOURCES/LICENSE
Normal file
19
SOURCES/LICENSE
Normal 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
6
SOURCES/mpi.attr
Normal 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)?/.*$
|
97
SOURCES/mpi.prov
Executable file
97
SOURCES/mpi.prov
Executable file
@ -0,0 +1,97 @@
|
||||
#!/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
|
||||
|
||||
# Remaining arguments are passed to elfdeps
|
||||
shift
|
||||
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/"); do
|
||||
module load $module
|
||||
if [ -z "${MPI_COMPILER}" ]; then
|
||||
>&2 echo "Invalid module file, no MPI_COMPILER defined"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${MPI_HOME}" ]; then
|
||||
>&2 echo "Invalid module file, no MPI_HOME defined"
|
||||
exit 1
|
||||
fi
|
||||
mpi_compiler_for_dir[${MPI_HOME}]=${MPI_COMPILER}
|
||||
if [ ! -z "${MPI_FORTRAN_MOD_DIR}" ]; then
|
||||
mpi_compiler_for_dir[${MPI_FORTRAN_MOD_DIR}]=${MPI_COMPILER}
|
||||
fi
|
||||
if [ ! -z "${MPI_PYTHON2_SITEARCH}" ]; then
|
||||
mpi_compiler_for_dir[${MPI_PYTHON2_SITEARCH}]=${MPI_COMPILER}
|
||||
fi
|
||||
if [ ! -z "${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
|
115
SOURCES/mpi.req
Executable file
115
SOURCES/mpi.req
Executable file
@ -0,0 +1,115 @@
|
||||
#!/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
|
||||
|
||||
# Remaining arguments are passed to elfdeps
|
||||
shift
|
||||
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/"); do
|
||||
module load $module
|
||||
if [ -z "${MPI_COMPILER}" ]; then
|
||||
>&2 echo "Invalid module file, no MPI_COMPILER defined"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${MPI_HOME}" ]; then
|
||||
>&2 echo "Invalid module file, no MPI_HOME defined"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${MPI_LIB}" ]; then
|
||||
>&2 echo "Invalid module file, no MPI_LIB defined"
|
||||
exit 1
|
||||
fi
|
||||
mpi_compiler_for_dir[${MPI_HOME}]=${MPI_COMPILER}
|
||||
mpi_lib_for_compiler[${MPI_COMPILER}]=${MPI_LIB}
|
||||
if [ ! -z "${MPI_FORTRAN_MOD_DIR}" ]; then
|
||||
mpi_compiler_for_dir[${MPI_FORTRAN_MOD_DIR}]=${MPI_COMPILER}
|
||||
fi
|
||||
if [ ! -z "${MPI_PYTHON2_SITEARCH}" ]; then
|
||||
mpi_compiler_for_dir[${MPI_PYTHON2_SITEARCH}]=${MPI_COMPILER}
|
||||
fi
|
||||
if [ ! -z "${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 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
|
6
SOURCES/mpilibsymlink.attr
Normal file
6
SOURCES/mpilibsymlink.attr
Normal 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)?/.*$
|
105
SPECS/rpm-mpi-hooks.spec
Normal file
105
SPECS/rpm-mpi-hooks.spec
Normal file
@ -0,0 +1,105 @@
|
||||
Name: rpm-mpi-hooks
|
||||
Version: 5
|
||||
Release: 4%{?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
|
||||
* Thu Sep 13 2018 Jarod Wilson <jarod@redhat.com> - 5-4
|
||||
- Make hooks more resilient to missing info
|
||||
- Error out with a useful message when necessary info isn't there
|
||||
- Resolves: rhbz#1627122
|
||||
|
||||
* 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
|
Loading…
Reference in New Issue
Block a user