Blame SPECS/kmod-mptsas.spec

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