Blame SPECS/kmod-megaraid_sas.spec

6099f5
%global pkg megaraid_sas
6099f5
80413a
%global driver_version 4.18.0-305.el8
6099f5
1a5a6d
%global kernel_version 4.18.0-305.3.1.el8_4
6099f5
6099f5
%global _use_internal_dependency_generator 0
1a5a6d
%global __find_requires /usr/lib/rpm/redhat/find-requires
1a5a6d
%global __find_provides /usr/lib/rpm/redhat/find-provides
6099f5
6099f5
%global debug_package %{nil}
6099f5
6099f5
%global __spec_install_post \
6099f5
  %{?__debug_package:%{__debug_install_post}} \
6099f5
  %{__arch_install_post} \
6099f5
  %{__os_install_post} \
6099f5
  %{__mod_compress_install_post}
6099f5
6099f5
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
6099f5
6099f5
6099f5
Name:             kmod-%{pkg}
1a5a6d
Version:          4.18.0.305
1a5a6d
Release:          1%{?dist}
6099f5
Summary:          Broadcom MegaRAID SAS (%{pkg}) driver
6099f5
6099f5
License:          GPLv2
6099f5
URL:              https://www.kernel.org/
6099f5
80413a
Source0:          %{pkg}-%{driver_version}.tar.xz
6099f5
Patch1:           0001-add-deprecated-ids.patch
6099f5
6099f5
ExclusiveArch:    x86_64 aarch64
6099f5
6099f5
BuildRequires:    elfutils-libelf-devel
6099f5
BuildRequires:    gcc
1a5a6d
BuildRequires:    kernel-rpm-macros
6099f5
BuildRequires:    kmod
6099f5
BuildRequires:    make
6099f5
BuildRequires:    redhat-rpm-config
6099f5
BuildRequires:    xz
6099f5
1a5a6d
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
6099f5
BuildRequires:    kernel-devel = %{kernel_version}
6099f5
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
6099f5
1a5a6d
Requires:         kernel >= %{kernel_version}
1a5a6d
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
1a5a6d
Requires:         kernel-modules >= %{kernel_version}
1a5a6d
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
6099f5
6099f5
Provides:         installonlypkg(kernel-module)
1a5a6d
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
6099f5
1a5a6d
Requires(post):   %{_sbindir}/depmod
1a5a6d
Requires(postun): %{_sbindir}/depmod
6099f5
1a5a6d
Requires(post):   %{_sbindir}/weak-modules
1a5a6d
Requires(postun): %{_sbindir}/weak-modules
6099f5
6099f5
6099f5
%description
6099f5
This package provides the Broadcom MegaRAID SAS (%{pkg}) driver. Compared to
6099f5
the in-kernel driver this driver re-enables support for deprecated adapters:
6099f5
6099f5
- 0x1000:0x0060: LSI MegaRAID SAS1078R
6099f5
- 0x1000:0x0078: LSI MegaRAID SAS1078 Gen2
6099f5
- 0x1000:0x007C: LSI MegaRAID SAS1078DE
6099f5
- 0x1000:0x0411: LSI MegaRAID SAS1064R
6099f5
- 0x1000:0x0413: LSI MegaRAID SAS1068 Verde ZCR
6099f5
- 0x1028:0x0015: Dell PERC5
6099f5
6099f5
The removal of the following adapters has been reverted in 4.18.0-290 [1761485]:
6099f5
- 0x1000:0x0071: LSI MegaRAID SAS0071 Skinny
6099f5
- 0x1000:0x0073: LSI MegaRAID SAS0073 Skinny
6099f5
- 0x1000:0x0079: LSI MegaRAID SAS0079 Gen2
6099f5
6099f5
6099f5
%prep
80413a
%autosetup -p1 -n %{pkg}-%{driver_version}
6099f5
6099f5
6099f5
%build
6099f5
pushd src
6099f5
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
6099f5
popd
6099f5
6099f5
6099f5
%install
6099f5
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/megaraid src/%{pkg}.ko
6099f5
6099f5
# Make .ko objects temporarily executable for automatic stripping
6099f5
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
6099f5
1a5a6d
# Generate depmod.conf
1a5a6d
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
1a5a6d
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
1a5a6d
do
1a5a6d
    echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
1a5a6d
done
1a5a6d
6099f5
6099f5
%clean
6099f5
%{__rm} -rf %{buildroot}
6099f5
6099f5
6099f5
%post
6099f5
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
1a5a6d
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/megaraid/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
6099f5
6099f5
6099f5
%preun
6099f5
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
1a5a6d
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
6099f5
6099f5
6099f5
%postun
1a5a6d
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
6099f5
then
1a5a6d
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
1a5a6d
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
6099f5
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
1a5a6d
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
6099f5
fi
6099f5
6099f5
1a5a6d
%pretrans -p <lua>
1a5a6d
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
1a5a6d
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
1a5a6d
1a5a6d
6099f5
%posttrans
1a5a6d
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
6099f5
then
1a5a6d
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
1a5a6d
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
6099f5
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
1a5a6d
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
6099f5
fi
6099f5
6099f5
6099f5
%files
6099f5
%defattr(644,root,root,755)
6099f5
/lib/modules/%{kernel_version}.%{_arch}
6099f5
%license COPYING
1a5a6d
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
6099f5
6099f5
6099f5
%changelog
1a5a6d
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.305-1
1a5a6d
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.3.1.el8)
1a5a6d
- Build 4.18.0-305.el8 for 4.18.0-305.3.1.el8_4
1a5a6d
- Use release number independent of kernel
1a5a6d
- Add driver release number to version
1a5a6d
ee235c
* Wed Sep 15 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305.19.1
ee235c
- Rebuild for 4.18.0-305.19.1.el8_4
ee235c
95a85c
* Thu Sep  9 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305.17.1
95a85c
- Set specific kernel version to use
95a85c
- Rename kernel_version_min to driver_version
95a85c
- Add Provides kernel-modules
95a85c
- Add .%{_arch} to kernel-modules provides version
95a85c
- Rebuild for 4.18.0-305.17.1.el8_4
95a85c
6d853e
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305.12.1
6d853e
- Rebuild for 4.18.0-305.12.1.el8_4
6d853e
6099f5
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305
6099f5
- Initial version