Blame SPECS/kmod-mlx4.spec

cf790c
%global pkg mlx4
cf790c
Kmods SIG c983a5
%global driver_version 4.18.0-394.el8
cf790c
Kmods SIG c983a5
%global kernel_version 4.18.0-394.el8
cf790c
cf790c
%global _use_internal_dependency_generator 0
c63a4c
%global __find_requires /usr/lib/rpm/redhat/find-requires
c63a4c
%global __find_provides /usr/lib/rpm/redhat/find-provides
cf790c
cf790c
%global debug_package %{nil}
cf790c
cf790c
%global __spec_install_post \
cf790c
  %{?__debug_package:%{__debug_install_post}} \
cf790c
  %{__arch_install_post} \
cf790c
  %{__os_install_post} \
cf790c
  %{__mod_compress_install_post}
cf790c
cf790c
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
cf790c
cf790c
cf790c
Name:             kmod-%{pkg}
Kmods SIG c983a5
Version:          4.18.0.394
Kmods SIG 581929
Release:          1%{?dist}
cf790c
Summary:          Mellanox ConnectX HCA (%{pkg}) driver
cf790c
cf790c
License:          GPLv2 and (BSD or GPLv2)
cf790c
URL:              https://www.kernel.org/
cf790c
767af5
Source0:          %{pkg}-%{driver_version}.tar.xz
cf790c
Patch1:           0001-disable-mlx4_en.patch
cf790c
Patch2:           0002-enable-mlx4_core-gen2.patch
cf790c
f6ad3d
ExclusiveArch:    x86_64 aarch64 ppc64le
cf790c
cf790c
BuildRequires:    elfutils-libelf-devel
cf790c
BuildRequires:    gcc
c63a4c
BuildRequires:    kernel-rpm-macros
cf790c
BuildRequires:    kmod
cf790c
BuildRequires:    make
cf790c
BuildRequires:    redhat-rpm-config
cf790c
BuildRequires:    xz
cf790c
c63a4c
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
cf790c
BuildRequires:    kernel-devel = %{kernel_version}
ed311d
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
cf790c
c63a4c
Requires:         kernel >= %{kernel_version}
c63a4c
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
c63a4c
Requires:         kernel-modules >= %{kernel_version}
c63a4c
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
cf790c
c511ae
Provides:         installonlypkg(kernel-module)
c63a4c
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
cf790c
c63a4c
Requires(post):   %{_sbindir}/depmod
c63a4c
Requires(postun): %{_sbindir}/depmod
cf790c
c63a4c
Requires(post):   %{_sbindir}/weak-modules
c63a4c
Requires(postun): %{_sbindir}/weak-modules
de626c
cf790c
434ace
%if "%{version}" == "4.18.0.315" && "%{release}" == "6%{?dist}"
434ace
Obsoletes:        kmod-%{pkg} = %{?epoch:%{epoch}:}%{version}-5%{?dist}
434ace
%endif
434ace
434ace
%if "%{version}" == "4.18.0.315" && "%{release}" == "7%{?dist}"
434ace
Obsoletes:        kmod-%{pkg} = %{?epoch:%{epoch}:}%{version}-5%{?dist}
434ace
Obsoletes:        kmod-%{pkg} = %{?epoch:%{epoch}:}%{version}-6%{?dist}
434ace
%endif
434ace
434ace
cf790c
%description
cf790c
This package provides the Mellanos ConnectX HCA (%{pkg}) driver. Compared to
cf790c
the in-kernel driver this driver re-enables support for deprecated Mellanox
cf790c
Gen2 and ConnectX-2 adapters:
cf790c
cf790c
- 0x15B3:0x1002: Mellanox ConnectX-2 MT25400
cf790c
- 0x15B3:0x6340: Mellanox Hermon SDR
cf790c
- 0x15B3:0x634A: Mellanox Hermon DDR
cf790c
- 0x15B3:0x6354: Mellanox Hermon QDR
cf790c
- 0x15B3:0x6368: Mellanox Hermon EN 10GigE
cf790c
- 0x15B3:0x6372: Mellanox ConnectX EN 10GBASE-T
cf790c
- 0x15B3:0x6732: Mellanox Hermon DDR Gen2
cf790c
- 0x15B3:0x673C: Mellanox Hermon QDR Gen2
cf790c
- 0x15B3:0x6746: Mellanox ConnectX EN 40GigE PCIe Gen2 5GT/s
cf790c
- 0x15B3:0x6750: Mellanox Hermon EN 10GigE Gen2
cf790c
- 0x15B3:0x675A: Mellanox ConnectX EN 10GBASE-T Gen2
cf790c
- 0x15B3:0x6764: Mellanox ConnectX EN 10 GigE PCIe Gen2
cf790c
- 0x15B3:0x676E: Mellanox ConnectX-2 40GigE PCIe Gen2
cf790c
cf790c
cf790c
%prep
767af5
%autosetup -p1 -n %{pkg}-%{driver_version}
cf790c
cf790c
cf790c
%build
cf790c
pushd src
cf790c
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
cf790c
popd
cf790c
cf790c
cf790c
%install
cf790c
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet/mellanox/%{pkg} src/%{pkg}_core.ko
cf790c
cf790c
# Make .ko objects temporarily executable for automatic stripping
cf790c
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
cf790c
c63a4c
# Generate depmod.conf
c63a4c
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
c63a4c
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
c63a4c
do
c63a4c
    echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
