Blame SPECS/kmod-be2net.spec

8b0b02
%global pkg be2net
8b0b02
8b0b02
%global driver_version 5.14.0-1.el9
8b0b02
Kmods SIG b4a2a1
%global kernel_version 5.14.0-32.el9
8b0b02
8b0b02
%global debug_package %{nil}
8b0b02
8b0b02
%global __spec_install_post \
8b0b02
  %{?__debug_package:%{__debug_install_post}} \
8b0b02
  %{__arch_install_post} \
8b0b02
  %{__os_install_post} \
8b0b02
  %{__mod_compress_install_post}
8b0b02
8b0b02
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
8b0b02
8b0b02
8b0b02
Name:             kmod-%{pkg}
56da38
Version:          5.14.0.1
Kmods SIG b4a2a1
Release:          2%{?dist}
8b0b02
Summary:          Emulex OneConnect NIC (%{pkg}) driver
8b0b02
8b0b02
License:          GPLv2
8b0b02
URL:              https://www.kernel.org/
8b0b02
8b0b02
Source0:          %{pkg}-%{driver_version}.tar.xz
8b0b02
Patch1:           0001-enable-be2-and-be3.patch
8b0b02
8b0b02
ExclusiveArch:    x86_64
8b0b02
8b0b02
BuildRequires:    elfutils-libelf-devel
8b0b02
BuildRequires:    gcc
56da38
BuildRequires:    kernel-rpm-macros
8b0b02
BuildRequires:    kmod
8b0b02
BuildRequires:    make
8b0b02
BuildRequires:    redhat-rpm-config
8b0b02
BuildRequires:    xz
8b0b02
56da38
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
8b0b02
BuildRequires:    kernel-devel = %{kernel_version}
8b0b02
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
8b0b02
56da38
Requires:         kernel >= %{kernel_version}
56da38
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
56da38
Requires:         kernel-modules >= %{kernel_version}
56da38
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
8b0b02
8b0b02
Provides:         installonlypkg(kernel-module)
56da38
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
8b0b02
56da38
Requires(post):   %{_sbindir}/depmod
56da38
Requires(postun): %{_sbindir}/depmod
8b0b02
56da38
Requires(post):   %{_sbindir}/weak-modules
56da38
Requires(postun): %{_sbindir}/weak-modules
8b0b02
8b0b02
8b0b02
%description
8b0b02
This package provides the %{pkg} driver. Compared to the in-kernel driver this
8b0b02
driver re-enables support for deprecated BladeEngine 2 and 3 adapters.
8b0b02
8b0b02
BladeEngine 2 (BE2) devices:
8b0b02
- 0x19A2:0x0211: Emulex BladeEngine 2 Network Adapter
8b0b02
- 0x19A2:0x0700: Emulex OneConnect Tigershark NIC
8b0b02
8b0b02
BladeEngine 3 (BE3) devices:
8b0b02
- 0x19A2:0x0221: Emulex BladeEngine3 Network Adapter
8b0b02
- 0x19A2:0x0710: Emulex OneConnect Tomcat NIC
8b0b02
8b0b02
8b0b02
%prep
8b0b02
%autosetup -p1 -n %{pkg}-%{driver_version}
8b0b02
8b0b02
8b0b02
%build
8b0b02
pushd src
8b0b02
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
8b0b02
popd
8b0b02
8b0b02
8b0b02
%install
8b0b02
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet/emulex/benet src/%{pkg}.ko
8b0b02
8b0b02
# Make .ko objects temporarily executable for automatic stripping
8b0b02
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
8b0b02
56da38
# Generate depmod.conf
56da38
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
56da38
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
56da38
do
56da38
    echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
56da38
done
56da38
8b0b02
8b0b02
%clean
8b0b02
%{__rm} -rf %{buildroot}
8b0b02
8b0b02
8b0b02
%post
8b0b02
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
56da38
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet/emulex/benet/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
8b0b02
8b0b02
8b0b02
%preun
8b0b02
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
56da38
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
8b0b02
8b0b02
8b0b02
%postun
56da38
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
8b0b02
then
56da38
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
56da38
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
8b0b02
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
56da38
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
8b0b02
fi
8b0b02
8b0b02
56da38
%pretrans -p <lua>
56da38
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
56da38
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
56da38
56da38
8b0b02
%posttrans
56da38
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
8b0b02
then
56da38
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
56da38
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
8b0b02
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
56da38
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
8b0b02
fi
8b0b02
8b0b02
8b0b02
%files
8b0b02
%defattr(644,root,root,755)
8b0b02
/lib/modules/%{kernel_version}.%{_arch}
8b0b02
%license COPYING
56da38
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
8b0b02
8b0b02
8b0b02
%changelog
Kmods SIG b4a2a1
* Thu Dec 16 2021 Kmods SIG <sig-kmods@centosproject.org> - 5.14.0.1-2
Kmods SIG b4a2a1
- Rebuild for 5.14.0-32.el9
Kmods SIG b4a2a1
56da38
* Thu Dec 16 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.14.0.1-1
56da38
- Convert to kABI tracking kmod package (kernel >= 5.14.0-31.el9)