Blame SPECS/kmod-sata_uli.spec

cf187c
%global pkg sata_uli
cf187c
Kmods SIG e58f51
%global driver_version 4.18.0-80.el8
Kmods SIG e58f51
Kmods SIG 4091c6
%global kernel_version 4.18.0-358.el8
cf187c
cf187c
%global _use_internal_dependency_generator 0
95317e
%global __find_requires /usr/lib/rpm/redhat/find-requires
95317e
%global __find_provides /usr/lib/rpm/redhat/find-provides
cf187c
cf187c
%global debug_package %{nil}
cf187c
cf187c
%global __spec_install_post \
cf187c
  %{?__debug_package:%{__debug_install_post}} \
cf187c
  %{__arch_install_post} \
cf187c
  %{__os_install_post} \
cf187c
  %{__mod_compress_install_post}
cf187c
cf187c
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
cf187c
cf187c
cf187c
Name:             kmod-%{pkg}
Kmods SIG e58f51
Version:          4.18.0.80
Kmods SIG 4091c6
Release:          2%{?dist}
cf187c
Summary:          ULi Electronics SATA Controller (%{pkg}) driver
cf187c
cf187c
License:          GPLv2
cf187c
URL:              https://www.kernel.org/
cf187c
Kmods SIG e58f51
Source0:          %{pkg}-%{driver_version}.tar.xz
cf187c
cf187c
ExclusiveArch:    x86_64
cf187c
cf187c
BuildRequires:    elfutils-libelf-devel
cf187c
BuildRequires:    gcc
95317e
BuildRequires:    kernel-rpm-macros
cf187c
BuildRequires:    kmod
cf187c
BuildRequires:    make
cf187c
BuildRequires:    redhat-rpm-config
cf187c
BuildRequires:    xz
cf187c
95317e
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
cf187c
BuildRequires:    kernel-devel = %{kernel_version}
cf187c
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
cf187c
95317e
Requires:         kernel >= %{kernel_version}
95317e
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
95317e
Requires:         kernel-modules >= %{kernel_version}
95317e
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
cf187c
cf187c
Provides:         installonlypkg(kernel-module)
95317e
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
cf187c
95317e
Requires(post):   %{_sbindir}/depmod
95317e
Requires(postun): %{_sbindir}/depmod
cf187c
95317e
Requires(post):   %{_sbindir}/weak-modules
95317e
Requires(postun): %{_sbindir}/weak-modules
cf187c
cf187c
cf187c
%description
cf187c
This driver supports ULi Electronics SATA controllers.
cf187c
cf187c
cf187c
%prep
Kmods SIG e58f51
%autosetup -p1 -n %{pkg}-%{driver_version}
cf187c
cf187c
cf187c
%build
cf187c
pushd src
cf187c
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
cf187c
popd
cf187c
cf187c
cf187c
%install
cf187c
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata src/%{pkg}.ko
cf187c
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
cf187c
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
cf187c
cf187c
# Make .ko objects temporarily executable for automatic stripping
cf187c
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
cf187c
cf187c
cf187c
%clean
cf187c
%{__rm} -rf %{buildroot}
cf187c
cf187c
cf187c
%post
cf187c
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
95317e
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
cf187c
cf187c
cf187c
%preun
cf187c
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
95317e
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
cf187c
cf187c
cf187c
%postun
95317e
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
cf187c
then
95317e
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
95317e
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
cf187c
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
95317e
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
cf187c
fi
cf187c
cf187c
95317e
%pretrans -p <lua>
95317e
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
95317e
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
95317e
95317e
cf187c
%posttrans
95317e
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
cf187c
then
95317e
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
95317e
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
cf187c
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
95317e
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
cf187c
fi
cf187c
cf187c
cf187c
%files
cf187c
%defattr(644,root,root,755)
cf187c
/lib/modules/%{kernel_version}.%{_arch}
223158
%license LICENSES
cf187c
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
cf187c
cf187c
cf187c
%changelog
Kmods SIG 4091c6
* Mon Jan 17 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.80-2
Kmods SIG 4091c6
- Rebuild for 4.18.0-358.el8
Kmods SIG 4091c6
Kmods SIG e58f51
* Wed Jan 12 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.80-1
Kmods SIG e58f51
- Switch to EL kernel source and versioning
Kmods SIG e58f51
- kABI tracking kmod package (kernel >= 4.18.0-348.el8)