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

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