Blame SPECS/kmod-sata_via.spec

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