Blame SPECS/kmod-jme.spec

9bd370
%global pkg jme
9bd370
Kmods SIG cc9f02
%global driver_version 4.18.0-240.el8
Kmods SIG cc9f02
f1afea
%global kernel_version 4.18.0-348.el8
9bd370
9bd370
%global _use_internal_dependency_generator 0
ed9aaf
%global __find_requires /usr/lib/rpm/redhat/find-requires
ed9aaf
%global __find_provides /usr/lib/rpm/redhat/find-provides
9bd370
9bd370
%global debug_package %{nil}
9bd370
9bd370
%global __spec_install_post \
9bd370
  %{?__debug_package:%{__debug_install_post}} \
9bd370
  %{__arch_install_post} \
9bd370
  %{__os_install_post} \
9bd370
  %{__mod_compress_install_post}
9bd370
9bd370
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
9bd370
9bd370
9bd370
Name:             kmod-%{pkg}
Kmods SIG cc9f02
Version:          4.18.0.240
Kmods SIG cc9f02
Release:          1%{?dist}
9bd370
Summary:          JMicron JMC2x0 PCI-E Gigabit Ethernet (%{pkg}) driver
9bd370
9bd370
License:          GPLv2
9bd370
URL:              https://www.kernel.org/
9bd370
Kmods SIG cc9f02
Source0:          %{pkg}-%{driver_version}.tar.xz
9bd370
9bd370
ExclusiveArch:    x86_64 aarch64
9bd370
9bd370
BuildRequires:    elfutils-libelf-devel
9bd370
BuildRequires:    gcc
ed9aaf
BuildRequires:    kernel-rpm-macros
9bd370
BuildRequires:    kmod
9bd370
BuildRequires:    make
9bd370
BuildRequires:    redhat-rpm-config
9bd370
BuildRequires:    xz
9bd370
ed9aaf
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
9bd370
BuildRequires:    kernel-devel = %{kernel_version}
9bd370
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
9bd370
ed9aaf
Requires:         kernel >= %{kernel_version}
ed9aaf
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
ed9aaf
Requires:         kernel-modules >= %{kernel_version}
ed9aaf
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
9bd370
9bd370
Provides:         installonlypkg(kernel-module)
ed9aaf
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
9bd370
ed9aaf
Requires(post):   %{_sbindir}/depmod
ed9aaf
Requires(postun): %{_sbindir}/depmod
9bd370
ed9aaf
Requires(post):   %{_sbindir}/weak-modules
ed9aaf
Requires(postun): %{_sbindir}/weak-modules
9bd370
9bd370
9bd370
%description
9bd370
This driver supports Gigabit Ethernet adapters based on the JMC2x0 chipsets.
9bd370
9bd370
9bd370
%prep
Kmods SIG cc9f02
%autosetup -p1 -n %{pkg}-%{driver_version}
9bd370
9bd370
9bd370
%build
9bd370
pushd src
9bd370
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
9bd370
popd
9bd370
9bd370
9bd370
%install
9bd370
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet src/%{pkg}.ko
9bd370
9bd370
# Make .ko objects temporarily executable for automatic stripping
9bd370
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
9bd370
9bd370
9bd370
%clean
9bd370
%{__rm} -rf %{buildroot}
9bd370
9bd370
9bd370
%post
9bd370
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
ed9aaf
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
9bd370
9bd370
9bd370
%preun
9bd370
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
ed9aaf
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
9bd370
9bd370
9bd370
%postun
ed9aaf
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
9bd370
then
ed9aaf
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
ed9aaf
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
9bd370
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
ed9aaf
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
9bd370
fi
9bd370
9bd370
ed9aaf
%pretrans -p <lua>
ed9aaf
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
ed9aaf
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
ed9aaf
ed9aaf
9bd370
%posttrans
ed9aaf
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
9bd370
then
ed9aaf
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
ed9aaf
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
9bd370
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
ed9aaf
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
9bd370
fi
9bd370
9bd370
9bd370
%files
9bd370
%defattr(644,root,root,755)
9bd370
/lib/modules/%{kernel_version}.%{_arch}
0b3083
%license LICENSES
9bd370
9bd370
9bd370
%changelog
Kmods SIG cc9f02
* Wed Jan 12 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.240-1
Kmods SIG cc9f02
- Switch to EL kernel source and versioning
Kmods SIG cc9f02
- kABI tracking kmod package (kernel >= 4.18.0-348.el8)