Blame SPECS/kmod-3w-9xxx.spec

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