Blame SPECS/kmod-mptspi.spec

66dd61
%global pkg mptspi
66dd61
2862ee
%global driver_version 4.18.0-80.el8
66dd61
Kmods SIG 8a9ee2
%global kernel_version 4.18.0-358.el8
66dd61
66dd61
%global _use_internal_dependency_generator 0
64d848
%global __find_requires /usr/lib/rpm/redhat/find-requires
64d848
%global __find_provides /usr/lib/rpm/redhat/find-provides
66dd61
66dd61
%global debug_package %{nil}
66dd61
66dd61
%global __spec_install_post \
66dd61
  %{?__debug_package:%{__debug_install_post}} \
66dd61
  %{__arch_install_post} \
66dd61
  %{__os_install_post} \
66dd61
  %{__mod_compress_install_post}
66dd61
66dd61
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
66dd61
66dd61
66dd61
Name:             kmod-%{pkg}
4ba32f
Version:          4.18.0.80
Kmods SIG 8a9ee2
Release:          3%{?dist}
66dd61
Summary:          Fusion MPT SPI Host (%{pkg}) driver
66dd61
66dd61
License:          GPLv2
66dd61
URL:              https://www.kernel.org/
66dd61
2862ee
Source0:          %{pkg}-%{driver_version}.tar.xz
66dd61
Patch1:           0001-add-deprecated-ids.patch
66dd61
66dd61
ExclusiveArch:    x86_64 aarch64
66dd61
66dd61
BuildRequires:    elfutils-libelf-devel
66dd61
BuildRequires:    gcc
64d848
BuildRequires:    kernel-rpm-macros
66dd61
BuildRequires:    kmod
66dd61
BuildRequires:    make
66dd61
BuildRequires:    redhat-rpm-config
66dd61
BuildRequires:    xz
66dd61
64d848
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
66dd61
BuildRequires:    kernel-devel = %{kernel_version}
93e98c
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
66dd61
64d848
Requires:         kernel >= %{kernel_version}
64d848
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
64d848
Requires:         kernel-modules >= %{kernel_version}
64d848
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
66dd61
125b9b
Provides:         installonlypkg(kernel-module)
64d848
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
66dd61
64d848
Requires(post):   %{_sbindir}/depmod
64d848
Requires(postun): %{_sbindir}/depmod
66dd61
64d848
Requires(post):   %{_sbindir}/weak-modules
64d848
Requires(postun): %{_sbindir}/weak-modules
daed2c
66dd61
66dd61
%description
66dd61
This package provides the Fusion MPT SPI Host (%{pkg}) driver.  Compared to the
66dd61
in-kernel driver this driver is not restricted to the virtualization use case.
66dd61
It supports the following adapters:
66dd61
66dd61
- 0x1000:0x0030: LSI 53C1020/53C1020A/53C1030
66dd61
- 0x1000:0x0040: LSI 53C1035
66dd61
- 0x117C:0x0030: ATTO UL4D
66dd61
66dd61
66dd61
%prep
2862ee
%autosetup -p1 -n %{pkg}-%{driver_version}
66dd61
66dd61
66dd61
%build
66dd61
pushd src
66dd61
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
66dd61
popd
66dd61
66dd61
66dd61
%install
66dd61
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/message/fusion src/%{pkg}.ko
66dd61
66dd61
# Make .ko objects temporarily executable for automatic stripping
66dd61
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
66dd61
64d848
# Generate depmod.conf
64d848
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
64d848
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
64d848
do
64d848
    echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
64d848
done
64d848
66dd61
66dd61
%clean
66dd61
%{__rm} -rf %{buildroot}
66dd61
66dd61
66dd61
%post
38b0b6
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
64d848
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/message/fusion/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
38b0b6
38b0b6
38b0b6
%preun
38b0b6
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
64d848
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
66dd61
66dd61
66dd61
%postun
64d848
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
38b0b6
then
64d848
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
64d848
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
38b0b6
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
64d848
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
38b0b6
fi
38b0b6
38b0b6
64d848
%pretrans -p <lua>
64d848
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
64d848
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
64d848
64d848
38b0b6
%posttrans
64d848
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
38b0b6
then
64d848
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
64d848
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
38b0b6
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
64d848
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
38b0b6
fi
66dd61
66dd61
66dd61
%files
66dd61
%defattr(644,root,root,755)
66dd61
/lib/modules/%{kernel_version}.%{_arch}
18eb2a
%license LICENSES
64d848
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
66dd61
66dd61
66dd61
%changelog
Kmods SIG 8a9ee2
* Tue Jan 11 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.80-3
Kmods SIG 8a9ee2
- Rebuild for 4.18.0-358.el8
Kmods SIG 8a9ee2
59aedb
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.80-2
59aedb
- Rebuild for 4.18.0-326.el8
59aedb
4ba32f
* Wed Oct 27 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.80-1
d1cf16
- Convert to kABI tracking kmod package (kernel >= 4.18.0-315.el8)
567ced
- Build 4.18.0-80.el8 for 4.18.0-315.el8
d1cf16
- Use release number independent of kernel
d1cf16
- Add driver release number to version