Blame SPECS/kmod-xt_time.spec

c9360b
%global pkg xt_time
c9360b
e06a6d
%global kernel_version 4.18.0-305.7.1.el8_4
c9360b
c9360b
%global _use_internal_dependency_generator 0
e06a6d
%global __find_requires /usr/lib/rpm/redhat/find-requires
e06a6d
%global __find_provides /usr/lib/rpm/redhat/find-provides
c9360b
c9360b
%global debug_package %{nil}
c9360b
c9360b
%global __spec_install_post \
c9360b
  %{?__debug_package:%{__debug_install_post}} \
c9360b
  %{__arch_install_post} \
c9360b
  %{__os_install_post} \
c9360b
  %{__mod_compress_install_post}
c9360b
c9360b
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
c9360b
c9360b
c9360b
Name:             kmod-%{pkg}
c9360b
Version:          5.9
e06a6d
Release:          5%{?dist}
c9360b
Summary:          Time match support for Netfilter (xt_time)
c9360b
c9360b
License:          GPLv2
c9360b
URL:              https://www.kernel.org/
c9360b
c9360b
Source0:          %{pkg}-%{version}.tar.xz
c9360b
c9360b
ExclusiveArch:    x86_64 aarch64
c9360b
c9360b
BuildRequires:    elfutils-libelf-devel
c9360b
BuildRequires:    gcc
e06a6d
BuildRequires:    kernel-rpm-macros
c9360b
BuildRequires:    kmod
c9360b
BuildRequires:    make
c9360b
BuildRequires:    redhat-rpm-config
c9360b
BuildRequires:    xz
c9360b
e06a6d
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
c9360b
BuildRequires:    kernel-devel = %{kernel_version}
c9360b
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
c9360b
e06a6d
Requires:         kernel >= %{kernel_version}
e06a6d
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
e06a6d
Requires:         kernel-modules >= %{kernel_version}
e06a6d
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
c9360b
c9360b
Provides:         installonlypkg(kernel-module)
e06a6d
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
c9360b
e06a6d
Requires(post):   %{_sbindir}/depmod
e06a6d
Requires(postun): %{_sbindir}/depmod
c9360b
e06a6d
Requires(post):   %{_sbindir}/weak-modules
e06a6d
Requires(postun): %{_sbindir}/weak-modules
c9360b
c9360b
c9360b
%description
c9360b
This package provides the "time" match module for the Network packet filtering
c9360b
framework (Netfilter). It allows you to match based on the packet arrival or
c9360b
departure time.
c9360b
c9360b
c9360b
%prep
c9360b
%autosetup -p1 -n %{pkg}-%{version}
c9360b
c9360b
c9360b
%build
c9360b
pushd src
c9360b
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
c9360b
popd
c9360b
c9360b
c9360b
%install
c9360b
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/net/netfilter src/%{pkg}.ko
c9360b
c9360b
# Make .ko objects temporarily executable for automatic stripping
c9360b
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
c9360b
c9360b
c9360b
%clean
c9360b
%{__rm} -rf %{buildroot}
c9360b
c9360b
c9360b
%post
c9360b
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
e06a6d
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/net/netfilter/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
c9360b
c9360b
c9360b
%preun
c9360b
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
e06a6d
rpm -ql kmod-%{pkg}-%{?epoch:%{epoch}:}%{version}-%{release}.%{_arch} | grep '/lib/modules/%{kernel_version}.%{_arch}/.*\.ko\.xz$' >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
c9360b
c9360b
c9360b
%postun
e06a6d
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
c9360b
then
e06a6d
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
e06a6d
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
c9360b
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
e06a6d
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
c9360b
fi
c9360b
c9360b
e06a6d
%pretrans -p <lua>
e06a6d
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
e06a6d
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
e06a6d
e06a6d
c9360b
%posttrans
e06a6d
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
c9360b
then
e06a6d
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
e06a6d
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
c9360b
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
e06a6d
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
c9360b
fi
c9360b
c9360b
c9360b
%files
c9360b
%defattr(644,root,root,755)
c9360b
/lib/modules/%{kernel_version}.%{_arch}
c9360b
%license COPYING
c9360b
c9360b
c9360b
%changelog
e06a6d
* Tue Sep 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.9-5
e06a6d
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8_4)
e06a6d
5badae
* Wed Sep 15 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.9-4
5badae
- Rebuild for 4.18.0-305.19.1.el8_4
5badae
f23190
* Thu Sep  9 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.9-3
f23190
- Set specific kernel version to use
f23190
- Add Provides kernel-modules
f23190
- Add .%{_arch} to kernel-modules provides version
f23190
- Rebuild for 4.18.0-305.17.1.el8_4
f23190
a259d2
* Tue Aug 17 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.9-2
a259d2
- Rebuild for 4.18.0-305.12.1.el8_4
a259d2
c9360b
* Fri Aug 13 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.9-1
c9360b
- Initial version