Blame SPECS/kmod-be2net.spec

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