Blame SPECS/kmod-pata_amd.spec

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