Blame SPECS/kmod-mptspi.spec

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