Add an option to disable the compat-package for future use

This commit is contained in:
Björn Esser 2019-01-14 19:29:09 +01:00
parent b369d8179a
commit d05cf0559e
No known key found for this signature in database
GPG Key ID: F52E98007594C21D

View File

@ -5,6 +5,12 @@
%bcond_with new_api %bcond_with new_api
%endif %endif
# Build the compat package?
%if 0%{?fedora} >= 999 || 0%{?rhel} >= 99
%bcond_with compat_pkg
%else
%bcond_without compat_pkg
%endif
# Run memcheck? # Run memcheck?
# Valgrind does not work well on %%{power64} arches. # Valgrind does not work well on %%{power64} arches.
@ -21,10 +27,12 @@
%global sol 0 %global sol 0
%global sof 0 %global sof 0
%global sov %{soc}.%{sol}.%{sof} %global sov %{soc}.%{sol}.%{sof}
%if %{with compat_pkg}
%global csoc 1 %global csoc 1
%global csol 1 %global csol 1
%global csof 0 %global csof 0
%global csov %{csoc}.%{csol}.%{csof} %global csov %{csoc}.%{csol}.%{csof}
%endif
%else %else
%global soc 1 %global soc 1
%global sol 1 %global sol 1
@ -38,8 +46,10 @@
%if %{with new_api} %if %{with new_api}
%global hash_methods fedora,glibc,strong %global hash_methods fedora,glibc,strong
%global obsolete_api no %global obsolete_api no
%if %{with compat_pkg}
%global compat_methods glibc %global compat_methods glibc
%global compat_api glibc %global compat_api glibc
%endif
%else %else
%global hash_methods all %global hash_methods all
%global obsolete_api glibc %global obsolete_api glibc
@ -90,7 +100,7 @@
%{_bindir}/fipshmac %{buildroot}/%{_lib}/libcrypt.so.%{sov} \ %{_bindir}/fipshmac %{buildroot}/%{_lib}/libcrypt.so.%{sov} \
%{__ln_s} .libcrypt.so.%{sov}.hmac \\\ %{__ln_s} .libcrypt.so.%{sov}.hmac \\\
%{buildroot}/%{_lib}/.libcrypt.so.%{soc}.hmac \ %{buildroot}/%{_lib}/.libcrypt.so.%{soc}.hmac \
if [[ %{with new_api} == 1 ]]; then \ if [[ %{with new_api} == 1 && %{with compat_pkg} == 1 ]]; then \
%{_bindir}/fipshmac %{buildroot}/%{_lib}/libcrypt.so.%{csov} \ %{_bindir}/fipshmac %{buildroot}/%{_lib}/libcrypt.so.%{csov} \
%{__ln_s} .libcrypt.so.%{csov}.hmac \\\ %{__ln_s} .libcrypt.so.%{csov}.hmac \\\
%{buildroot}/%{_lib}/.libcrypt.so.%{csoc}.hmac \ %{buildroot}/%{_lib}/.libcrypt.so.%{csoc}.hmac \
@ -173,7 +183,7 @@ that have been provided by glibc's libcrypt.so.1.
%endif %endif
%if %{with new_api} %if %{with new_api} && %{with compat_pkg}
%package compat %package compat
Summary: Compatibility library providing legacy API functions Summary: Compatibility library providing legacy API functions
@ -228,6 +238,7 @@ This version of the %{name} package ships the libcrypt.so2
library and does not provide the legacy API functions that have library and does not provide the legacy API functions that have
been provided by glibc's libcrypt.so.1. The removed functions been provided by glibc's libcrypt.so.1. The removed functions
by name are encrypt, encrypt_r, setkey, setkey_r, and fcrypt. by name are encrypt, encrypt_r, setkey, setkey_r, and fcrypt.
%if %{with compat_pkg}
If you are using a third-party application that links against If you are using a third-party application that links against
those functions, or that is linked against glibc's libcrypt, those functions, or that is linked against glibc's libcrypt,
@ -236,6 +247,7 @@ you may need to install the %{name}-compat package manually.
All existing binary executables linked against glibc's libcrypt All existing binary executables linked against glibc's libcrypt
should work unmodified with the libcrypt.so.1 library supplied should work unmodified with the libcrypt.so.1 library supplied
by the %{name}-compat package. by the %{name}-compat package.
%endif
EOF EOF
%endif %endif
%{__mkdir_p} %{_vpath_builddir}{,-compat} %{__mkdir_p} %{_vpath_builddir}{,-compat}
@ -251,7 +263,7 @@ pushd %{_vpath_builddir}
%make_build %make_build
popd popd
%if %{with new_api} %if %{with new_api} && %{with compat_pkg}
# Build the compatibility library. # Build the compatibility library.
pushd %{_vpath_builddir}-compat pushd %{_vpath_builddir}-compat
%configure \ %configure \
@ -264,7 +276,7 @@ popd
%install %install
%if %{with new_api} %if %{with new_api} && %{with compat_pkg}
# Install the compatibility library. # Install the compatibility library.
%make_install -C %{_vpath_builddir}-compat %make_install -C %{_vpath_builddir}-compat
@ -295,7 +307,7 @@ fi
%check %check
%if %{with new_api} %if %{with new_api} && %{with compat_pkg}
for dir in %{_vpath_builddir} %{_vpath_builddir}-compat; do for dir in %{_vpath_builddir} %{_vpath_builddir}-compat; do
%else %else
for dir in %{_vpath_builddir}; do for dir in %{_vpath_builddir}; do
@ -322,7 +334,7 @@ done
%ldconfig_scriptlets %ldconfig_scriptlets
%if %{with new_api} %if %{with new_api} && %{with compat_pkg}
%ldconfig_scriptlets compat %ldconfig_scriptlets compat
%endif %endif
@ -338,7 +350,7 @@ done
%{_mandir}/man5/crypt.5.* %{_mandir}/man5/crypt.5.*
%if %{with new_api} %if %{with new_api} && %{with compat_pkg}
%files compat %files compat
/%{_lib}/.libcrypt.so.{%{csoc},%{csov}}.hmac /%{_lib}/.libcrypt.so.{%{csoc},%{csov}}.hmac
/%{_lib}/libcrypt.so.{%{csoc},%{csov}} /%{_lib}/libcrypt.so.{%{csoc},%{csov}}
@ -365,6 +377,7 @@ done
%changelog %changelog
* Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 4.4.2-5 * Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 4.4.2-5
- Build the compat package with glibc hashing methods only - Build the compat package with glibc hashing methods only
- Add an option to disable the compat-package for future use
* Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 4.4.2-4 * Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 4.4.2-4
- Bump SO-name for Fedora >= 30 and enable compat package (#1666033) - Bump SO-name for Fedora >= 30 and enable compat package (#1666033)