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

7ee51a
%global pkg 3w-9xxx
7ee51a
3372b8
%global kernel_version 4.18.0-348.el8
7ee51a
7ee51a
%global _use_internal_dependency_generator 0
735568
%global __find_requires /usr/lib/rpm/redhat/find-requires
735568
%global __find_provides /usr/lib/rpm/redhat/find-provides
7ee51a
7ee51a
%global debug_package %{nil}
7ee51a
7ee51a
%global __spec_install_post \
7ee51a
  %{?__debug_package:%{__debug_install_post}} \
7ee51a
  %{__arch_install_post} \
7ee51a
  %{__os_install_post} \
7ee51a
  %{__mod_compress_install_post}
7ee51a
7ee51a
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
7ee51a
7ee51a
7ee51a
Name:             kmod-%{pkg}
7ee51a
Version:          4.19
3372b8
Release:          7%{?dist}
7ee51a
Summary:          3ware 9xxx SATA RAID Controller (%{pkg}) driver
7ee51a
7ee51a
License:          GPLv2
7ee51a
URL:              https://www.kernel.org/
7ee51a
7ee51a
Source0:          %{pkg}-%{version}.tar.xz
7ee51a
7ee51a
ExclusiveArch:    x86_64 aarch64
7ee51a
7ee51a
BuildRequires:    elfutils-libelf-devel
7ee51a
BuildRequires:    gcc
735568
BuildRequires:    kernel-rpm-macros
7ee51a
BuildRequires:    kmod
7ee51a
BuildRequires:    make
7ee51a
BuildRequires:    redhat-rpm-config
7ee51a
BuildRequires:    xz
7ee51a
735568
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
7ee51a
BuildRequires:    kernel-devel = %{kernel_version}
7ee51a
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
7ee51a
735568
Requires:         kernel >= %{kernel_version}
735568
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
735568
Requires:         kernel-modules >= %{kernel_version}
735568
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
7ee51a
7ee51a
Provides:         installonlypkg(kernel-module)
735568
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
7ee51a
735568
Requires(post):   %{_sbindir}/depmod
735568
Requires(postun): %{_sbindir}/depmod
7ee51a
735568
Requires(post):   %{_sbindir}/weak-modules
735568
Requires(postun): %{_sbindir}/weak-modules
7ee51a
7ee51a
7ee51a
%description
7ee51a
This driver supports 3ware's 9xxx series SATA RAID controller cards:
7ee51a
7ee51a
- 0x13C1:1002: 3ware 9000
7ee51a
- 0x13C1:1003: 3ware 9550SX
7ee51a
- 0x13C1:1004: 3ware 9650SE
7ee51a
- 0x13C1:1005: 3ware 9690SA
7ee51a
7ee51a
7ee51a
%prep
7ee51a
%autosetup -p1 -n %{pkg}-%{version}
7ee51a
7ee51a
7ee51a
%build
7ee51a
pushd src
7ee51a
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
7ee51a
popd
7ee51a
7ee51a
7ee51a
%install
7ee51a
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi src/%{pkg}.ko
7ee51a
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
7ee51a
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
7ee51a
7ee51a
# Make .ko objects temporarily executable for automatic stripping
7ee51a
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
7ee51a
7ee51a
7ee51a
%clean
7ee51a
%{__rm} -rf %{buildroot}
7ee51a
7ee51a
7ee51a
%post
7ee51a
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
735568
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
7ee51a
7ee51a
7ee51a
%preun
7ee51a
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
735568
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
7ee51a
7ee51a
7ee51a
%postun
735568
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
7ee51a
then
735568
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
735568
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
7ee51a
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
735568
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
7ee51a
fi
7ee51a
7ee51a
735568
%pretrans -p <lua>
735568
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
735568
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
735568
735568
7ee51a
%posttrans
735568
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
7ee51a
then
735568
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
735568
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
7ee51a
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
735568
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
7ee51a
fi
7ee51a
7ee51a
7ee51a
%files
7ee51a
%defattr(644,root,root,755)
7ee51a
/lib/modules/%{kernel_version}.%{_arch}
7ee51a
%license COPYING
7ee51a
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
7ee51a
7ee51a
7ee51a
%changelog
3372b8
* Thu Oct 21 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-7
3372b8
- Rebuild for 4.18.0-348.el8
3372b8
4c774c
* Wed Sep 29 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-6
4c774c
- Rebuild for 4.18.0-338.el8
4c774c
735568
* Tue Sep 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-5
735568
- Convert to kABI tracking kmod package (kernel >= 4.18.0-315.el8)