Blame SPECS/kmod-mpt3sas.spec

687889
%global pkg mpt3sas
687889
43c940
%global kernel_version_min 4.18.0-326.el8
687889
687889
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
687889
# Otherwise the latest installed kernel-devel version later than
687889
# %%{kernel_version_min} will be used.
687889
687889
%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)
687889
687889
%if "%{kernel_version_latest}" != ""
687889
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
687889
%endif
687889
687889
%global _use_internal_dependency_generator 0
47980d
%global __find_requires %{nil}
fe99c5
%global __find_provides /usr/lib/rpm/find-provides
687889
687889
%global debug_package %{nil}
687889
687889
%global __spec_install_post \
687889
  %{?__debug_package:%{__debug_install_post}} \
687889
  %{__arch_install_post} \
687889
  %{__os_install_post} \
687889
  %{__mod_compress_install_post}
687889
687889
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
687889
687889
687889
Name:             kmod-%{pkg}
687889
Version:          4.18.0
43c940
Release:          326%{?dist}
687889
Summary:          LSI MPT Fusion SAS 3.0 Device (%{pkg}) driver
687889
687889
License:          GPLv2
687889
URL:              https://www.kernel.org/
687889
687889
Source0:          %{pkg}-%{kernel_version_min}.tar.xz
687889
Patch1:           0001-add-deprecated-ids.patch
687889
687889
ExclusiveArch:    x86_64 aarch64
687889
687889
BuildRequires:    elfutils-libelf-devel
687889
BuildRequires:    gcc
687889
BuildRequires:    kmod
687889
BuildRequires:    make
687889
BuildRequires:    redhat-rpm-config
687889
BuildRequires:    xz
687889
687889
%{!?kernel_version:
687889
BuildRequires:    kernel-devel >= %{kernel_version_min}
687889
}
687889
687889
%{?kernel_version:
687889
BuildRequires:    kernel-devel = %{kernel_version}
3994a4
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
687889
a19e16
Requires:         kernel-core = %{kernel_version}
3994a4
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
3230f9
Requires:         kernel-modules = %{kernel_version}
3994a4
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
687889
ecb4db
Provides:         installonlypkg(kernel-module)
6bf572
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
687889
}
687889
687889
Requires(post):   /usr/sbin/depmod
687889
Requires(postun): /usr/sbin/depmod
687889
687889
687889
%description
687889
This package provides the LSI MPT Fusion SAS 3.0 Device (%{pkg}) driver.
687889
Compared to the in-kernel driver this driver re-enables support for deprecated
687889
mpt2sas adapters:
687889
687889
- 0x1000:0x0064: LSI SAS2116_1
687889
- 0x1000:0x0065: LSI SAS2116_2
687889
- 0x1000:0x0070: LSI SAS2004
687889
- 0x1000:0x0072: LSI SAS2008
687889
- 0x1000:0x0074: LSI SAS2108_1
687889
- 0x1000:0x0076: LSI SAS2108_2
687889
- 0x1000:0x0077: LSI SAS2108_3
687889
- 0x1000:0x007E: LSI SSS6200
687889
687889
687889
%prep
687889
%autosetup -p1 -n %{pkg}-%{kernel_version_min}
687889
687889
687889
%build
687889
pushd src
687889
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
687889
popd
687889
687889
687889
%install
687889
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
687889
687889
# Make .ko objects temporarily executable for automatic stripping
687889
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
687889
687889
687889
%clean
687889
%{__rm} -rf %{buildroot}
687889
687889
687889
%post
5c5027
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
5c5027
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
5c5027
5c5027
5c5027
%preun
5c5027
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
5c5027
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
687889
687889
687889
%postun
5c5027
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
5c5027
then
5c5027
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
5c5027
    then
5c5027
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
5c5027
    fi
5c5027
5c5027
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
5c5027
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
5c5027
fi
5c5027
5c5027
5c5027
%posttrans
5c5027
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
5c5027
then
5c5027
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
5c5027
    then
5c5027
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
5c5027
    fi
5c5027
5c5027
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
5c5027
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
5c5027
fi
687889
687889
687889
%files
687889
%defattr(644,root,root,755)
687889
/lib/modules/%{kernel_version}.%{_arch}
687889
%license COPYING
687889
687889
687889
%changelog
43c940
* Thu Jul 29 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-326
43c940
- Update to 4.18.0-326.el8
43c940
687889
* Fri Jul 23 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-310
687889
- Initial version