c63a4c
done
c63a4c
cf790c
cf790c
%clean
cf790c
%{__rm} -rf %{buildroot}
cf790c
cf790c
cf790c
%post
2064d3
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
c63a4c
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet/mellanox/%{pkg}/%{pkg}_core.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
2064d3
2064d3
2064d3
%preun
2064d3
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
c63a4c
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
cf790c
cf790c
cf790c
%postun
c63a4c
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
2064d3
then
c63a4c
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
c63a4c
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
2064d3
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
c63a4c
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
2064d3
fi
2064d3
2064d3
c63a4c
%pretrans -p <lua>
c63a4c
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
c63a4c
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
c63a4c
c63a4c
2064d3
%posttrans
c63a4c
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
2064d3
then
c63a4c
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
c63a4c
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
2064d3
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
c63a4c
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
2064d3
fi
cf790c
cf790c
cf790c
%files
cf790c
%defattr(644,root,root,755)
cf790c
/lib/modules/%{kernel_version}.%{_arch}
9ae4ea
%license LICENSES
c63a4c
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
cf790c
cf790c
cf790c
%changelog
Kmods SIG c983a5
* Tue May 31 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.394-1
Kmods SIG c983a5
- Update to 4.18.0-394.el8
Kmods SIG c983a5
Kmods SIG 581929
* Tue Mar 22 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.373-1
Kmods SIG 581929
- Update to 4.18.0-373.el8
Kmods SIG 581929
Kmods SIG 5f0cfe
* Thu Feb 10 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.315-8
Kmods SIG 5f0cfe
- Rebuild for 4.18.0-365.el8
Kmods SIG 5f0cfe
434ace
* Thu Jan 27 2022 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.315-7
434ace
- Add obsoletes for update path
434ace
f6ad3d
* Sat Jan 22 2022 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.315-6
f6ad3d
- Enable ppc64le
f6ad3d
Kmods SIG 46493e
* Mon Jan 10 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.315-5
Kmods SIG 46493e
- Rebuild for 4.18.0-358.el8
Kmods SIG 46493e
d9f429
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.315-4
d9f429
- Rebuild for 4.18.0-348.el8
d9f429
33d2b0
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.315-3
33d2b0
- Rebuild for 4.18.0-338.el8
33d2b0
1ea962
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.315-2
1ea962
- Rebuild for 4.18.0-326.el8
1ea962
ae5064
* Wed Oct 27 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.315-1
00c94c
- Convert to kABI tracking kmod package (kernel >= 4.18.0-315.el8)
90bed7
- Build 4.18.0-315.el8 for 4.18.0-315.el8
00c94c
- Use release number independent of kernel
00c94c
- Add driver release number to version