Blame SPECS/kmod-mvsas.spec

b53785
%global pkg mvsas
b53785
946125
%global kernel_version 4.18.0-348.el8
b53785
b53785
%global _use_internal_dependency_generator 0
46e7e9
%global __find_requires /usr/lib/rpm/redhat/find-requires
46e7e9
%global __find_provides /usr/lib/rpm/redhat/find-provides
b53785
b53785
%global debug_package %{nil}
b53785
b53785
%global __spec_install_post \
b53785
  %{?__debug_package:%{__debug_install_post}} \
b53785
  %{__arch_install_post} \
b53785
  %{__os_install_post} \
b53785
  %{__mod_compress_install_post}
b53785
b53785
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
b53785
b53785
b53785
Name:             kmod-%{pkg}
b53785
Version:          4.18
946125
Release:          6%{?dist}
b53785
Summary:          Marvell 88SE64XX/88SE94XX SAS/SATA Controller (%{pkg}) driver
b53785
b53785
License:          GPLv2
b53785
URL:              https://www.kernel.org/
b53785
b53785
Source0:          %{pkg}-%{version}.tar.xz
b53785
b53785
ExclusiveArch:    x86_64 aarch64
b53785
b53785
BuildRequires:    elfutils-libelf-devel
b53785
BuildRequires:    gcc
46e7e9
BuildRequires:    kernel-rpm-macros
b53785
BuildRequires:    kmod
b53785
BuildRequires:    make
b53785
BuildRequires:    redhat-rpm-config
b53785
BuildRequires:    xz
b53785
46e7e9
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
b53785
BuildRequires:    kernel-devel = %{kernel_version}
b53785
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
b53785
46e7e9
Requires:         kernel >= %{kernel_version}
46e7e9
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
46e7e9
Requires:         kernel-modules >= %{kernel_version}
46e7e9
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
b53785
b53785
Provides:         installonlypkg(kernel-module)
46e7e9
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
b53785
46e7e9
Requires(post):   %{_sbindir}/depmod
46e7e9
Requires(postun): %{_sbindir}/depmod
b53785
46e7e9
Requires(post):   %{_sbindir}/weak-modules
46e7e9
Requires(postun): %{_sbindir}/weak-modules
b53785
b53785
b53785
%description
b53785
This driver supports Marvell's SAS/SATA 3Gb/s 88SE64XX and 6Gb/s 88SE94XX
b53785
chip based PCI-E host adapters.
b53785
b53785
b53785
%prep
b53785
%autosetup -p1 -n %{pkg}-%{version}
b53785
b53785
b53785
%build
b53785
pushd src
b53785
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
b53785
popd
b53785
b53785
b53785
%install
b53785
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
b53785
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
b53785
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
b53785
b53785
# Make .ko objects temporarily executable for automatic stripping
b53785
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
b53785
b53785
b53785
%clean
b53785
%{__rm} -rf %{buildroot}
b53785
b53785
b53785
%post
b53785
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
46e7e9
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg}/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
b53785
b53785
b53785
%preun
b53785
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
46e7e9
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
b53785
b53785
b53785
%postun
46e7e9
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
b53785
then
46e7e9
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
46e7e9
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
b53785
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
46e7e9
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
b53785
fi
b53785
b53785
46e7e9
%pretrans -p <lua>
46e7e9
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
46e7e9
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
46e7e9
46e7e9
b53785
%posttrans
46e7e9
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
b53785
then
46e7e9
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
46e7e9
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
b53785
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
46e7e9
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
b53785
fi
b53785
b53785
b53785
%files
b53785
%defattr(644,root,root,755)
b53785
/lib/modules/%{kernel_version}.%{_arch}
b53785
%license COPYING
b53785
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
b53785
b53785
b53785
%changelog
946125
* Tue Nov 09 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-6
946125
- Rebuild for 4.18.0-348.el8
946125
46e7e9
* Tue Sep 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-5
46e7e9
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8_4)
46e7e9
81ceb2
* Wed Sep 15 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-4
81ceb2
- Rebuild for 4.18.0-305.19.1.el8_4
81ceb2
71a3df
* Thu Sep  9 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-3
71a3df
- Set specific kernel version to use
71a3df
- Add Provides kernel-modules
71a3df
- Add .%{_arch} to kernel-modules provides version
71a3df
- Rebuild for 4.18.0-305.17.1.el8_4
71a3df
e7e5a4
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-2
e7e5a4
- Rebuild for 4.18.0-305.12.1.el8_4
e7e5a4
b53785
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-1
b53785
- Initial version