Blame SPECS/kmod-pata_atiixp.spec

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