Blame SPECS/kmod-be2net.spec

88b27f
%global pkg be2net
88b27f
a38ed4
%global kernel_version_min 4.18.0-326.el8
88b27f
88b27f
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
88b27f
# Otherwise the latest installed kernel-devel version later than
88b27f
# %%{kernel_version_min} will be used.
88b27f
88b27f
%global kernel_version_latest %({ echo %{kernel_version_min}; rpm --query kernel-devel --queryformat '%%{VERSION}-%%{RELEASE}\\\n' | grep -v "package kernel-devel is not installed"; } | sort -V | sed -e '0,/^%{kernel_version_min}$/d' | tail -n 1)
88b27f
88b27f
%if "%{kernel_version_latest}" != ""
88b27f
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
88b27f
%endif
88b27f
88b27f
%global _use_internal_dependency_generator 0
836e6a
%global __find_requires %{nil}
eb6474
%global __find_provides /usr/lib/rpm/find-provides
88b27f
88b27f
%global debug_package %{nil}
88b27f
88b27f
%global __spec_install_post \
88b27f
  %{?__debug_package:%{__debug_install_post}} \
88b27f
  %{__arch_install_post} \
88b27f
  %{__os_install_post} \
88b27f
  %{__mod_compress_install_post}
88b27f
88b27f
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
88b27f
88b27f
88b27f
Name:             kmod-%{pkg}
88b27f
Version:          4.18.0
a38ed4
Release:          326%{?dist}
88b27f
Summary:          Emulex OneConnect NIC (%{pkg}) driver
88b27f
88b27f
License:          GPLv2
88b27f
URL:              https://www.kernel.org/
88b27f
88b27f
Source0:          %{pkg}-%{kernel_version_min}.tar.xz
88b27f
Patch1:           0001-enable-be2-and-be3.patch
88b27f
88b27f
ExclusiveArch:    x86_64
88b27f
88b27f
BuildRequires:    elfutils-libelf-devel
88b27f
BuildRequires:    gcc
88b27f
BuildRequires:    kmod
88b27f
BuildRequires:    make
88b27f
BuildRequires:    redhat-rpm-config
88b27f
BuildRequires:    xz
88b27f
88b27f
%{!?kernel_version:
88b27f
BuildRequires:    kernel-devel >= %{kernel_version_min}
88b27f
}
88b27f
88b27f
%{?kernel_version:
88b27f
BuildRequires:    kernel-devel = %{kernel_version}
88b27f
88b27f
Supplements:      kernel = %{kernel_version}
88b27f
dd9a64
Requires:         kernel-core = %{kernel_version}
132d28
Requires:         kernel-modules = %{kernel_version}
88b27f
88b27f
Provides:         kernel-modules = %{kernel_version}.%{_arch}
88b27f
}
88b27f
88b27f
Requires(post):   /usr/sbin/depmod
88b27f
Requires(postun): /usr/sbin/depmod
88b27f
88b27f
88b27f
%description
88b27f
This package provides the %{pkg} driver. Compared to the in-kernel driver this
88b27f
driver re-enables support for deprecated BladeEngine 2 and 3 adapters.
88b27f
88b27f
BladeEngine 2 (BE2) devices:
88b27f
- 0x19A2:0x0211: Emulex BladeEngine 2 Network Adapter
88b27f
- 0x19A2:0x0700: Emulex OneConnect Tigershark NIC
88b27f
88b27f
BladeEngine 3 (BE3) devices:
88b27f
- 0x19A2:0x0221: Emulex BladeEngine3 Network Adapter
88b27f
- 0x19A2:0x0710: Emulex OneConnect Tomcat NIC
88b27f
88b27f
88b27f
%prep
88b27f
%autosetup -p1 -n %{pkg}-%{kernel_version_min}
88b27f
88b27f
88b27f
%build
88b27f
pushd src
88b27f
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
88b27f
popd
88b27f
88b27f
88b27f
%install
88b27f
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet/emulex/benet src/%{pkg}.ko
88b27f
88b27f
# Make .ko objects temporarily executable for automatic stripping
88b27f
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
88b27f
88b27f
88b27f
%clean
88b27f
%{__rm} -rf %{buildroot}
88b27f
88b27f
88b27f
%post
f54437
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
f54437
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
f54437
f54437
f54437
%preun
f54437
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
f54437
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
88b27f
88b27f
88b27f
%postun
f54437
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
f54437
then
f54437
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
f54437
    then
f54437
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
f54437
    fi
f54437
f54437
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
f54437
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
f54437
fi
f54437
f54437
f54437
%posttrans
f54437
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
f54437
then
f54437
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
f54437
    then
f54437
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
f54437
    fi
f54437
f54437
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
f54437
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
f54437
fi
88b27f
88b27f
88b27f
%files
88b27f
%defattr(644,root,root,755)
88b27f
/lib/modules/%{kernel_version}.%{_arch}
88b27f
%license COPYING
88b27f
88b27f
88b27f
%changelog
a38ed4
* Thu Jul 29 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-326
a38ed4
- Update to 4.18.0-326.el8
a38ed4
88b27f
* Fri Jul 23 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-211
88b27f
- Initial version