Blame SPECS/kmod-3w-sas.spec

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