Blame SPECS/kmod-qla4xxx.spec

fcc96f
%global pkg qla4xxx
fcc96f
fcc96f
%global kernel_version_min 4.18.0-107.el8
fcc96f
fcc96f
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
fcc96f
# Otherwise the latest installed kernel-devel version later than
fcc96f
# %%{kernel_version_min} will be used.
fcc96f
fcc96f
%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)
fcc96f
fcc96f
%if "%{kernel_version_latest}" != ""
fcc96f
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
fcc96f
%endif
fcc96f
fcc96f
%global _use_internal_dependency_generator 0
7146c2
%global __find_requires %{nil}
d45516
%global __find_provides /usr/lib/rpm/find-provides
fcc96f
fcc96f
%global debug_package %{nil}
fcc96f
fcc96f
%global __spec_install_post \
fcc96f
  %{?__debug_package:%{__debug_install_post}} \
fcc96f
  %{__arch_install_post} \
fcc96f
  %{__os_install_post} \
fcc96f
  %{__mod_compress_install_post}
fcc96f
fcc96f
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
fcc96f
fcc96f
fcc96f
Name:             kmod-%{pkg}
fcc96f
Version:          4.18.0
87bbd3
Release:          326%{?dist}
fcc96f
Summary:          QLogic iSCSI HBA (%{pkg}) driver
fcc96f
fcc96f
License:          GPLv2
fcc96f
URL:              https://www.kernel.org/
fcc96f
fcc96f
Source0:          %{pkg}-%{kernel_version_min}.tar.xz
fcc96f
Patch1:           0001-add-deprecated-ids.patch
fcc96f
fcc96f
ExclusiveArch:    x86_64 aarch64
fcc96f
fcc96f
BuildRequires:    elfutils-libelf-devel
fcc96f
BuildRequires:    gcc
fcc96f
BuildRequires:    kmod
fcc96f
BuildRequires:    make
fcc96f
BuildRequires:    redhat-rpm-config
fcc96f
BuildRequires:    xz
fcc96f
fcc96f
%{!?kernel_version:
fcc96f
BuildRequires:    kernel-devel >= %{kernel_version_min}
fcc96f
}
fcc96f
fcc96f
%{?kernel_version:
fcc96f
BuildRequires:    kernel-devel = %{kernel_version}
4994a0
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
fcc96f
da46b9
Requires:         kernel-core = %{kernel_version}
4994a0
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
a25044
Requires:         kernel-modules = %{kernel_version}
4994a0
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
fcc96f
349fe5
Provides:         installonlypkg(kernel-module)
9f1b28
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
fcc96f
}
fcc96f
fcc96f
Requires(post):   /usr/sbin/depmod
fcc96f
Requires(postun): /usr/sbin/depmod
fcc96f
a742c4
Requires(post):   /usr/bin/dracut
a742c4
Requires(postun): /usr/bin/dracut
a742c4
fcc96f
fcc96f
%description
fcc96f
This package provides the QLogic iSCSI HBA (%{pkg}) driver. Compared to the
fcc96f
in-kernel driver this driver re-enables support for deprecated adapters:
fcc96f
fcc96f
- 0x1077:0x8022: QLogic ISP8022
fcc96f
- 0x1077:0x8032: QLogic ISP8324
fcc96f
- 0x1077:0x8042: QLogic ISP8042
fcc96f
fcc96f
fcc96f
%prep
fcc96f
%autosetup -p1 -n %{pkg}-%{kernel_version_min}
fcc96f
fcc96f
fcc96f
%build
fcc96f
pushd src
fcc96f
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
fcc96f
popd
fcc96f
fcc96f
fcc96f
%install
fcc96f
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
fcc96f
fcc96f
# Make .ko objects temporarily executable for automatic stripping
fcc96f
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
fcc96f
fcc96f
fcc96f
%clean
fcc96f
%{__rm} -rf %{buildroot}
fcc96f
fcc96f
fcc96f
%post
22cda1
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
22cda1
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
22cda1
22cda1
22cda1
%preun
22cda1
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
22cda1
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
fcc96f
fcc96f
fcc96f
%postun
22cda1
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
22cda1
then
22cda1
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
22cda1
    then
22cda1
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
22cda1
    fi
22cda1
a742c4
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
a742c4
    then
a742c4
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
a742c4
        then
a742c4
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
a742c4
            then
a742c4
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
a742c4
            else
a742c4
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
a742c4
            fi
a742c4
        fi
a742c4
    fi
a742c4
22cda1
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
22cda1
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
22cda1
fi
22cda1
22cda1
22cda1
%posttrans
22cda1
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
22cda1
then
22cda1
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
22cda1
    then
22cda1
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
22cda1
    fi
22cda1
a742c4
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
a742c4
    then
a742c4
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
a742c4
        then
a742c4
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
a742c4
            then
a742c4
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
a742c4
            else
a742c4
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
a742c4
            fi
a742c4
        fi
a742c4
    fi
a742c4
22cda1
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
22cda1
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
22cda1
fi
fcc96f
fcc96f
fcc96f
%files
fcc96f
%defattr(644,root,root,755)
fcc96f
/lib/modules/%{kernel_version}.%{_arch}
fcc96f
%license COPYING
fcc96f
fcc96f
fcc96f
%changelog
87bbd3
* Thu Jul 29 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-326
87bbd3
- Rebuild for 4.18.0-326.el8
87bbd3
fcc96f
* Fri Jul 23 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-107
fcc96f
- Initial version