Blame SPECS/kmod-sata_sil.spec

4edac3
%global pkg sata_sil
4edac3
Kmods SIG c0802d
%global kernel_version 4.18.0-358.el8
4edac3
4edac3
%global _use_internal_dependency_generator 0
f932c0
%global __find_requires /usr/lib/rpm/redhat/find-requires
f932c0
%global __find_provides /usr/lib/rpm/redhat/find-provides
4edac3
4edac3
%global debug_package %{nil}
4edac3
4edac3
%global __spec_install_post \
4edac3
  %{?__debug_package:%{__debug_install_post}} \
4edac3
  %{__arch_install_post} \
4edac3
  %{__os_install_post} \
4edac3
  %{__mod_compress_install_post}
4edac3
4edac3
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
4edac3
4edac3
4edac3
Name:             kmod-%{pkg}
4edac3
Version:          5.4
Kmods SIG c0802d
Release:          6%{?dist}
4edac3
Summary:          Silicon Image SATA Controller (%{pkg}) driver
4edac3
4edac3
License:          GPLv2
4edac3
URL:              https://www.kernel.org/
4edac3
4edac3
Source0:          %{pkg}-%{version}.tar.xz
4edac3
4edac3
ExclusiveArch:    x86_64
4edac3
4edac3
BuildRequires:    elfutils-libelf-devel
4edac3
BuildRequires:    gcc
f932c0
BuildRequires:    kernel-rpm-macros
4edac3
BuildRequires:    kmod
4edac3
BuildRequires:    make
4edac3
BuildRequires:    redhat-rpm-config
4edac3
BuildRequires:    xz
4edac3
f932c0
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
4edac3
BuildRequires:    kernel-devel = %{kernel_version}
4edac3
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
4edac3
f932c0
Requires:         kernel >= %{kernel_version}
f932c0
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
f932c0
Requires:         kernel-modules >= %{kernel_version}
f932c0
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
4edac3
4edac3
Provides:         installonlypkg(kernel-module)
f932c0
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
4edac3
f932c0
Requires(post):   %{_sbindir}/depmod
f932c0
Requires(postun): %{_sbindir}/depmod
4edac3
f932c0
Requires(post):   %{_sbindir}/weak-modules
f932c0
Requires(postun): %{_sbindir}/weak-modules
4edac3
4edac3
4edac3
%description
4edac3
This driver supports Silicon Image SATA controllers.
4edac3
4edac3
4edac3
%prep
4edac3
%autosetup -p1 -n %{pkg}-%{version}
4edac3
4edac3
4edac3
%build
4edac3
pushd src
4edac3
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
4edac3
popd
4edac3
4edac3
4edac3
%install
4edac3
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata src/%{pkg}.ko
4edac3
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
4edac3
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
4edac3
4edac3
# Make .ko objects temporarily executable for automatic stripping
4edac3
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
4edac3
4edac3
4edac3
%clean
4edac3
%{__rm} -rf %{buildroot}
4edac3
4edac3
4edac3
%post
4edac3
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
f932c0
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
4edac3
4edac3
4edac3
%preun
4edac3
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
f932c0
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
4edac3
4edac3
4edac3
%postun
f932c0
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
4edac3
then
f932c0
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
f932c0
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
4edac3
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
f932c0
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
4edac3
fi
4edac3
4edac3
f932c0
%pretrans -p <lua>
f932c0
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
f932c0
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
f932c0
f932c0
4edac3
%posttrans
f932c0
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
4edac3
then
f932c0
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
f932c0
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
4edac3
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
f932c0
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
4edac3
fi
4edac3
4edac3
4edac3
%files
4edac3
%defattr(644,root,root,755)
4edac3
/lib/modules/%{kernel_version}.%{_arch}
4edac3
%license COPYING
4edac3
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
4edac3
4edac3
4edac3
%changelog
Kmods SIG c0802d
* Mon Jan 10 2022 Kmods SIG <sig-kmods@centosproject.org> - 5.4-6
Kmods SIG c0802d
- Rebuild for 4.18.0-358.el8
Kmods SIG c0802d
f932c0
* Tue Sep 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.4-5
f932c0
- Convert to kABI tracking kmod package (kernel >= 4.18.0-315.el8)