Decrease optmem_max preset to 40960
Let the build fail, if the minimum kernel version cannot be met Conditionalize the sysctl.d tweak on version of the kernel Conditionalize the name of README.distro on the distro
This commit is contained in:
parent
e7fc48b9eb
commit
4c1c3c53e3
@ -6,11 +6,28 @@
|
||||
# Do we build the replacements package?
|
||||
%bcond_with replacements
|
||||
|
||||
# This package needs at least Linux Kernel v4.10.0.
|
||||
%global min_kernel_ver 4.10.0
|
||||
|
||||
# Do we need to tweak sysctl.d? In newer versions of the Linux
|
||||
# Kernel the default ancillary buffer size is set high enough.
|
||||
# TODO: Adapt this when the patch for net/core/sock.c is merged.
|
||||
%if %{lua:print(rpm.vercmp('99.0.0', posix.uname('%r')));} >= 0
|
||||
%global with_sysctl_tweak 1
|
||||
%else
|
||||
%global with_sysctl_tweak 0
|
||||
%endif
|
||||
|
||||
%if %{with_sysctl_tweak}
|
||||
# Priority for the sysctl.d preset.
|
||||
%global sysctl_prio 50
|
||||
|
||||
# Value used for the sysctl.d preset.
|
||||
%global sysctl_optmem_max 81920
|
||||
%global sysctl_optmem_max 40960
|
||||
|
||||
# Extension for the README.distro file.
|
||||
%global distroname_ext %{?fedora:fedora}%{?rhel:redhat}
|
||||
%endif
|
||||
|
||||
# Lowest limit to run the testsuite. If we cannot obtain this
|
||||
# value, we asume the testsuite cannot be run.
|
||||
@ -63,7 +80,7 @@
|
||||
|
||||
Name: libkcapi
|
||||
Version: %{vmajor}.%{vminor}.%{vpatch}
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: User space interface to the Linux Kernel Crypto API
|
||||
|
||||
License: BSD or GPLv2
|
||||
@ -91,6 +108,12 @@ BuildRequires: openssl
|
||||
BuildRequires: systemd
|
||||
BuildRequires: xmlto
|
||||
|
||||
# To make sure this is not buildable nor installable if the
|
||||
# available Linux Kernel does not support the Linux Kernel
|
||||
# Crypto API User Space Interface.
|
||||
BuildRequires: kernel-headers >= %{min_kernel_ver}
|
||||
Requires: kernel >= %{min_kernel_ver}
|
||||
|
||||
# For ownership of %%{_sysctldir}.
|
||||
Requires: systemd
|
||||
|
||||
@ -191,7 +214,8 @@ generators implemented in the Linux kernel from command line.
|
||||
%prep
|
||||
%autosetup -p 1
|
||||
|
||||
%{__cat} << EOF > README.fedora
|
||||
%if %{with_sysctl_tweak}
|
||||
%{__cat} << EOF > README.%{distroname_ext}
|
||||
This package increases the default limit of the ancillary buffer size
|
||||
per kernel socket defined in \`net.core.optmem_max\` to %{sysctl_optmem_max} bytes.
|
||||
|
||||
@ -213,7 +237,7 @@ if you need or want to override the preset made by this package.
|
||||
EOF
|
||||
|
||||
%{__cat} << EOF > %{sysctl_prio}-%{name}-optmem_max.conf
|
||||
# See the 'README.fedora' file shipped in %%doc
|
||||
# See the 'README.%{distroname_ext}' file shipped in %%doc
|
||||
# with the %{name} package.
|
||||
#
|
||||
# See '%{_sysctldir}/50-default.conf',
|
||||
@ -222,6 +246,7 @@ EOF
|
||||
# Increase the ancillary buffer size per socket.
|
||||
net.core.optmem_max = %{sysctl_optmem_max}
|
||||
EOF
|
||||
%endif
|
||||
|
||||
%{_bindir}/autoreconf -fiv
|
||||
|
||||
@ -246,13 +271,17 @@ EOF
|
||||
%make_install
|
||||
|
||||
# Install sysctl.d preset.
|
||||
%{__mkdir_p} %{buildroot}%{_sysctldir}
|
||||
%{__install} -Dpm 0644 -t %{buildroot}%{_sysctldir} \
|
||||
%{sysctl_prio}-%{name}-optmem_max.conf
|
||||
|
||||
# Install into proper location for inclusion by %%doc.
|
||||
%{__mkdir_p} %{buildroot}%{_pkgdocdir}
|
||||
%{__install} -Dpm 0644 -t %{buildroot}%{_pkgdocdir} \
|
||||
README.fedora README.md CHANGES TODO \
|
||||
doc/%{name}.p{df,s}
|
||||
%if %{with_sysctl_tweak}
|
||||
README.%{distroname_ext} \
|
||||
%endif
|
||||
README.md CHANGES TODO doc/%{name}.p{df,s}
|
||||
%{__cp} -pr lib/doc/html %{buildroot}%{_pkgdocdir}
|
||||
|
||||
%if !%{with replacements}
|
||||
@ -312,14 +341,16 @@ popd
|
||||
|
||||
%files
|
||||
%doc %dir %{_pkgdocdir}
|
||||
%doc %{_pkgdocdir}/README.fedora
|
||||
%doc %{_pkgdocdir}/README.md
|
||||
%license COPYING*
|
||||
/%{_lib}/%{name}.so.%{vmajor}
|
||||
/%{_lib}/%{name}.so.%{version}
|
||||
/%{_lib}/.%{name}.so.%{vmajor}.hmac
|
||||
/%{_lib}/.%{name}.so.%{version}.hmac
|
||||
%if %{with_sysctl_tweak}
|
||||
%doc %{_pkgdocdir}/README.%{distroname_ext}
|
||||
%{_sysctldir}/%{sysctl_prio}-%{name}-optmem_max.conf
|
||||
%endif
|
||||
|
||||
|
||||
%files devel
|
||||
@ -383,6 +414,12 @@ popd
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Jan 17 2018 Björn Esser <besser82@fedoraproject.org> - 1.0.3-2
|
||||
- Decrease optmem_max preset to 40960
|
||||
- Let the build fail, if the minimum kernel version cannot be met
|
||||
- Conditionalize the sysctl.d tweak on version of the kernel
|
||||
- Conditionalize the name of README.distro on the distro
|
||||
|
||||
* Tue Jan 16 2018 Björn Esser <besser82@fedoraproject.org> - 1.0.3-1
|
||||
- Initial import (rhbz#1533929)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user