Also handle binaries in and

This commit is contained in:
Sandro Mani 2015-08-10 19:18:57 +02:00
parent 6cb8095222
commit 5ad6adedec
5 changed files with 28 additions and 21 deletions

View File

@ -1,7 +1,6 @@
%__mpi_provides %{_rpmconfigdir}/mpi.prov %{buildroot} %{?__filter_GLIBC_PRIVATE:--filter-private}
%__mpi_requires %{_rpmconfigdir}/mpi.req %{buildroot} %{?__filter_GLIBC_PRIVATE:--filter-private}
%__mpi_path ^%{_prefix}/lib(64)?/(openmpi|mpich)/.*$
%__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)?/(openmpi|mpich)/.*$
%__libsymlink_exclude_path ^%{_prefix}/lib(64)?/(openmpi|mpich)/.*$
%__elf_exclude_path ^%{_prefix}/lib(64)?/.*$

View File

@ -34,8 +34,8 @@ elfdepsargs="$@"
# Search for all MPI implementations:
# - Search all modules which start with mpi
# - For each module, store $MPI_HOME -> $MPI_COMPILER in assoc. array
declare -A mpi_compier_for_home
# - For each module, store $MPI_DIR -> $MPI_COMPILER in assoc. array
declare -A mpi_compier_for_dir
if [ -e /etc/profile.d/modules.sh ]; then
. /etc/profile.d/modules.sh;
@ -49,7 +49,9 @@ if [ -e /etc/profile.d/modules.sh ]; then
for module in $(module -t avail 2>&1 | grep "^mpi/"); do
module load $module
mpi_compier_for_home[${MPI_HOME}]=${MPI_COMPILER}
mpi_compier_for_dir[${MPI_HOME}]=${MPI_COMPILER}
mpi_compier_for_dir[${MPI_FORTRAN_MOD_DIR}]=${MPI_COMPILER}
mpi_compier_for_dir[${MPI_PYTHON_SITEARCH}]=${MPI_COMPILER}
module unload $module
done
fi
@ -67,11 +69,11 @@ if [ -x /usr/lib/rpm/elfdeps -a -n "$filelist" ]; then
continue
fi
# If the path to the scanned binary starts with an $MPI_HOME, append the
# corresponding ($MPI_COMPILER) to the provides string
for mpi_home in "${!mpi_compier_for_home[@]}"; do
if [[ "$file" == "$buildroot$mpi_home"* ]]; then
prov="${prov}(${mpi_compier_for_home[$mpi_home]})"
# 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_compier_for_dir[@]}"; do
if [[ "$file" == "$buildroot$mpi_dir"* ]]; then
prov="${prov}(${mpi_compier_for_dir[$mpi_dir]})"
break
fi
done

18
mpi.req
View File

@ -34,9 +34,9 @@ elfdepsargs="$@"
# Search for all MPI implementations:
# - Search all modules which start with mpi
# - For each module, store $MPI_HOME -> $MPI_COMPILER and
# - For each module, store $MPI_DIR -> $MPI_COMPILER and
# $MPI_COMPILER -> $MPI_LIB in assoc. array
declare -A mpi_compier_for_home
declare -A mpi_compier_for_dir
declare -A mpi_lib_for_compiler
if [ -e /etc/profile.d/modules.sh ]; then
. /etc/profile.d/modules.sh;
@ -51,7 +51,9 @@ if [ -e /etc/profile.d/modules.sh ]; then
for module in $(module -t avail 2>&1 | grep "^mpi/"); do
module load $module
mpi_compier_for_home[${MPI_HOME}]=${MPI_COMPILER}
mpi_compier_for_dir[${MPI_HOME}]=${MPI_COMPILER}
mpi_compier_for_dir[${MPI_FORTRAN_MOD_DIR}]=${MPI_COMPILER}
mpi_compier_for_dir[${MPI_PYTHON_SITEARCH}]=${MPI_COMPILER}
mpi_lib_for_compiler[${MPI_COMPILER}]=${MPI_LIB}
module unload $module
done
@ -67,16 +69,16 @@ if [ -x /usr/lib/rpm/elfdeps -a -n "$filelist" ]; then
# Get the default requres string from elfdeps
reqs=$(echo $file | /usr/lib/rpm/elfdeps --requires $elfdepsargs)
# Check whether the scanned binary is inside an $MPI_HOME dir
# Check whether the scanned binary is inside a know mpi binary dir
mpi_comp=
for mpi_home in "${!mpi_compier_for_home[@]}"; do
if [[ "$file" == "$buildroot$mpi_home"* ]]; then
mpi_comp="${mpi_compier_for_home[$mpi_home]}"
for mpi_dir in "${!mpi_compier_for_dir[@]}"; do
if [[ "$file" == "$buildroot$mpi_dir"* ]]; then
mpi_comp="${mpi_compier_for_dir[$mpi_dir]}"
break
fi
done
# If the scanned binary is inside an $MPI_HOME, for each dependency, check
# 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

View File

@ -1,5 +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)?/(openmpi|mpich)/.*\.so$
%__mpilibsymlink_path ^%{_prefix}/lib(64)?/.*$
%__mpilibsymlink_flags magic_and_path
%__libsymlink_exclude_path ^%{_prefix}/lib(64)?/.*$

View File

@ -1,5 +1,5 @@
Name: rpm-mpi-hooks
Version: 2
Version: 3
Release: 1%{?dist}
Summary: RPM dependency generator hooks for MPI packages
@ -47,6 +47,9 @@ install -Dpm 0755 %{SOURCE3} %{buildroot}%{_rpmconfigdir}/mpi.req
%changelog
* 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