Blame SPECS/kmod-mptsas.spec

3e045e
%global pkg mptsas
3e045e
5ef591
%global kernel_version_min 4.18.0-326.el8
3e045e
3e045e
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
3e045e
# Otherwise the latest installed kernel-devel version later than
3e045e
# %%{kernel_version_min} will be used.
3e045e
3e045e
%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)
3e045e
3e045e
%if "%{kernel_version_latest}" != ""
3e045e
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
3e045e
%endif
3e045e
3e045e
%global _use_internal_dependency_generator 0
93c6f2
%global __find_requires %{nil}
5337fd
%global __find_provides /usr/lib/rpm/find-provides
3e045e
3e045e
%global debug_package %{nil}
3e045e
3e045e
%global __spec_install_post \
3e045e
  %{?__debug_package:%{__debug_install_post}} \
3e045e
  %{__arch_install_post} \
3e045e
  %{__os_install_post} \
3e045e
  %{__mod_compress_install_post}
3e045e
3e045e
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
3e045e
3e045e
3e045e
Name:             kmod-%{pkg}
3e045e
Version:          4.18.0
5ef591
Release:          326%{?dist}
3e045e
Summary:          Fusion MPT SAS Host (%{pkg}) driver
3e045e
3e045e
License:          GPLv2
3e045e
URL:              https://www.kernel.org/
3e045e
3e045e
Source0:          %{pkg}-%{kernel_version_min}.tar.xz
3e045e
Patch1:           0001-add-deprecated-ids.patch
3e045e
3e045e
ExclusiveArch:    x86_64 aarch64
3e045e
3e045e
BuildRequires:    elfutils-libelf-devel
3e045e
BuildRequires:    gcc
3e045e
BuildRequires:    kmod
3e045e
BuildRequires:    make
3e045e
BuildRequires:    redhat-rpm-config
3e045e
BuildRequires:    xz
3e045e
3e045e
%{!?kernel_version:
3e045e
BuildRequires:    kernel-devel >= %{kernel_version_min}
3e045e
}
3e045e
3e045e
%{?kernel_version:
3e045e
BuildRequires:    kernel-devel = %{kernel_version}
3e045e
3e045e
Supplements:      kernel = %{kernel_version}
3e045e
29a974
Requires:         kernel-core = %{kernel_version}
ef7c7f
Requires:         kernel-modules = %{kernel_version}
3e045e
3e045e
Provides:         kernel-modules = %{kernel_version}.%{_arch}
3e045e
}
3e045e
3e045e
Requires(post):   /usr/sbin/depmod
3e045e
Requires(postun): /usr/sbin/depmod
3e045e
3e045e
Provides:         %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
3e045e
3e045e
3e045e
%description
3e045e
This package provides the Fusion MPT SAS Host (%{pkg}) driver.  Compared to the
3e045e
in-kernel driver this driver is not restricted to the virtualization use case.
3e045e
It supports the following adapters:
3e045e
3e045e
- 0x1000:0x0050: LSI SAS1064
3e045e
- 0x1000:0x0054: LSI SAS1068
3e045e
- 0x1000:0x0056: LSI SAS1064E
3e045e
- 0x1000:0x0058: LSI SAS1068E
3e045e
- 0x1000:0x0059: LSI SAS1068_820XELP
3e045e
- 0x1000:0x0062: LSI SAS1078
3e045e
3e045e
3e045e
%prep
3e045e
%autosetup -p1 -n %{pkg}-%{kernel_version_min}
3e045e
3e045e
3e045e
%build
3e045e
pushd src
3e045e
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
3e045e
popd
3e045e
3e045e
3e045e
%install
3e045e
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/message/fusion src/%{pkg}.ko
3e045e
3e045e
# Make .ko objects temporarily executable for automatic stripping
3e045e
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
3e045e
3e045e
3e045e
%clean
3e045e
%{__rm} -rf %{buildroot}
3e045e
3e045e
3e045e
%post
4f866f
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
4f866f
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
4f866f
4f866f
4f866f
%preun
4f866f
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
4f866f
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
3e045e
3e045e
3e045e
%postun
4f866f
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
4f866f
then
4f866f
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
4f866f
    then
4f866f
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
4f866f
    fi
4f866f
4f866f
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
4f866f
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
4f866f
fi
4f866f
4f866f
4f866f
%posttrans
4f866f
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
4f866f
then
4f866f
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
4f866f
    then
4f866f
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
4f866f
    fi
4f866f
4f866f
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
4f866f
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
4f866f
fi
3e045e
3e045e
3e045e
%files
3e045e
%defattr(644,root,root,755)
3e045e
/lib/modules/%{kernel_version}.%{_arch}
3e045e
%license COPYING
3e045e
3e045e
3e045e
%changelog
5ef591
* Thu Jul 29 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-326
5ef591
- Update to 4.18.0-326.el8
5ef591
3e045e
* Fri Jul 23 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-293
3e045e
- Initial version