Blame SPECS/kmod-3w-sas.spec

242f84
%global pkg 3w-sas
242f84
Kmods SIG ccfb2b
%global driver_version 4.18.0-80.el8
Kmods SIG ccfb2b
502325
%global kernel_version 4.18.0-348.el8
242f84
242f84
%global _use_internal_dependency_generator 0
9e8c60
%global __find_requires /usr/lib/rpm/redhat/find-requires
9e8c60
%global __find_provides /usr/lib/rpm/redhat/find-provides
242f84
242f84
%global debug_package %{nil}
242f84
242f84
%global __spec_install_post \
242f84
  %{?__debug_package:%{__debug_install_post}} \
242f84
  %{__arch_install_post} \
242f84
  %{__os_install_post} \
242f84
  %{__mod_compress_install_post}
242f84
242f84
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
242f84
242f84
242f84
Name:             kmod-%{pkg}
Kmods SIG ccfb2b
Version:          4.18.0.80
033d87
Release:          2%{?dist}
242f84
Summary:          3ware 97xx SAS/SATA RAID Controller (%{pkg}) driver
242f84
242f84
License:          GPLv2
242f84
URL:              https://www.kernel.org/
242f84
Kmods SIG ccfb2b
Source0:          %{pkg}-%{driver_version}.tar.xz
Kmods SIG ccfb2b
Patch1:           0001-scsi-3ware-fix-return-0-on-the-error-path-of-probe.patch
242f84
033d87
ExclusiveArch:    x86_64 aarch64 ppc64le
242f84
242f84
BuildRequires:    elfutils-libelf-devel
242f84
BuildRequires:    gcc
9e8c60
BuildRequires:    kernel-rpm-macros
242f84
BuildRequires:    kmod
242f84
BuildRequires:    make
242f84
BuildRequires:    redhat-rpm-config
242f84
BuildRequires:    xz
242f84
9e8c60
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
242f84
BuildRequires:    kernel-devel = %{kernel_version}
242f84
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
242f84
9e8c60
Requires:         kernel >= %{kernel_version}
9e8c60
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
9e8c60
Requires:         kernel-modules >= %{kernel_version}
9e8c60
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
242f84
242f84
Provides:         installonlypkg(kernel-module)
9e8c60
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
242f84
9e8c60
Requires(post):   %{_sbindir}/depmod
9e8c60
Requires(postun): %{_sbindir}/depmod
242f84
9e8c60
Requires(post):   %{_sbindir}/weak-modules
9e8c60
Requires(postun): %{_sbindir}/weak-modules
242f84
242f84
242f84
%description
242f84
This driver supports 3ware's 97xx series SAS/SATA RAID controller cards:
242f84
242f84
- 0x13C1:1010: 3ware 9750
242f84
242f84
242f84
%prep
Kmods SIG ccfb2b
%autosetup -p1 -n %{pkg}-%{driver_version}
242f84
242f84
242f84
%build
242f84
pushd src
242f84
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
242f84
popd
242f84
242f84
242f84
%install
242f84
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi src/%{pkg}.ko
242f84
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
242f84
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
242f84
242f84
# Make .ko objects temporarily executable for automatic stripping
242f84
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
242f84
242f84
242f84
%clean
242f84
%{__rm} -rf %{buildroot}
242f84
242f84
242f84
%post
242f84
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
9e8c60
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
242f84
242f84
242f84
%preun
242f84
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
9e8c60
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
242f84
242f84
242f84
%postun
9e8c60
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
242f84
then
9e8c60
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
9e8c60
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
242f84
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
9e8c60
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
242f84
fi
242f84
242f84
9e8c60
%pretrans -p <lua>
9e8c60
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
9e8c60
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
9e8c60
9e8c60
242f84
%posttrans
9e8c60
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
242f84
then
9e8c60
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
9e8c60
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
242f84
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
9e8c60
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
242f84
fi
242f84
242f84
242f84
%files
242f84
%defattr(644,root,root,755)
242f84
/lib/modules/%{kernel_version}.%{_arch}
fc0ec6
%license LICENSES
242f84
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
242f84
242f84
242f84
%changelog
033d87
* Sat Jan 22 2022 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.80-2
033d87
- Enable ppc64le
033d87
Kmods SIG ccfb2b
* Wed Jan 12 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.80-1
Kmods SIG ccfb2b
- Switch to EL kernel source and versioning
Kmods SIG ccfb2b
- kABI tracking kmod package (kernel >= 4.18.0-348.el8)