Blame SPECS/kmod-jme.spec

9bd370
%global pkg jme
9bd370
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}
83d574
Version:          5.6
f1afea
Release:          3%{?dist}
9bd370
Summary:          JMicron JMC2x0 PCI-E Gigabit Ethernet (%{pkg}) driver
9bd370
9bd370
License:          GPLv2
9bd370
URL:              https://www.kernel.org/
9bd370
9bd370
Source0:          %{pkg}-%{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
9bd370
%autosetup -p1 -n %{pkg}-%{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}
9bd370
%license COPYING
9bd370
9bd370
9bd370
%changelog
f1afea
* Tue Nov 09 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.6-3
f1afea
- Rebuild for 4.18.0-348.el8
f1afea
ed9aaf
* Tue Sep 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.6-2
ed9aaf
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8_4)
ed9aaf
83d574
* Wed Sep 22 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.6-1
83d574
- Update to v5.6 (09a46c7260b9)
83d574
b13e04
* Wed Sep 15 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.2-4
b13e04
- Rebuild for 4.18.0-305.19.1.el8_4
b13e04
23013a
* Thu Sep  9 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.2-3
23013a
- Set specific kernel version to use
23013a
- Add Provides kernel-modules
23013a
- Add .%{_arch} to kernel-modules provides version
23013a
- Rebuild for 4.18.0-305.17.1.el8_4
23013a
4955dd
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.2-2
4955dd
- Rebuild for 4.18.0-305.12.1.el8_4
4955dd
9bd370
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.2-1
9bd370
- Initial version