Blame SPECS/kmod-sata_nv.spec

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