Blame SPECS/kmod-be2net.spec

88b27f
%global pkg be2net
88b27f
c9ee67
%global driver_version 4.18.0-211.el8
88b27f
c9ee67
%global kernel_version 4.18.0-315.el8
88b27f
88b27f
%global _use_internal_dependency_generator 0
184186
%global __find_requires /usr/lib/rpm/redhat/find-requires
184186
%global __find_provides /usr/lib/rpm/redhat/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
c9ee67
Release:          350%{?dist}
88b27f
Summary:          Emulex OneConnect NIC (%{pkg}) driver
88b27f
88b27f
License:          GPLv2
88b27f
URL:              https://www.kernel.org/
88b27f
1bcd35
Source0:          %{pkg}-%{driver_version}.tar.xz
88b27f
Patch1:           0001-enable-be2-and-be3.patch
88b27f
88b27f
ExclusiveArch:    x86_64
88b27f
88b27f
BuildRequires:    elfutils-libelf-devel
88b27f
BuildRequires:    gcc
184186
BuildRequires:    kernel-rpm-macros
88b27f
BuildRequires:    kmod
88b27f
BuildRequires:    make
88b27f
BuildRequires:    redhat-rpm-config
88b27f
BuildRequires:    xz
88b27f
184186
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
88b27f
BuildRequires:    kernel-devel = %{kernel_version}
e66e2c
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
88b27f
184186
Requires:         kernel >= %{kernel_version}
184186
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
184186
Requires:         kernel-modules >= %{kernel_version}
184186
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
88b27f
2e233a
Provides:         installonlypkg(kernel-module)
184186
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
88b27f
184186
Requires(post):   %{_sbindir}/depmod
184186
Requires(postun): %{_sbindir}/depmod
88b27f
184186
Requires(post):   %{_sbindir}/weak-modules
184186
Requires(postun): %{_sbindir}/weak-modules
babdcd
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
1bcd35
%autosetup -p1 -n %{pkg}-%{driver_version}
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
184186
# Generate depmod.conf
184186
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
184186
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
184186
do
184186
    echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
184186
done
184186
88b27f
88b27f
%clean
88b27f
%{__rm} -rf %{buildroot}
88b27f
88b27f
88b27f
%post
f54437
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
184186
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
f54437
f54437
f54437
%preun
f54437
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
184186
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
88b27f
88b27f
88b27f
%postun
184186
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
f54437
then
184186
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
184186
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
f54437
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
184186
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
f54437
fi
f54437
f54437
184186
%pretrans -p <lua>
184186
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
184186
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
184186
184186
f54437
%posttrans
184186
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
f54437
then
184186
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
184186
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
f54437
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
184186
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
f54437
fi
88b27f
88b27f
88b27f
%files
88b27f
%defattr(644,root,root,755)
88b27f
/lib/modules/%{kernel_version}.%{_arch}
88b27f
%license COPYING
184186
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
88b27f
88b27f
88b27f
%changelog
c9ee67
* Wed Oct 27 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-350
c9ee67
- Use release number independent of kernel
c9ee67
- Build 4.18.0-211.el8 for 4.18.0-315.el8
c9ee67
184186
* Wed Oct 27 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-348
184186
- Convert to kABI tracking kmod package (kernel >= 4.18.0-331.el8)
184186
d014b7
* Mon Aug 30 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-338
d014b7
- Set specific kernel version to use
d014b7
- Rename kernel_version_min to driver_version
d014b7
- Add Provides kernel-modules
d014b7
- Rebuild for 4.18.0-338.el8
d014b7
a1eb61
* Thu Aug 19 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-331
a1eb61
- Update to 4.18.0-331.el8
a1eb61
b3b025
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-326
a38ed4
- Update to 4.18.0-326.el8
b3b025
- Fix provides/requires
b3b025
- Fix kernel dependencies
b3b025
- Add convenient provides kmod-aacraid-`uname -r`
b3b025
- Fix installonlypkg detection
b3b025
- Recreate source tarballs
b3b025
- Rebuild for dist = .el8s
b3b025
b3b025
* Fri Jul 23 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-211
88b27f
- Initial version