Blame SPECS/kmod-pata_jmicron.spec

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