Blame SPECS/kmod-qla2xxx.spec

7dabf7
%global pkg qla2xxx
7dabf7
7dabf7
%global kernel_version_min 4.18.0-305.el8
7dabf7
7dabf7
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
7dabf7
# Otherwise the latest installed kernel-devel version later than
7dabf7
# %%{kernel_version_min} will be used.
7dabf7
7dabf7
%global kernel_version_latest %({ echo %{kernel_version_min}; rpm --query kernel-devel --queryformat '%%{VERSION}-%%{RELEASE}\\\n' | grep -v "package kernel-devel is not installed"; } | sort -V | sed -e '0,/^%{kernel_version_min}$/d' | tail -n 1)
7dabf7
7dabf7
%if "%{kernel_version_latest}" != ""
7dabf7
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
7dabf7
%endif
7dabf7
7dabf7
%global _use_internal_dependency_generator 0
7dabf7
%global __find_requires %{nil}
7dabf7
%global __find_provides /usr/lib/rpm/find-provides
7dabf7
7dabf7
%global debug_package %{nil}
7dabf7
7dabf7
%global __spec_install_post \
7dabf7
  %{?__debug_package:%{__debug_install_post}} \
7dabf7
  %{__arch_install_post} \
7dabf7
  %{__os_install_post} \
7dabf7
  %{__mod_compress_install_post}
7dabf7
7dabf7
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
7dabf7
7dabf7
7dabf7
Name:             kmod-%{pkg}
7dabf7
Version:          4.18.0
41a6a1
Release:          305.12.1%{?dist}
7dabf7
Summary:          QLogic Fibre Channel HBA (%{pkg}) driver
7dabf7
7dabf7
License:          GPLv2
7dabf7
URL:              https://www.kernel.org/
7dabf7
7dabf7
Source0:          %{pkg}-%{kernel_version_min}.tar.xz
7dabf7
Patch1:           0001-add-deprecated-ids.patch
7dabf7
7dabf7
ExclusiveArch:    x86_64 aarch64
7dabf7
7dabf7
BuildRequires:    elfutils-libelf-devel
7dabf7
BuildRequires:    gcc
7dabf7
BuildRequires:    kmod
7dabf7
BuildRequires:    make
7dabf7
BuildRequires:    redhat-rpm-config
7dabf7
BuildRequires:    xz
7dabf7
7dabf7
%{!?kernel_version:
7dabf7
BuildRequires:    kernel-devel >= %{kernel_version_min}
7dabf7
}
7dabf7
7dabf7
%{?kernel_version:
7dabf7
BuildRequires:    kernel-devel = %{kernel_version}
7dabf7
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
7dabf7
7dabf7
Requires:         kernel-core = %{kernel_version}
7dabf7
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
7dabf7
Requires:         kernel-modules = %{kernel_version}
7dabf7
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
7dabf7
7dabf7
Provides:         installonlypkg(kernel-module)
7dabf7
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
7dabf7
}
7dabf7
7dabf7
Requires(post):   /usr/sbin/depmod
7dabf7
Requires(postun): /usr/sbin/depmod
7dabf7
7dabf7
Requires(post):   /usr/bin/dracut
7dabf7
Requires(postun): /usr/bin/dracut
7dabf7
7dabf7
7dabf7
%description
7dabf7
This package provides the QLogic Fibre Channel HBA (%{pkg}) driver. Compared to
7dabf7
the in-kernel driver this driver re-enables support for deprecated adapters:
7dabf7
7dabf7
- 0x1077:0x2100: QLogic ISP2100
7dabf7
- 0x1077:0x2200: QLogic ISP2200
7dabf7
- 0x1077:0x2300: QLogic ISP2300
7dabf7
- 0x1077:0x2312: QLogic ISP2312
7dabf7
- 0x1077:0x2322: QLogic ISP2322
7dabf7
- 0x1077:0x2422: QLogic ISP2422
7dabf7
- 0x1077:0x2432: QLogic ISP2432
7dabf7
- 0x1077:0x5422: QLogic ISP5422
7dabf7
- 0x1077:0x5432: QLogic ISP5432 / QLE220
7dabf7
- 0x1077:0x6312: QLogic ISP6312
7dabf7
- 0x1077:0x6322: QLogic ISP6322
7dabf7
- 0x1077:0x8001: QLogic ISP8001 / QLE81xx
7dabf7
- 0x1077:0x8021: QLogic ISP8021 / QLE82xx
7dabf7
- 0x1077:0x8044: QLogic ISP8044 / QLE84xx
7dabf7
- 0x1077:0x8432: QLogic ISP8432 / QLE8000
7dabf7
- 0x1077:0xF001: QLogic ISPF001 / QLE10000
7dabf7
7dabf7
7dabf7
%prep
7dabf7
%autosetup -p1 -n %{pkg}-%{kernel_version_min}
7dabf7
7dabf7
7dabf7
%build
7dabf7
pushd src
7dabf7
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
7dabf7
popd
7dabf7
7dabf7
7dabf7
%install
7dabf7
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
7dabf7
7dabf7
# Make .ko objects temporarily executable for automatic stripping
7dabf7
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
7dabf7
7dabf7
7dabf7
%clean
7dabf7
%{__rm} -rf %{buildroot}
7dabf7
7dabf7
7dabf7
%post
7dabf7
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
7dabf7
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
7dabf7
7dabf7
7dabf7
%preun
7dabf7
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
7dabf7
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
7dabf7
7dabf7
7dabf7
%postun
7dabf7
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
7dabf7
then
7dabf7
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
7dabf7
    then
7dabf7
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
7dabf7
    fi
7dabf7
7dabf7
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
7dabf7
    then
7dabf7
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
7dabf7
        then
7dabf7
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
7dabf7
            then
7dabf7
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
7dabf7
            else
7dabf7
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
7dabf7
            fi
7dabf7
        fi
7dabf7
    fi
7dabf7
7dabf7
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
7dabf7
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
7dabf7
fi
7dabf7
7dabf7
7dabf7
%posttrans
7dabf7
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
7dabf7
then
7dabf7
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
7dabf7
    then
7dabf7
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
7dabf7
    fi
7dabf7
7dabf7
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
7dabf7
    then
7dabf7
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
7dabf7
        then
7dabf7
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
7dabf7
            then
7dabf7
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
7dabf7
            else
7dabf7
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
7dabf7
            fi
7dabf7
        fi
7dabf7
    fi
7dabf7
7dabf7
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
7dabf7
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
7dabf7
fi
7dabf7
7dabf7
7dabf7
%files
7dabf7
%defattr(644,root,root,755)
7dabf7
/lib/modules/%{kernel_version}.%{_arch}
7dabf7
%license COPYING
7dabf7
7dabf7
7dabf7
%changelog
41a6a1
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305.12.1
41a6a1
- Rebuild for 4.18.0-305.12.1.el8_4
41a6a1
7dabf7
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305
7dabf7
- Initial version