Blame SPECS/kmod-sata_uli.spec

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