Blame SPECS/kmod-mptspi.spec

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