Blame SPECS/kmod-pata_atiixp.spec

439b75
%global pkg pata_atiixp
439b75
36b1de
%global kernel_version 4.18.0-305.7.1.el8_4
439b75
439b75
%global _use_internal_dependency_generator 0
36b1de
%global __find_requires /usr/lib/rpm/redhat/find-requires
36b1de
%global __find_provides /usr/lib/rpm/redhat/find-provides
439b75
439b75
%global debug_package %{nil}
439b75
439b75
%global __spec_install_post \
439b75
  %{?__debug_package:%{__debug_install_post}} \
439b75
  %{__arch_install_post} \
439b75
  %{__os_install_post} \
439b75
  %{__mod_compress_install_post}
439b75
439b75
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
439b75
439b75
439b75
Name:             kmod-%{pkg}
439b75
Version:          5.13
36b1de
Release:          5%{?dist}
439b75
Summary:          ATI PATA Controller (%{pkg}) driver
439b75
439b75
License:          GPLv2
439b75
URL:              https://www.kernel.org/
439b75
439b75
Source0:          %{pkg}-%{version}.tar.xz
439b75
439b75
ExclusiveArch:    x86_64
439b75
439b75
BuildRequires:    elfutils-libelf-devel
439b75
BuildRequires:    gcc
36b1de
BuildRequires:    kernel-rpm-macros
439b75
BuildRequires:    kmod
439b75
BuildRequires:    make
439b75
BuildRequires:    redhat-rpm-config
439b75
BuildRequires:    xz
439b75
36b1de
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
439b75
BuildRequires:    kernel-devel = %{kernel_version}
439b75
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
439b75
36b1de
Requires:         kernel >= %{kernel_version}
36b1de
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
36b1de
Requires:         kernel-modules >= %{kernel_version}
36b1de
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
439b75
439b75
Provides:         installonlypkg(kernel-module)
36b1de
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
439b75
36b1de
Requires(post):   %{_sbindir}/depmod
36b1de
Requires(postun): %{_sbindir}/depmod
439b75
36b1de
Requires(post):   %{_sbindir}/weak-modules
36b1de
Requires(postun): %{_sbindir}/weak-modules
439b75
439b75
439b75
%description
439b75
This driver supports ATI PATA interfaces found on many ATI chipsets.
439b75
439b75
439b75
%prep
439b75
%autosetup -p1 -n %{pkg}-%{version}
439b75
439b75
439b75
%build
439b75
pushd src
439b75
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
439b75
popd
439b75
439b75
439b75
%install
439b75
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata src/%{pkg}.ko
439b75
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
439b75
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
439b75
439b75
# Make .ko objects temporarily executable for automatic stripping
439b75
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
439b75
439b75
439b75
%clean
439b75
%{__rm} -rf %{buildroot}
439b75
439b75
439b75
%post
439b75
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
36b1de
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
439b75
439b75
439b75
%preun
439b75
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
36b1de
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
439b75
439b75
439b75
%postun
36b1de
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
439b75
then
36b1de
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
36b1de
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
439b75
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
36b1de
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
439b75
fi
439b75
439b75
36b1de
%pretrans -p <lua>
36b1de
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
36b1de
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
36b1de
36b1de
439b75
%posttrans
36b1de
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
439b75
then
36b1de
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
36b1de
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
439b75
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
36b1de
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
439b75
fi
439b75
439b75
439b75
%files
439b75
%defattr(644,root,root,755)
439b75
/lib/modules/%{kernel_version}.%{_arch}
439b75
%license COPYING
439b75
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
439b75
439b75
439b75
%changelog
36b1de
* Tue Sep 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.13-5
36b1de
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8_4)