Blame SPECS/kmod-mpt3sas.spec

687889
%global pkg mpt3sas
687889
Kmods SIG 800224
%global driver_version 4.18.0-358.el8
687889
Kmods SIG 800224
%global kernel_version 4.18.0-358.el8
687889
687889
%global _use_internal_dependency_generator 0
78f51c
%global __find_requires /usr/lib/rpm/redhat/find-requires
78f51c
%global __find_provides /usr/lib/rpm/redhat/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}
Kmods SIG 800224
Version:          4.18.0.358
Kmods SIG 800224
Release:          1%{?dist}
687889
Summary:          LSI MPT Fusion SAS 3.0 Device (%{pkg}) driver
687889
687889
License:          GPLv2
687889
URL:              https://www.kernel.org/
687889
93f672
Source0:          %{pkg}-%{driver_version}.tar.xz
687889
Patch1:           0001-add-deprecated-ids.patch
687889
687889
ExclusiveArch:    x86_64 aarch64
687889
687889
BuildRequires:    elfutils-libelf-devel
687889
BuildRequires:    gcc
78f51c
BuildRequires:    kernel-rpm-macros
687889
BuildRequires:    kmod
687889
BuildRequires:    make
687889
BuildRequires:    redhat-rpm-config
687889
BuildRequires:    xz
687889
78f51c
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
687889
BuildRequires:    kernel-devel = %{kernel_version}
3994a4
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
687889
78f51c
Requires:         kernel >= %{kernel_version}
78f51c
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
78f51c
Requires:         kernel-modules >= %{kernel_version}
78f51c
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
687889
ecb4db
Provides:         installonlypkg(kernel-module)
78f51c
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
687889
78f51c
Requires(post):   %{_sbindir}/depmod
78f51c
Requires(postun): %{_sbindir}/depmod
687889
78f51c
Requires(post):   %{_sbindir}/weak-modules
78f51c
Requires(postun): %{_sbindir}/weak-modules
f94e2b
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
93f672
%autosetup -p1 -n %{pkg}-%{driver_version}
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
78f51c
# Generate depmod.conf
78f51c
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
78f51c
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
78f51c
do
78f51c
    echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
78f51c
done
78f51c
687889
687889
%clean
687889
%{__rm} -rf %{buildroot}
687889
687889
687889
%post
5c5027
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
78f51c
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg}/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
5c5027
5c5027
5c5027
%preun
5c5027
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
78f51c
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
687889
687889
687889
%postun
78f51c
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
5c5027
then
78f51c
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
78f51c
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
5c5027
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
78f51c
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
5c5027
fi
5c5027
5c5027
78f51c
%pretrans -p <lua>
78f51c
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
78f51c
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
78f51c
78f51c
5c5027
%posttrans
78f51c
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
5c5027
then
78f51c
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
78f51c
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
5c5027
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
78f51c
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
5c5027
fi
687889
687889
687889
%files
687889
%defattr(644,root,root,755)
687889
/lib/modules/%{kernel_version}.%{_arch}
687889
%license COPYING
78f51c
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
687889
687889
687889
%changelog
Kmods SIG 800224
* Fri Jan 07 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.358-1
Kmods SIG 800224
- Update to 4.18.0-358.el8
Kmods SIG 800224
326593
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.326-3
326593
- Rebuild for 4.18.0-348.el8
326593
8f6697
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.326-2
8f6697
- Rebuild for 4.18.0-338.el8
8f6697
d77567
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.326-1
d77567
- Update to 4.18.0-326.el8
d77567
3335e2
* Wed Oct 27 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.310-1
a81ed8
- Convert to kABI tracking kmod package (kernel >= 4.18.0-315.el8)
f84bcb
- Build 4.18.0-310.el8 for 4.18.0-315.el8
a81ed8
- Use release number independent of kernel
a81ed8
- Add driver release number to version