Blame SPECS/kmod-megaraid_sas.spec

6099f5
%global pkg megaraid_sas
6099f5
Kmods SIG c7954e
%global driver_version 4.18.0-372.9.1.el8
6099f5
Kmods SIG c7954e
%global kernel_version 4.18.0-372.9.1.el8
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}
Kmods SIG c7954e
Version:          4.18.0.372.9.1
Kmods SIG c7954e
Release:          1%{?dist}
6099f5
Summary:          Broadcom MegaRAID SAS (%{pkg}) driver
6099f5
4a826e
License:          GPLv2 and GPLv2+
6099f5
URL:              https://www.kernel.org/
6099f5
80413a
Source0:          %{pkg}-%{driver_version}.tar.xz
6099f5
Patch1:           0001-add-deprecated-ids.patch
6099f5
517e23
ExclusiveArch:    x86_64 aarch64 ppc64le
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
511d18
%if "%{version}" == "4.18.0.348" && "%{release}" == "2%{?dist}"
511d18
Obsoletes:        kmod-%{pkg} = %{?epoch:%{epoch}:}%{version}-1%{?dist}
511d18
%endif
511d18
511d18
%if "%{version}" == "4.18.0.348" && "%{release}" == "3%{?dist}"
511d18
Obsoletes:        kmod-%{pkg} = %{?epoch:%{epoch}:}%{version}-1%{?dist}
511d18
Obsoletes:        kmod-%{pkg} = %{?epoch:%{epoch}:}%{version}-2%{?dist}
511d18
%endif
511d18
511d18
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}
70ad71
%license LICENSES
1a5a6d
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
6099f5
6099f5
6099f5
%changelog
Kmods SIG c7954e
* Tue May 10 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.372.9.1-1
Kmods SIG c7954e
- Update to 4.18.0-372.9.1.el8
Kmods SIG c7954e
511d18
* Thu Jan 27 2022 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.348-3
511d18
- Add obsoletes for update path
511d18
517e23
* Sat Jan 22 2022 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.348-2
517e23
- Enable ppc64le
517e23
62605f
* Tue Nov 09 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.348-1
62605f
- Update to 4.18.0-348.el8
62605f
1a5a6d
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.305-1
360c68
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8)
360c68
- Build 4.18.0-305.el8 for 4.18.0-305.7.1.el8_4
1a5a6d
- Use release number independent of kernel
1a5a6d
- Add driver release number to version