Blame SPECS/kmod-mptsas.spec

3e045e
%global pkg mptsas
3e045e
25dd33
%global driver_version 4.18.0-326.el8
3e045e
25dd33
%global kernel_version 4.18.0-326.el8
3e045e
3e045e
%global _use_internal_dependency_generator 0
f3cfde
%global __find_requires /usr/lib/rpm/redhat/find-requires
f3cfde
%global __find_provides /usr/lib/rpm/redhat/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}
25dd33
Version:          4.18.0.326
5ab491
Release:          1%{?dist}
3e045e
Summary:          Fusion MPT SAS Host (%{pkg}) driver
3e045e
3e045e
License:          GPLv2
3e045e
URL:              https://www.kernel.org/
3e045e
e2d70e
Source0:          %{pkg}-%{driver_version}.tar.xz
3e045e
Patch1:           0001-add-deprecated-ids.patch
3e045e
3e045e
ExclusiveArch:    x86_64 aarch64
3e045e
3e045e
BuildRequires:    elfutils-libelf-devel
3e045e
BuildRequires:    gcc
f3cfde
BuildRequires:    kernel-rpm-macros
3e045e
BuildRequires:    kmod
3e045e
BuildRequires:    make
3e045e
BuildRequires:    redhat-rpm-config
3e045e
BuildRequires:    xz
3e045e
f3cfde
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
3e045e
BuildRequires:    kernel-devel = %{kernel_version}
a2e156
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
3e045e
f3cfde
Requires:         kernel >= %{kernel_version}
f3cfde
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
f3cfde
Requires:         kernel-modules >= %{kernel_version}
f3cfde
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
3e045e
5161fe
Provides:         installonlypkg(kernel-module)
f3cfde
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
3e045e
f3cfde
Requires(post):   %{_sbindir}/depmod
f3cfde
Requires(postun): %{_sbindir}/depmod
3e045e
f3cfde
Requires(post):   %{_sbindir}/weak-modules
f3cfde
Requires(postun): %{_sbindir}/weak-modules
d9732c
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
e2d70e
%autosetup -p1 -n %{pkg}-%{driver_version}
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
f3cfde
# Generate depmod.conf
f3cfde
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
f3cfde
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
f3cfde
do
f3cfde
    echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
f3cfde
done
f3cfde
3e045e
3e045e
%clean
3e045e
%{__rm} -rf %{buildroot}
3e045e
3e045e
3e045e
%post
4f866f
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
f3cfde
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/message/fusion/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
4f866f
4f866f
4f866f
%preun
4f866f
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
f3cfde
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
3e045e
3e045e
3e045e
%postun
f3cfde
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
4f866f
then
f3cfde
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
f3cfde
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
4f866f
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
f3cfde
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
4f866f
fi
4f866f
4f866f
f3cfde
%pretrans -p <lua>
f3cfde
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
f3cfde
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
f3cfde
f3cfde
4f866f
%posttrans
f3cfde
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
4f866f
then
f3cfde
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
f3cfde
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
4f866f
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
f3cfde
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
4f866f
fi
3e045e
3e045e
3e045e
%files
3e045e
%defattr(644,root,root,755)
3e045e
/lib/modules/%{kernel_version}.%{_arch}
3e045e
%license COPYING
f3cfde
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
3e045e
3e045e
3e045e
%changelog
25dd33
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.326-1
25dd33
- Update to 4.18.0-326.el8
25dd33
a808ba
* Wed Oct 27 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.80-1
5ab491
- Add driver release number to version
5ab491
286b41
* Wed Oct 27 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-350
286b41
- Use release number independent of kernel
286b41
- Build 4.18.0-80.el8 for 4.18.0-315.el8
286b41
f3cfde
* Wed Oct 27 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-348
f3cfde
- Convert to kABI tracking kmod package (kernel >= 4.18.0-326.el8)
f3cfde
4e9b9b
* Mon Aug 30 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-338
4e9b9b
- Set specific kernel version to use
4e9b9b
- Rename kernel_version_min to driver_version
4e9b9b
- Add Provides kernel-modules
4e9b9b
- Rebuild for 4.18.0-338.el8
4e9b9b
dbff9c
* Thu Aug 19 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-331
dbff9c
- Rebuild for 4.18.0-331.el8
dbff9c
8bbef9
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-326
5ef591
- Update to 4.18.0-326.el8
8bbef9
- Fix provides/requires
8bbef9
- Fix kernel dependencies
8bbef9
- Add convenient provides kmod-aacraid-`uname -r`
8bbef9
- Fix installonlypkg detection
8bbef9
- Recreate source tarballs
8bbef9
- Rebuild for dist = .el8s
8bbef9
8bbef9
* Fri Jul 23 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-293
3e045e
- Initial version