Blame SPECS/kmod-pata_via.spec

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