Blame SPECS/kmod-hpsa.spec

34d075
%global pkg hpsa
34d075
34d075
%global kernel_version_min 4.18.0-305.el8
34d075
34d075
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
34d075
# Otherwise the latest installed kernel-devel version later than
34d075
# %%{kernel_version_min} will be used.
34d075
34d075
%global kernel_version_latest %({ echo %{kernel_version_min}; rpm --query kernel-devel --queryformat '%%{VERSION}-%%{RELEASE}\\\n' | grep -v "package kernel-devel is not installed"; } | sort -V | sed -e '0,/^%{kernel_version_min}$/d' | tail -n 1)
34d075
34d075
%if "%{kernel_version_latest}" != ""
34d075
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
34d075
%endif
34d075
34d075
%global _use_internal_dependency_generator 0
c0a486
%global __find_requires %{nil}
5c1d49
%global __find_provides /usr/lib/rpm/find-provides
34d075
34d075
%global debug_package %{nil}
34d075
34d075
%global __spec_install_post \
34d075
  %{?__debug_package:%{__debug_install_post}} \
34d075
  %{__arch_install_post} \
34d075
  %{__os_install_post} \
34d075
  %{__mod_compress_install_post}
34d075
34d075
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
34d075
34d075
34d075
Name:             kmod-%{pkg}
34d075
Version:          4.18.0
4f95a5
Release:          326%{?dist}
34d075
Summary:          HP Smart Array Controller (%{pkg}) driver
34d075
34d075
License:          GPLv2
34d075
URL:              https://www.kernel.org/
34d075
34d075
Source0:          %{pkg}-%{kernel_version_min}.tar.xz
34d075
Patch1:           0001-add-deprecated-ids.patch
34d075
34d075
ExclusiveArch:    x86_64 aarch64
34d075
34d075
BuildRequires:    elfutils-libelf-devel
34d075
BuildRequires:    gcc
34d075
BuildRequires:    kmod
34d075
BuildRequires:    make
34d075
BuildRequires:    redhat-rpm-config
34d075
BuildRequires:    xz
34d075
34d075
%{!?kernel_version:
34d075
BuildRequires:    kernel-devel >= %{kernel_version_min}
34d075
}
34d075
34d075
%{?kernel_version:
34d075
BuildRequires:    kernel-devel = %{kernel_version}
8891ce
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
34d075
699021
Requires:         kernel-core = %{kernel_version}
8891ce
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
35c16a
Requires:         kernel-modules = %{kernel_version}
8891ce
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
34d075
ad4ffb
Provides:         installonlypkg(kernel-module)
34d075
}
34d075
34d075
Requires(post):   /usr/sbin/depmod
34d075
Requires(postun): /usr/sbin/depmod
34d075
34d075
34d075
%description
34d075
This package provides the HP Smart Array Controller (%{pkg}) driver.  Compared
34d075
to the in-kernel driver this driver re-enables support for deprecated adapters
34d075
originally used with the old cciss driver.
34d075
34d075
- 0x0E11:*:*:*:01:04: Compaq
34d075
- 0x103C:*:*:*:01:04: HP
34d075
34d075
34d075
%prep
34d075
%autosetup -p1 -n %{pkg}-%{kernel_version_min}
34d075
34d075
34d075
%build
34d075
pushd src
34d075
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
34d075
popd
34d075
34d075
34d075
%install
34d075
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi src/%{pkg}.ko
34d075
34d075
# Make .ko objects temporarily executable for automatic stripping
34d075
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
34d075
34d075
34d075
%clean
34d075
%{__rm} -rf %{buildroot}
34d075
34d075
34d075
%post
708e63
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
708e63
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
708e63
708e63
708e63
%preun
708e63
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
708e63
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
34d075
34d075
34d075
%postun
708e63
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
708e63
then
708e63
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
708e63
    then
708e63
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
708e63
    fi
708e63
708e63
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
708e63
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
708e63
fi
708e63
708e63
708e63
%posttrans
708e63
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
708e63
then
708e63
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
708e63
    then
708e63
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
708e63
    fi
708e63
708e63
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
708e63
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
708e63
fi
34d075
34d075
34d075
%files
34d075
%defattr(644,root,root,755)
34d075
/lib/modules/%{kernel_version}.%{_arch}
34d075
%license COPYING
34d075
34d075
34d075
%changelog
4f95a5
* Thu Jul 29 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-326
4f95a5
- Rebuild for 4.18.0-326.el8
4f95a5
34d075
* Fri Jul 23 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-305
34d075
- Initial version