Blame SPECS/kmod-mpt3sas.spec

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