Blame SPECS/kmod-xt_time.spec

c9360b
%global pkg xt_time
c9360b
Kmods SIG 0e2548
%global driver_version 4.18.0-240.el8
Kmods SIG 0e2548
Kmods SIG 0e2548
%global kernel_version 4.18.0-348.el8
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}
Kmods SIG 0e2548
Version:          4.18.0.240
f623e5
Release:          3%{?dist}
c9360b
Summary:          Time match support for Netfilter (xt_time)
c9360b
c9360b
License:          GPLv2
c9360b
URL:              https://www.kernel.org/
c9360b
Kmods SIG 0e2548
Source0:          %{pkg}-%{driver_version}.tar.xz
Kmods SIG 0e2548
Patch1:           0001-netfilter-xt_time-use-time64_t.patch
c9360b
f12329
ExclusiveArch:    x86_64 aarch64 ppc64le
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
f623e5
%if "%{version}" == "4.18.0.240" && "%{release}" == "2%{?dist}"
f623e5
Obsoletes:        kmod-%{pkg} = %{?epoch:%{epoch}:}%{version}-1%{?dist}
f623e5
%endif
f623e5
f623e5
%if "%{version}" == "4.18.0.240" && "%{release}" == "3%{?dist}"
f623e5
Obsoletes:        kmod-%{pkg} = %{?epoch:%{epoch}:}%{version}-1%{?dist}
f623e5
Obsoletes:        kmod-%{pkg} = %{?epoch:%{epoch}:}%{version}-2%{?dist}
f623e5
%endif
f623e5
f623e5
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
Kmods SIG 0e2548
%autosetup -p1 -n %{pkg}-%{driver_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}
bd03de
%license LICENSES
c9360b
c9360b
c9360b
%changelog
f623e5
* Thu Jan 27 2022 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.240-3
f623e5
- Add obsoletes for update path
f623e5
f12329
* Sat Jan 22 2022 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.240-2
f12329
- Enable ppc64le
f12329
Kmods SIG 0e2548
* Wed Jan 12 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.240-1
Kmods SIG 0e2548
- Switch to EL kernel source and versioning
Kmods SIG 0e2548
- kABI tracking kmod package (kernel >= 4.18.0-348.el8)