Blame SPECS/kmod-pata_via.spec

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