Blame SPECS/kmod-be2iscsi.spec

7b9484
%global pkg be2iscsi
7b9484
0ff998
%global driver_version 4.18.0-305.el8
7b9484
61ba80
%global kernel_version 4.18.0-348.el8
7b9484
7b9484
%global _use_internal_dependency_generator 0
7635c3
%global __find_requires /usr/lib/rpm/redhat/find-requires
7635c3
%global __find_provides /usr/lib/rpm/redhat/find-provides
7b9484
7b9484
%global debug_package %{nil}
7b9484
7b9484
%global __spec_install_post \
7b9484
  %{?__debug_package:%{__debug_install_post}} \
7b9484
  %{__arch_install_post} \
7b9484
  %{__os_install_post} \
7b9484
  %{__mod_compress_install_post}
7b9484
7b9484
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
7b9484
7b9484
7b9484
Name:             kmod-%{pkg}
7635c3
Version:          4.18.0.305
61ba80
Release:          2%{?dist}
7b9484
Summary:          Emulex OneConnectOpen-iSCSI (%{pkg}) driver
7b9484
7b9484
License:          GPLv2
7b9484
URL:              https://www.kernel.org/
7b9484
0ff998
Source0:          %{pkg}-%{driver_version}.tar.xz
7b9484
Patch1:           0001-add-deprecated-ids-be3.patch
7b9484
Patch2:           0002-add-deprecated-ids-be2.patch
7b9484
7b9484
ExclusiveArch:    x86_64 aarch64
7b9484
7b9484
BuildRequires:    elfutils-libelf-devel
7b9484
BuildRequires:    gcc
7635c3
BuildRequires:    kernel-rpm-macros
7b9484
BuildRequires:    kmod
7b9484
BuildRequires:    make
7b9484
BuildRequires:    redhat-rpm-config
7b9484
BuildRequires:    xz
7b9484
7635c3
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
7b9484
BuildRequires:    kernel-devel = %{kernel_version}
7b9484
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
7b9484
7635c3
Requires:         kernel >= %{kernel_version}
7635c3
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
7635c3
Requires:         kernel-modules >= %{kernel_version}
7635c3
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
7b9484
7b9484
Provides:         installonlypkg(kernel-module)
7635c3
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
7b9484
7635c3
Requires(post):   %{_sbindir}/depmod
7635c3
Requires(postun): %{_sbindir}/depmod
7b9484
7635c3
Requires(post):   %{_sbindir}/weak-modules
7635c3
Requires(postun): %{_sbindir}/weak-modules
7b9484
7b9484
7b9484
%description
7b9484
This package provides the Emulex OneConnectOpen-iSCSI (%{pkg}) driver. Compared
7b9484
to the in-kernel driver this driver re-enables support for deprecated
7b9484
BladeEngine 2 and 3 adapters.
7b9484
7b9484
BladeEngine 2 (BE2) devices:
7b9484
- 0x19A2:0x0212: Emulex BladeEngine 2 10Gb iSCSI Initiator
7b9484
- 0x19A2:0x0702: Emulex OneConnect OCe10101/OCm10101/OCe10102/OCm10102
7b9484
- 0x19A2:0x0703: Emulex OneConnect OCe10100
7b9484
7b9484
BladeEngine 3 (BE3) devices:
7b9484
- 0x19A2:0x0222: Emulex BladeEngine 3 iSCSI
7b9484
- 0x19A2:0x0712: Emulex OneConnect Tomcat iSCSI
7b9484
7b9484
7b9484
%prep
0ff998
%autosetup -p1 -n %{pkg}-%{driver_version}
7b9484
7b9484
7b9484
%build
7b9484
pushd src
7b9484
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
7b9484
popd
7b9484
7b9484
7b9484
%install
7b9484
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
7b9484
7b9484
# Make .ko objects temporarily executable for automatic stripping
7b9484
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
7b9484
7635c3
# Generate depmod.conf
7635c3
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
7635c3
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
7635c3
do
7635c3
    echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
7635c3
done
7635c3
7b9484
7b9484
%clean
7b9484
%{__rm} -rf %{buildroot}
7b9484
7b9484
7b9484
%post
7b9484
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
7635c3
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg}/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
7b9484
7b9484
7b9484
%preun
7b9484
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
7635c3
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
7b9484
7b9484
7b9484
%postun
7635c3
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
7b9484
then
7635c3
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
7635c3
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
7b9484
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
7635c3
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
7b9484
fi
7b9484
7b9484
7635c3
%pretrans -p <lua>
7635c3
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
7635c3
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
7635c3
7635c3
7b9484
%posttrans
7635c3
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
7b9484
then
7635c3
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
7635c3
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
7b9484
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
7635c3
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
7b9484
fi
7b9484
7b9484
7b9484
%files
7b9484
%defattr(644,root,root,755)
7b9484
/lib/modules/%{kernel_version}.%{_arch}
8ed4ad
%license LICENSES
7635c3
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
7b9484
7b9484
7b9484
%changelog
61ba80
* Tue Nov 09 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.305-2
61ba80
- Rebuild for 4.18.0-348.el8
61ba80
7635c3
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.305-1
871ff6
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8)
871ff6
- Build 4.18.0-305.el8 for 4.18.0-305.7.1.el8_4
7635c3
- Use release number independent of kernel
7635c3
- Add driver release number to version