Blame SPECS/kmod-isci.spec

c530b6
%global pkg isci
c530b6
f89e7b
%global kernel_version 4.18.0-305.7.1.el8_4
c530b6
c530b6
%global _use_internal_dependency_generator 0
f89e7b
%global __find_requires /usr/lib/rpm/redhat/find-requires
f89e7b
%global __find_provides /usr/lib/rpm/redhat/find-provides
c530b6
c530b6
%global debug_package %{nil}
c530b6
c530b6
%global __spec_install_post \
c530b6
  %{?__debug_package:%{__debug_install_post}} \
c530b6
  %{__arch_install_post} \
c530b6
  %{__os_install_post} \
c530b6
  %{__mod_compress_install_post}
c530b6
c530b6
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
c530b6
c530b6
c530b6
Name:             kmod-%{pkg}
c530b6
Version:          5.0
f89e7b
Release:          6%{?dist}
c530b6
Summary:          Intel(R) C600 Series Chipset SAS Controller (%{pkg}) driver
c530b6
c530b6
License:          GPLv2 and (BSD or GPLv2)
c530b6
URL:              https://www.kernel.org/
c530b6
c530b6
Source0:          %{pkg}-%{version}.tar.xz
c530b6
c530b6
ExclusiveArch:    x86_64
c530b6
c530b6
BuildRequires:    elfutils-libelf-devel
c530b6
BuildRequires:    gcc
f89e7b
BuildRequires:    kernel-rpm-macros
c530b6
BuildRequires:    kmod
c530b6
BuildRequires:    make
c530b6
BuildRequires:    redhat-rpm-config
c530b6
BuildRequires:    xz
c530b6
f89e7b
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
c530b6
BuildRequires:    kernel-devel = %{kernel_version}
c530b6
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
c530b6
f89e7b
Requires:         kernel >= %{kernel_version}
f89e7b
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
f89e7b
Requires:         kernel-modules >= %{kernel_version}
f89e7b
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
c530b6
c530b6
Provides:         installonlypkg(kernel-module)
f89e7b
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
c530b6
f89e7b
Requires(post):   %{_sbindir}/depmod
f89e7b
Requires(postun): %{_sbindir}/depmod
c530b6
f89e7b
Requires(post):   %{_sbindir}/weak-modules
f89e7b
Requires(postun): %{_sbindir}/weak-modules
c530b6
c530b6
c530b6
%description
c530b6
This driver supports the 6Gb/s SAS capabilities of the storage control unit
c530b6
found in the Intel(R) C600 series chipset. Supported devices:
c530b6
c530b6
- 0x8086:0x1D60
c530b6
- 0x8086:0x1D61
c530b6
- 0x8086:0x1D62
c530b6
- 0x8086:0x1D63
c530b6
- 0x8086:0x1D64
c530b6
- 0x8086:0x1D65
c530b6
- 0x8086:0x1D66
c530b6
- 0x8086:0x1D67
c530b6
- 0x8086:0x1D68
c530b6
- 0x8086:0x1D69
c530b6
- 0x8086:0x1D6A
c530b6
- 0x8086:0x1D6B
c530b6
c530b6
c530b6
%prep
c530b6
%autosetup -p1 -n %{pkg}-%{version}
c530b6
c530b6
c530b6
%build
c530b6
pushd src
c530b6
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
c530b6
popd
c530b6
c530b6
c530b6
%install
c530b6
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
c530b6
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
c530b6
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
c530b6
c530b6
# Make .ko objects temporarily executable for automatic stripping
c530b6
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
c530b6
c530b6
c530b6
%clean
c530b6
%{__rm} -rf %{buildroot}
c530b6
c530b6
c530b6
%post
c530b6
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
f89e7b
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg}/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
c530b6
c530b6
c530b6
%preun
c530b6
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
f89e7b
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
c530b6
c530b6
c530b6
%postun
f89e7b
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
c530b6
then
f89e7b
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
f89e7b
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
c530b6
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
f89e7b
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
c530b6
fi
c530b6
c530b6
f89e7b
%pretrans -p <lua>
f89e7b
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
f89e7b
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
f89e7b
f89e7b
c530b6
%posttrans
f89e7b
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
c530b6
then
f89e7b
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
f89e7b
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
c530b6
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
f89e7b
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
c530b6
fi
c530b6
c530b6
c530b6
%files
c530b6
%defattr(644,root,root,755)
c530b6
/lib/modules/%{kernel_version}.%{_arch}
c530b6
%license COPYING
c530b6
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
c530b6
c530b6
c530b6
%changelog
f89e7b
* Tue Sep 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.0-6
f89e7b
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8_4)