Blame SPECS/kmod-pata_jmicron.spec

57c8f7
%global pkg pata_jmicron
57c8f7
Kmods SIG 0f19c3
%global driver_version 4.18.0-80.el8
Kmods SIG 0f19c3
Kmods SIG 0f19c3
%global kernel_version 4.18.0-348.el8
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}
Kmods SIG 0f19c3
Version:          4.18.0.80
Kmods SIG 0f19c3
Release:          1%{?dist}
57c8f7
Summary:          JMicron PATA Controller (%{pkg}) driver
57c8f7
57c8f7
License:          GPLv2
57c8f7
URL:              https://www.kernel.org/
57c8f7
Kmods SIG 0f19c3
Source0:          %{pkg}-%{driver_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
Kmods SIG 0f19c3
%autosetup -p1 -n %{pkg}-%{driver_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}
bdd06f
%license LICENSES
57c8f7
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
57c8f7
57c8f7
57c8f7
%changelog
Kmods SIG 0f19c3
* Wed Jan 12 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.80-1
Kmods SIG 0f19c3
- Switch to EL kernel source and versioning
Kmods SIG 0f19c3
- kABI tracking kmod package (kernel >= 4.18.0-348.el8)