Blame SPECS/kmod-sata_sil24.spec

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