Blame SPECS/kmod-sata_sis.spec

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