Blame SPECS/kmod-pata_jmicron.spec

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