Blame SPECS/kmod-arcmsr.spec

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