Blame SPECS/kmod-sata_mv.spec

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