Blame SPECS/kmod-3w-sas.spec

242f84
%global pkg 3w-sas
242f84
9e8c60
%global kernel_version 4.18.0-305.7.1.el8_4
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}
242f84
Version:          4.19
9e8c60
Release:          5%{?dist}
242f84
Summary:          3ware 97xx SAS/SATA RAID Controller (%{pkg}) driver
242f84
242f84
License:          GPLv2
242f84
URL:              https://www.kernel.org/
242f84
242f84
Source0:          %{pkg}-%{version}.tar.xz
242f84
242f84
ExclusiveArch:    x86_64 aarch64
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
242f84
%autosetup -p1 -n %{pkg}-%{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}
242f84
%license COPYING
242f84
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
242f84
242f84
242f84
%changelog
9e8c60
* Tue Sep 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-5
9e8c60
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8_4)
9e8c60
d69412
* Wed Sep 15 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-4
d69412
- Rebuild for 4.18.0-305.19.1.el8_4
d69412
828a8c
* Thu Sep  9 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-3
828a8c
- Set specific kernel version to use
828a8c
- Add Provides kernel-modules
828a8c
- Add .%{_arch} to kernel-modules provides version
828a8c
- Rebuild for 4.18.0-305.17.1.el8_4
828a8c
989cba
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-2
989cba
- Rebuild for 4.18.0-305.12.1.el8_4
989cba
242f84
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-1
242f84
- Initial version