Blame SPECS/kmod-pata_amd.spec

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