Blame SPECS/kmod-arcmsr.spec

e38a59
%global pkg arcmsr
e38a59
66f715
%global kernel_version 4.18.0-348.el8
e38a59
e38a59
%global _use_internal_dependency_generator 0
872193
%global __find_requires /usr/lib/rpm/redhat/find-requires
872193
%global __find_provides /usr/lib/rpm/redhat/find-provides
e38a59
e38a59
%global debug_package %{nil}
e38a59
e38a59
%global __spec_install_post \
e38a59
  %{?__debug_package:%{__debug_install_post}} \
e38a59
  %{__arch_install_post} \
e38a59
  %{__os_install_post} \
e38a59
  %{__mod_compress_install_post}
e38a59
e38a59
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
e38a59
e38a59
e38a59
Name:             kmod-%{pkg}
e38a59
Version:          4.19
66f715
Release:          6%{?dist}
e38a59
Summary:          ARECA ARC11xx/12xx/13xx/16xx SATA/SAS RAID Controller (%{pkg}) driver
e38a59
e38a59
License:          GPLv2
e38a59
URL:              https://www.kernel.org/
e38a59
e38a59
Source0:          %{pkg}-%{version}.tar.xz
e38a59
e38a59
ExclusiveArch:    x86_64 aarch64
e38a59
e38a59
BuildRequires:    elfutils-libelf-devel
e38a59
BuildRequires:    gcc
872193
BuildRequires:    kernel-rpm-macros
e38a59
BuildRequires:    kmod
e38a59
BuildRequires:    make
e38a59
BuildRequires:    redhat-rpm-config
e38a59
BuildRequires:    xz
e38a59
872193
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
e38a59
BuildRequires:    kernel-devel = %{kernel_version}
e38a59
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
e38a59
872193
Requires:         kernel >= %{kernel_version}
872193
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
872193
Requires:         kernel-modules >= %{kernel_version}
872193
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
e38a59
e38a59
Provides:         installonlypkg(kernel-module)
872193
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
e38a59
872193
Requires(post):   %{_sbindir}/depmod
872193
Requires(postun): %{_sbindir}/depmod
e38a59
872193
Requires(post):   %{_sbindir}/weak-modules
872193
Requires(postun): %{_sbindir}/weak-modules
e38a59
e38a59
e38a59
%description
e38a59
This driver supports ARECA's SATA/SAS RAID controller cards.
e38a59
e38a59
e38a59
%prep
e38a59
%autosetup -p1 -n %{pkg}-%{version}
e38a59
e38a59
e38a59
%build
e38a59
pushd src
e38a59
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
e38a59
popd
e38a59
e38a59
e38a59
%install
e38a59
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
e38a59
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
e38a59
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
e38a59
e38a59
# Make .ko objects temporarily executable for automatic stripping
e38a59
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
e38a59
e38a59
e38a59
%clean
e38a59
%{__rm} -rf %{buildroot}
e38a59
e38a59
e38a59
%post
e38a59
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
872193
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg}/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
e38a59
e38a59
e38a59
%preun
e38a59
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
872193
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
e38a59
e38a59
e38a59
%postun
872193
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
e38a59
then
872193
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
872193
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
e38a59
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
872193
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
e38a59
fi
e38a59
e38a59
872193
%pretrans -p <lua>
872193
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
872193
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
872193
872193
e38a59
%posttrans
872193
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
e38a59
then
872193
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
872193
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
e38a59
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
872193
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
e38a59
fi
e38a59
e38a59
e38a59
%files
e38a59
%defattr(644,root,root,755)
e38a59
/lib/modules/%{kernel_version}.%{_arch}
e38a59
%license COPYING
e38a59
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
e38a59
e38a59
e38a59
%changelog
66f715
* Tue Nov 09 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-6
66f715
- Rebuild for 4.18.0-348.el8
66f715
872193
* Tue Sep 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-5
872193
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8_4)