Split up the replacements subpackage

It is better to have a separate subpackage for each replaced tool.
This commit is contained in:
Ondrej Mosnáček 2018-03-08 15:19:25 +01:00
parent a446d71c1f
commit 7bd35c594d

View File

@ -3,8 +3,16 @@
%global vminor 0
%global vpatch 3
# Do we build the replacements package?
%bcond_with replacements
# Do we build the replacements packages?
%bcond_with replace_coreutils
%bcond_with replace_fipscheck
%bcond_with replace_hmaccalc
%if %{with replace_coreutils} || %{with replace_fipscheck} || %{with replace_hmaccalc}
%global need_hasher 1
%else
%global need_hasher 0
%endif
# This package needs at least Linux Kernel v4.10.0.
%global min_kernel_ver 4.10.0
@ -37,30 +45,21 @@
%global giturl https://github.com/smuellerDD/%{name}
# Do we replace some coreutils?
%if %{with replacements}
%bcond_with replace_coreutils
%if %{with replace_coreutils}
# TODO: Adapt this when replacing some coreutils initially.
%global coreutils_evr 8.29-1
%endif
%global coreutils_evr 8.29-1%{?dist}
%endif
# Do we replace fipscheck?
%if %{with replacements}
%bcond_with replace_fipscheck
%if %{with replace_fipscheck}
# TODO: Adapt this when replacing fipscheck initially.
%global fipscheck_evr 1.5.0-3
%endif
%global fipscheck_evr 1.5.0-3%{?dist}
%endif
# Do we replace hmaccalc?
%if %{with replacements}
%bcond_with replace_hmaccalc
%if %{with replace_hmaccalc}
# TODO: Adapt this when replacing hmaccalc initially.
%global hmaccalc_evr 0.9.14-8
%endif
%global hmaccalc_evr 0.9.14-10%{?dist}
%endif
# Add generation of HMAC checksums of the final stripped
@ -80,7 +79,7 @@
Name: libkcapi
Version: %{vmajor}.%{vminor}.%{vpatch}
Release: 8%{?dist}
Release: 9%{?dist}
Summary: User space interface to the Linux Kernel Crypto API
License: BSD or GPLv2
@ -154,42 +153,58 @@ BuildArch: noarch
User documentation for %{name}.
%if %{with replacements}
%package replacements
Summary: Drop-in replacements provided by the %{name} package
%if %{need_hasher}
%package hasher
Summary: Common utility for replacement packages
Requires: %{name}%{?_isa} == %{version}-%{release}
%description hasher
Provides a common binary used by the drop-in %{name} replacements for hashing/HMAC tools.
%endif
%if %{with replace_coreutils}
Requires: coreutils%{?_isa} >= %{coreutils_evr}
%package checksum
Summary: Drop-in replacement for *sum utils provided by the %{name} package
Requires: %{name}-hasher%{?_isa} == %{version}-%{release}
Requires: coreutils%{?_isa} >= %{coreutils_evr}
Conflicts: coreutils < %{coreutils_evr}
Conflicts: coreutils-single
%description checksum
Provides drop-in replacements for sha*sum tools (from package coreutils) using %{name}.
%endif
%if %{with replace_fipscheck}
%package fipscheck
Summary: Drop-in replacements for fipscheck/fipshmac provided by the %{name} package
Requires: %{name}-hasher%{?_isa} == %{version}-%{release}
Obsoletes: fipscheck <= %{fipscheck_evr}
Provides: fipscheck == %{fipscheck_evr}.1
Provides: fipscheck%{?_isa} == %{fipscheck_evr}.1
%description fipscheck
Provides drop-in replacements for fipscheck and fipshmac tools (from package fipscheck)
using %{name}.
%endif
%if %{with replace_hmaccalc}
%package hmaccalc
Summary: Drop-in replacements for hmaccalc provided by the %{name} package
Requires: %{name}-hasher%{?_isa} == %{version}-%{release}
Obsoletes: hmaccalc <= %{hmaccalc_evr}
Provides: hmaccalc == %{hmaccalc_evr}.1
Provides: hmaccalc%{?_isa} == %{hmaccalc_evr}.1
%endif
%description replacements
Provides drop-in replacements for
%if %{with replace_fipscheck}
* fipscheck and fipshmac (fipscheck)
%endif
%if %{with replace_hmaccalc}
* sha*hmac (hmaccalc)
%endif
%if %{with replace_coreutils}
* sha*sum (coreutils)
%endif
tools using %{name}.
%description hmaccalc
Provides drop-in replacements for sha*hmac tools (from package hmaccalc) using %{name}.
%endif
@ -286,15 +301,24 @@ EOF
README.md CHANGES TODO doc/%{name}.p{df,s}
%{__cp} -pr lib/doc/html %{buildroot}%{_pkgdocdir}
%if !%{with replacements}
%if !%{need_hasher}
%{__rm} -f %{buildroot}%{_bindir}/kcapi-hasher
%endif
%if !%{with replace_coreutils}
%{__rm} -f \
%{buildroot}%{_bindir}/fips* \
%{buildroot}%{_bindir}/kcapi-hasher \
%{buildroot}%{_bindir}/md5sum \
%{buildroot}%{_bindir}/sha*hmac \
%{buildroot}%{_bindir}/sha*sum
%endif
%if !%{with replace_fipscheck}
%{__rm} -f %{buildroot}%{_bindir}/fips*
%endif
%if !%{with replace_hmaccalc}
%{__rm} -f %{buildroot}%{_bindir}/sha*hmac
%endif
# We don't ship autocrap dumplings.
%{_bindir}/find %{buildroot} -type f -name '*.la' -print -delete
@ -366,35 +390,30 @@ popd
%license %{_datadir}/licenses/%{name}*
%if %{with replacements}
%files replacements
%if %{need_hasher}
%files hasher
%{_bindir}/kcapi-hasher
%{_bindir}/.kcapi-hasher.hmac
%endif
%if %{with replace_coreutils}
%files checksum
%{_bindir}/md5sum
%{_bindir}/.md5sum.hmac
%{_bindir}/sha*sum
%{_bindir}/.sha*sum.hmac
%else
%exclude %{_bindir}/md5sum
%exclude %{_bindir}/.md5sum.hmac
%exclude %{_bindir}/sha*sum
%exclude %{_bindir}/.sha*sum.hmac
%endif
%if %{with replace_fipscheck}
%files fipscheck
%{_bindir}/fips*
%{_bindir}/.fips*.hmac
%else
%exclude %{_bindir}/fips*
%exclude %{_bindir}/.fips*.hmac
%endif
%if %{with replace_hmaccalc}
%files hmaccalc
%{_bindir}/sha*hmac
%{_bindir}/.sha*hmac.hmac
%else
%exclude %{_bindir}/sha*hmac
%exclude %{_bindir}/.sha*hmac.hmac
%endif
%endif
@ -403,7 +422,7 @@ popd
%files tools
%if %{with replacements}
%if %{need_hasher}
%exclude %{_bindir}/kcapi-hasher
%exclude %{_bindir}/.kcapi-hasher.hmac
%endif
@ -413,6 +432,9 @@ popd
%changelog
* Thu Mar 08 2018 Ondrej Mosnáček <omosnace@redhat.com> - 1.0.3-9
- Split up the replacements subpackage
* Mon Feb 26 2018 Björn Esser <besser82@fedoraproject.org> - 1.0.3-8
- Increase optmem_max preset to 81920