Blame SPECS/kmod-mptspi.spec

205084
%global pkg mptspi
205084
205084
%global kernel_version_min 4.18.0-80.el8
205084
205084
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
205084
# Otherwise the latest installed kernel-devel version later than
205084
# %%{kernel_version_min} will be used.
205084
205084
%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)
205084
205084
%if "%{kernel_version_latest}" != ""
205084
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
205084
%endif
205084
205084
%global _use_internal_dependency_generator 0
205084
%global __find_requires %{nil}
205084
%global __find_provides /usr/lib/rpm/find-provides
205084
205084
%global debug_package %{nil}
205084
205084
%global __spec_install_post \
205084
  %{?__debug_package:%{__debug_install_post}} \
205084
  %{__arch_install_post} \
205084
  %{__os_install_post} \
205084
  %{__mod_compress_install_post}
205084
205084
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
205084
205084
205084
Name:             kmod-%{pkg}
205084
Version:          4.18.0
dba415
Release:          305.12.1%{?dist}
205084
Summary:          Fusion MPT SPI Host (%{pkg}) driver
205084
205084
License:          GPLv2
205084
URL:              https://www.kernel.org/
205084
205084
Source0:          %{pkg}-%{kernel_version_min}.tar.xz
205084
Patch1:           0001-add-deprecated-ids.patch
205084
205084
ExclusiveArch:    x86_64 aarch64
205084
205084
BuildRequires:    elfutils-libelf-devel
205084
BuildRequires:    gcc
205084
BuildRequires:    kmod
205084
BuildRequires:    make
205084
BuildRequires:    redhat-rpm-config
205084
BuildRequires:    xz
205084
205084
%{!?kernel_version:
205084
BuildRequires:    kernel-devel >= %{kernel_version_min}
205084
}
205084
205084
%{?kernel_version:
205084
BuildRequires:    kernel-devel = %{kernel_version}
205084
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
205084
205084
Requires:         kernel-core = %{kernel_version}
205084
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
205084
Requires:         kernel-modules = %{kernel_version}
205084
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
205084
205084
Provides:         installonlypkg(kernel-module)
205084
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
205084
}
205084
205084
Requires(post):   /usr/sbin/depmod
205084
Requires(postun): /usr/sbin/depmod
205084
205084
Requires(post):   /usr/bin/dracut
205084
Requires(postun): /usr/bin/dracut
205084
205084
205084
%description
205084
This package provides the Fusion MPT SPI Host (%{pkg}) driver.  Compared to the
205084
in-kernel driver this driver is not restricted to the virtualization use case.
205084
It supports the following adapters:
205084
205084
- 0x1000:0x0030: LSI 53C1020/53C1020A/53C1030
205084
- 0x1000:0x0040: LSI 53C1035
205084
- 0x117C:0x0030: ATTO UL4D
205084
205084
205084
%prep
205084
%autosetup -p1 -n %{pkg}-%{kernel_version_min}
205084
205084
205084
%build
205084
pushd src
205084
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
205084
popd
205084
205084
205084
%install
205084
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/message/fusion src/%{pkg}.ko
205084
205084
# Make .ko objects temporarily executable for automatic stripping
205084
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
205084
205084
205084
%clean
205084
%{__rm} -rf %{buildroot}
205084
205084
205084
%post
205084
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
205084
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
205084
205084
205084
%preun
205084
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
205084
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
205084
205084
205084
%postun
205084
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
205084
then
205084
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
205084
    then
205084
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
205084
    fi
205084
205084
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
205084
    then
205084
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
205084
        then
205084
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
205084
            then
205084
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
205084
            else
205084
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
205084
            fi
205084
        fi
205084
    fi
205084
205084
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
205084
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
205084
fi
205084
205084
205084
%posttrans
205084
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
205084
then
205084
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
205084
    then
205084
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
205084
    fi
205084
205084
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
205084
    then
205084
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
205084
        then
205084
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
205084
            then
205084
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
205084
            else
205084
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
205084
            fi
205084
        fi
205084
    fi
205084
205084
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
205084
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
205084
fi
205084
205084
205084
%files
205084
%defattr(644,root,root,755)
205084
/lib/modules/%{kernel_version}.%{_arch}
205084
%license COPYING
205084
205084
205084
%changelog
dba415
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305.12.1
dba415
- Rebuild for 4.18.0-305.12.1.el8_4
dba415
205084
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305
205084
- Initial version