Blame SPECS/kmod-mpt3sas.spec

f9038e
%global pkg mpt3sas
f9038e
3d8b0e
%global driver_version 5.14.0-24.el9
f9038e
Kmods SIG ec1305
%global kernel_version 5.14.0-32.el9
f9038e
f9038e
%global debug_package %{nil}
f9038e
f9038e
%global __spec_install_post \
f9038e
  %{?__debug_package:%{__debug_install_post}} \
f9038e
  %{__arch_install_post} \
f9038e
  %{__os_install_post} \
f9038e
  %{__mod_compress_install_post}
f9038e
f9038e
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
f9038e
f9038e
f9038e
Name:             kmod-%{pkg}
3d8b0e
Version:          5.14.0.24
Kmods SIG ec1305
Release:          2%{?dist}
f9038e
Summary:          LSI MPT Fusion SAS 3.0 Device (%{pkg}) driver
f9038e
f9038e
License:          GPLv2
f9038e
URL:              https://www.kernel.org/
f9038e
f9038e
Source0:          %{pkg}-%{driver_version}.tar.xz
f9038e
Patch1:           0001-add-deprecated-ids.patch
f9038e
f9038e
ExclusiveArch:    x86_64 aarch64
f9038e
f9038e
BuildRequires:    elfutils-libelf-devel
f9038e
BuildRequires:    gcc
3d8b0e
BuildRequires:    kernel-rpm-macros
f9038e
BuildRequires:    kmod
f9038e
BuildRequires:    make
f9038e
BuildRequires:    redhat-rpm-config
f9038e
BuildRequires:    xz
f9038e
3d8b0e
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
f9038e
BuildRequires:    kernel-devel = %{kernel_version}
f9038e
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
f9038e
3d8b0e
Requires:         kernel >= %{kernel_version}
3d8b0e
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
3d8b0e
Requires:         kernel-modules >= %{kernel_version}
3d8b0e
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
f9038e
f9038e
Provides:         installonlypkg(kernel-module)
3d8b0e
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
f9038e
3d8b0e
Requires(post):   %{_sbindir}/depmod
3d8b0e
Requires(postun): %{_sbindir}/depmod
f9038e
3d8b0e
Requires(post):   %{_sbindir}/weak-modules
3d8b0e
Requires(postun): %{_sbindir}/weak-modules
f9038e
f9038e
f9038e
%description
f9038e
This package provides the LSI MPT Fusion SAS 3.0 Device (%{pkg}) driver.
f9038e
Compared to the in-kernel driver this driver re-enables support for deprecated
f9038e
mpt2sas adapters:
f9038e
f9038e
- 0x1000:0x0064: LSI SAS2116_1
f9038e
- 0x1000:0x0065: LSI SAS2116_2
f9038e
- 0x1000:0x0070: LSI SAS2004
f9038e
- 0x1000:0x0072: LSI SAS2008
f9038e
- 0x1000:0x0074: LSI SAS2108_1
f9038e
- 0x1000:0x0076: LSI SAS2108_2
f9038e
- 0x1000:0x0077: LSI SAS2108_3
f9038e
- 0x1000:0x007E: LSI SSS6200
f9038e
f9038e
f9038e
%prep
f9038e
%autosetup -p1 -n %{pkg}-%{driver_version}
f9038e
f9038e
f9038e
%build
f9038e
pushd src
f9038e
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
f9038e
popd
f9038e
f9038e
f9038e
%install
f9038e
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
f9038e
f9038e
# Make .ko objects temporarily executable for automatic stripping
f9038e
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
f9038e
3d8b0e
# Generate depmod.conf
3d8b0e
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
3d8b0e
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
3d8b0e
do
3d8b0e
    echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
3d8b0e
done
3d8b0e
f9038e
f9038e
%clean
f9038e
%{__rm} -rf %{buildroot}
f9038e
f9038e
f9038e
%post
f9038e
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
3d8b0e
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg}/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
f9038e
f9038e
f9038e
%preun
f9038e
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
3d8b0e
rpm -ql kmod-%{pkg}-%{?epoch:%{epoch}:}%{version}-%{release}.%{_arch} | grep '/lib/modules/%{kernel_version}.%{_arch}/.*\.ko\.xz$' >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
f9038e
f9038e
f9038e
%postun
3d8b0e
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
f9038e
then
3d8b0e
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
3d8b0e
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
f9038e
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
3d8b0e
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
f9038e
fi
f9038e
f9038e
3d8b0e
%pretrans -p <lua>
3d8b0e
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
3d8b0e
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
3d8b0e
3d8b0e
f9038e
%posttrans
3d8b0e
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
f9038e
then
3d8b0e
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
3d8b0e
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
f9038e
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
3d8b0e
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
f9038e
fi
f9038e
f9038e
f9038e
%files
f9038e
%defattr(644,root,root,755)
f9038e
/lib/modules/%{kernel_version}.%{_arch}
f9038e
%license COPYING
3d8b0e
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
f9038e
f9038e
f9038e
%changelog
Kmods SIG ec1305
* Thu Dec 16 2021 Kmods SIG <sig-kmods@centosproject.org> - 5.14.0.24-2
Kmods SIG ec1305
- Rebuild for 5.14.0-32.el9
Kmods SIG ec1305
3d8b0e
* Thu Dec 16 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.14.0.24-1
3d8b0e
- Convert to kABI tracking kmod package (kernel >= 5.14.0-31.el9)