Blame SPECS/kmod-pata_jmicron.spec

31b0a7
%global pkg pata_jmicron
31b0a7
Kmods SIG d59bde
%global driver_version 4.18.0-80.el8
Kmods SIG d59bde
Kmods SIG 20520d
%global kernel_version 4.18.0-358.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}
Kmods SIG d59bde
Version:          4.18.0.80
7de08d
Release:          3%{?dist}
31b0a7
Summary:          JMicron PATA Controller (%{pkg}) driver
31b0a7
31b0a7
License:          GPLv2
31b0a7
URL:              https://www.kernel.org/
31b0a7
Kmods SIG d59bde
Source0:          %{pkg}-%{driver_version}.tar.xz
31b0a7
7de08d
ExclusiveArch:    x86_64 ppc64le
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
Kmods SIG d59bde
%autosetup -p1 -n %{pkg}-%{driver_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}
06843a
%license LICENSES
31b0a7
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
31b0a7
31b0a7
31b0a7
%changelog
7de08d
* Sat Jan 22 2022 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.80-3
7de08d
- Enable ppc64le
7de08d
Kmods SIG 20520d
* Mon Jan 17 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.80-2
Kmods SIG 20520d
- Rebuild for 4.18.0-358.el8
Kmods SIG 20520d
Kmods SIG d59bde
* Wed Jan 12 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.80-1
Kmods SIG d59bde
- Switch to EL kernel source and versioning
Kmods SIG d59bde
- kABI tracking kmod package (kernel >= 4.18.0-348.el8)