Accepting request 1066744 from science

- Make sure pre-existing (arch-independent) update-alternatives
  are wiped before registering new ones.
  Since update-alternatives has no reliable way to check if
  a certain 'generic name' exists, brute-force it and ignore
  any error (boo#1208248).
- Remove totally pointless - ie. never executed - %%posttrans
  script.
- Restore generic link for update-alternatives. This is usually
  set by the update-alternatives and it is '%ghost'ed but rpmlint
  complains.
- Add rpmlintrc rules to avoid false positives from consistently
  guessing the update-alternatives generic name wrong.
- Make arch dependent generic names conditional.

OBS-URL: https://build.opensuse.org/request/show/1066744
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/openblas?expand=0&rev=55
This commit is contained in:
Dominique Leuenberger 2023-02-21 14:35:32 +00:00 committed by Git OBS Bridge
commit 52502ae780
3 changed files with 42 additions and 23 deletions

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Tue Feb 14 18:14:06 UTC 2023 - Egbert Eich <eich@suse.com>
- Make sure pre-existing (arch-independent) update-alternatives
are wiped before registering new ones.
Since update-alternatives has no reliable way to check if
a certain 'generic name' exists, brute-force it and ignore
any error (boo#1208248).
- Remove totally pointless - ie. never executed - %%posttrans
script.
- Restore generic link for update-alternatives. This is usually
set by the update-alternatives and it is '%ghost'ed but rpmlint
complains.
- Add rpmlintrc rules to avoid false positives from consistently
guessing the update-alternatives generic name wrong.
- Make arch dependent generic names conditional.
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Feb 3 07:52:04 UTC 2023 - Egbert Eich <eich@suse.com> Fri Feb 3 07:52:04 UTC 2023 - Egbert Eich <eich@suse.com>

3
openblas.rpmlintrc Normal file
View File

@ -0,0 +1,3 @@
# rpmlint get update-alternatives generic names wrong consistently
addFilter(".* alternative-link-missing.*")
addFilter(".* alternative-generic-name-missing .*\$\{lib\}.*")

View File

@ -25,6 +25,10 @@
%bcond_with ringdisabled %bcond_with ringdisabled
%if 0%{?suse_version} > 1500
%define a_x _%{_arch}
%endif
%if "%flavor" == "" %if "%flavor" == ""
%define package_name %{pname} %define package_name %{pname}
ExclusiveArch: do_not_build ExclusiveArch: do_not_build
@ -186,6 +190,7 @@ URL: http://www.openblas.net
Source0: https://github.com/xianyi/OpenBLAS/archive/v%{version}.tar.gz#/OpenBLAS-%{version}.tar.gz Source0: https://github.com/xianyi/OpenBLAS/archive/v%{version}.tar.gz#/OpenBLAS-%{version}.tar.gz
Source1: README.SUSE Source1: README.SUSE
Source2: README.HPC.SUSE Source2: README.HPC.SUSE
Source3: openblas.rpmlintrc
Patch1: Use-blasint-for-INTERFACE64-compatibility.patch Patch1: Use-blasint-for-INTERFACE64-compatibility.patch
Patch2: remove-spurious-loops.patch Patch2: remove-spurious-loops.patch
Patch101: Link-library-with-z-noexecstack.patch Patch101: Link-library-with-z-noexecstack.patch
@ -451,12 +456,15 @@ find -name \*.f -exec chmod 644 {} +
# /usr/lib64/libopenblas.so -> libopenblas.so.<so_v> # /usr/lib64/libopenblas.so -> libopenblas.so.<so_v>
install -d %{buildroot}/%{_sysconfdir}/alternatives install -d %{buildroot}/%{_sysconfdir}/alternatives
for link in openblas-default libblas.so.3 liblapack.so.3 libcblas.so.3 liblapacke.so.3; do
ln -s %{_sysconfdir}/alternatives/${link}%{?a_x} %{buildroot}/%{_libdir}/${link}
done
%if 0%{?build_devel} %if 0%{?build_devel}
install -d %{buildroot}%{_libdir}/pkgconfig/ install -d %{buildroot}%{_libdir}/pkgconfig/
ln -s %{_sysconfdir}/alternatives/openblas-default_%{_arch}/pkgconfig/openblas.pc %{buildroot}%{_libdir}/pkgconfig/ ln -s %{_sysconfdir}/alternatives/openblas-default%{?a_x}/pkgconfig/openblas.pc %{buildroot}%{_libdir}/pkgconfig/
install -d %{buildroot}/%{_libdir}/cmake install -d %{buildroot}/%{_libdir}/cmake
ln -s %{_sysconfdir}/alternatives/openblas-default_%{_arch}/cmake/openblas %{buildroot}/%{_libdir}/cmake/ ln -s %{_sysconfdir}/alternatives/openblas-default%{?a_x}/cmake/openblas %{buildroot}/%{_libdir}/cmake/
%endif %endif
%else # with hpc %else # with hpc
@ -513,13 +521,16 @@ d=%{_libdir}/cmake/openblas
&& { n=$(mktemp -d $(dirname $d)/tmpd-XXXXX); mv $d $n; rm -rf $n; } || true && { n=$(mktemp -d $(dirname $d)/tmpd-XXXXX); mv $d $n; rm -rf $n; } || true
%post -n lib%{name}%{so_v} %post -n lib%{name}%{so_v}
# There's no way to determine if a setting exists, so just remove it and ignore errors
%{?a_x:%{_sbindir}/update-alternatives --remove-all openblas-default 2>/dev/null || true}
%{_sbindir}/update-alternatives --install \ %{_sbindir}/update-alternatives --install \
%{_libdir}/openblas-default openblas-default_%{_arch} %{p_libdir} %openblas_so_prio %{_libdir}/openblas-default openblas-default%{?a_x} %{p_libdir} %openblas_so_prio
# Cannot package this link - brp-25-symlink doesn't recognize links created by update-alternatives # Cannot package this link - brp-25-symlink doesn't recognize links created by update-alternatives
ln -sf openblas-default/lib%{pname}.so.%{so_v} %{_libdir}/lib%{pname}.so.%{so_v} ln -sf openblas-default/lib%{pname}.so.%{so_v} %{_libdir}/lib%{pname}.so.%{so_v}
for lib in libblas.so.3 libcblas.so.3 liblapack.so.3 liblapacke.so.3; do for lib in libblas.so.3 libcblas.so.3 liblapack.so.3 liblapacke.so.3; do
%{?a_x:%{_sbindir}/update-alternatives --remove-all ${lib} 2>/dev/null || true}
%{_sbindir}/update-alternatives --install \ %{_sbindir}/update-alternatives --install \
%{_libdir}/${lib} ${lib}_%{_arch} %{p_libdir}/lib%{pname}.so.%{so_v} 20 %{_libdir}/${lib} ${lib}%{?a_x} %{p_libdir}/lib%{pname}.so.%{so_v} 20
done done
/sbin/ldconfig /sbin/ldconfig
@ -529,26 +540,14 @@ ln -sf lib%{pname}.so.%{so_v} %{_libdir}/lib%{pname}.so
%postun -n lib%{name}%{so_v} %postun -n lib%{name}%{so_v}
if [ ! -f %{p_libdir}/lib%{pname}.so.%{so_v} ]; then if [ ! -f %{p_libdir}/lib%{pname}.so.%{so_v} ]; then
for lib in libblas.so.3 libcblas.so.3 liblapack.so.3 liblapacke.so.3; do for lib in libblas.so.3 libcblas.so.3 liblapack.so.3 liblapacke.so.3; do
%{_sbindir}/update-alternatives --remove ${lib}_%{_arch} %{_libdir}/lib%{pname}.so.%{so_v} %{_sbindir}/update-alternatives --remove ${lib}%{?a_x} %{_libdir}/lib%{pname}.so.%{so_v}
done done
fi fi
if [ ! -d %{p_libdir} ]; then if [ ! -d %{p_libdir} ]; then
%{_sbindir}/update-alternatives --remove openblas-default_%{_arch} %{p_libdir} %{_sbindir}/update-alternatives --remove openblas-default%{?a_x} %{p_libdir}
fi fi
/sbin/ldconfig /sbin/ldconfig
%posttrans -n lib%{name}%{so_v}
if [ "$1" = 0 ] ; then
if [ ! -d %{_libdir}/openblas-default ] ; then
%{_sbindir}/update-alternatives --auto openblas-default
fi
for lib in libblas.so.3 libcblas.so.3 liblapack.so.3 liblapacke.so.3; do
if ! [ -f %{_libdir}/${lib} ] ; then
%{_sbindir}/update-alternatives --auto ${lib}
fi
done
fi
%else %else
%postun -n lib%{name} %postun -n lib%{name}
@ -568,11 +567,11 @@ fi
%ghost %{_libdir}/libcblas.so.3 %ghost %{_libdir}/libcblas.so.3
%ghost %{_libdir}/liblapack.so.3 %ghost %{_libdir}/liblapack.so.3
%ghost %{_libdir}/liblapacke.so.3 %ghost %{_libdir}/liblapacke.so.3
%ghost %{_sysconfdir}/alternatives/openblas-default_%{_arch} %ghost %{_sysconfdir}/alternatives/openblas-default%{?a_x}
%ghost %{_sysconfdir}/alternatives/libblas.so.3_%{_arch} %ghost %{_sysconfdir}/alternatives/libblas.so.3%{?a_x}
%ghost %{_sysconfdir}/alternatives/libcblas.so.3_%{_arch} %ghost %{_sysconfdir}/alternatives/libcblas.so.3%{?a_x}
%ghost %{_sysconfdir}/alternatives/liblapack.so.3_%{_arch} %ghost %{_sysconfdir}/alternatives/liblapack.so.3%{?a_x}
%ghost %{_sysconfdir}/alternatives/liblapacke.so.3_%{_arch} %ghost %{_sysconfdir}/alternatives/liblapacke.so.3%{?a_x}
%else %else
%hpc_dirs %hpc_dirs
%{p_libdir}/libopenblas*r*.so %{p_libdir}/libopenblas*r*.so