Blame SPECS/kmod-hpsa.spec

add12b
%global pkg hpsa
add12b
f2fe4b
%global driver_version 4.18.0-305.el8
add12b
4f3959
%global kernel_version 4.18.0-348.el8
add12b
add12b
%global _use_internal_dependency_generator 0
28b419
%global __find_requires /usr/lib/rpm/redhat/find-requires
28b419
%global __find_provides /usr/lib/rpm/redhat/find-provides
add12b
add12b
%global debug_package %{nil}
add12b
add12b
%global __spec_install_post \
add12b
  %{?__debug_package:%{__debug_install_post}} \
add12b
  %{__arch_install_post} \
add12b
  %{__os_install_post} \
add12b
  %{__mod_compress_install_post}
add12b
add12b
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
add12b
add12b
add12b
Name:             kmod-%{pkg}
28b419
Version:          4.18.0.305
4f3959
Release:          2%{?dist}
add12b
Summary:          HP Smart Array Controller (%{pkg}) driver
add12b
add12b
License:          GPLv2
add12b
URL:              https://www.kernel.org/
add12b
f2fe4b
Source0:          %{pkg}-%{driver_version}.tar.xz
add12b
Patch1:           0001-add-deprecated-ids.patch
add12b
add12b
ExclusiveArch:    x86_64 aarch64
add12b
add12b
BuildRequires:    elfutils-libelf-devel
add12b
BuildRequires:    gcc
28b419
BuildRequires:    kernel-rpm-macros
add12b
BuildRequires:    kmod
add12b
BuildRequires:    make
add12b
BuildRequires:    redhat-rpm-config
add12b
BuildRequires:    xz
add12b
28b419
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
add12b
BuildRequires:    kernel-devel = %{kernel_version}
add12b
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
add12b
28b419
Requires:         kernel >= %{kernel_version}
28b419
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
28b419
Requires:         kernel-modules >= %{kernel_version}
28b419
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
add12b
add12b
Provides:         installonlypkg(kernel-module)
28b419
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
add12b
28b419
Requires(post):   %{_sbindir}/depmod
28b419
Requires(postun): %{_sbindir}/depmod
add12b
28b419
Requires(post):   %{_sbindir}/weak-modules
28b419
Requires(postun): %{_sbindir}/weak-modules
add12b
add12b
add12b
%description
add12b
This package provides the HP Smart Array Controller (%{pkg}) driver.  Compared
add12b
to the in-kernel driver this driver re-enables support for deprecated adapters
add12b
originally used with the old cciss driver.
add12b
add12b
- 0x0E11:*:*:*:01:04: Compaq
add12b
- 0x103C:*:*:*:01:04: HP
add12b
add12b
add12b
%prep
f2fe4b
%autosetup -p1 -n %{pkg}-%{driver_version}
add12b
add12b
add12b
%build
add12b
pushd src
add12b
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
add12b
popd
add12b
add12b
add12b
%install
add12b
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi src/%{pkg}.ko
add12b
add12b
# Make .ko objects temporarily executable for automatic stripping
add12b
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
add12b
28b419
# Generate depmod.conf
28b419
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
28b419
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
28b419
do
28b419
    echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
28b419
done
28b419
add12b
add12b
%clean
add12b
%{__rm} -rf %{buildroot}
add12b
add12b
add12b
%post
add12b
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
28b419
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
add12b
add12b
add12b
%preun
add12b
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
28b419
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
add12b
add12b
add12b
%postun
28b419
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
add12b
then
28b419
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
28b419
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
add12b
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
28b419
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
add12b
fi
add12b
add12b
28b419
%pretrans -p <lua>
28b419
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
28b419
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
28b419
28b419
add12b
%posttrans
28b419
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
add12b
then
28b419
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
28b419
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
add12b
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
28b419
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
add12b
fi
add12b
add12b
add12b
%files
add12b
%defattr(644,root,root,755)
add12b
/lib/modules/%{kernel_version}.%{_arch}
add12b
%license COPYING
28b419
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
add12b
add12b
add12b
%changelog
4f3959
* Tue Nov 09 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.305-2
4f3959
- Rebuild for 4.18.0-348.el8
4f3959
28b419
* Thu Oct 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.305-1
899af7
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8)
899af7
- Build 4.18.0-305.el8 for 4.18.0-305.7.1.el8_4
28b419
- Use release number independent of kernel
28b419
- Add driver release number to version