Blame SPECS/kmod-sata_sil24.spec

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