Blame SPECS/kmod-sata_via.spec

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