Blame SPECS/kmod-mvsas.spec

c1f630
%global pkg mvsas
c1f630
Kmods SIG 036db7
%global driver_version 4.18.0-80.el8
Kmods SIG 036db7
Kmods SIG 036db7
%global kernel_version 4.18.0-348.el8
c1f630
c1f630
%global _use_internal_dependency_generator 0
73d6c6
%global __find_requires /usr/lib/rpm/redhat/find-requires
73d6c6
%global __find_provides /usr/lib/rpm/redhat/find-provides
c1f630
c1f630
%global debug_package %{nil}
c1f630
c1f630
%global __spec_install_post \
c1f630
  %{?__debug_package:%{__debug_install_post}} \
c1f630
  %{__arch_install_post} \
c1f630
  %{__os_install_post} \
c1f630
  %{__mod_compress_install_post}
c1f630
c1f630
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
c1f630
c1f630
c1f630
Name:             kmod-%{pkg}
Kmods SIG 036db7
Version:          4.18.0.80
Kmods SIG 036db7
Release:          1%{?dist}
c1f630
Summary:          Marvell 88SE64XX/88SE94XX SAS/SATA Controller (%{pkg}) driver
c1f630
c1f630
License:          GPLv2
c1f630
URL:              https://www.kernel.org/
c1f630
Kmods SIG 036db7
Source0:          %{pkg}-%{driver_version}.tar.xz
Kmods SIG 036db7
Patch9999:        9999-enable-mvsas.patch
c1f630
c1f630
ExclusiveArch:    x86_64 aarch64
c1f630
c1f630
BuildRequires:    elfutils-libelf-devel
c1f630
BuildRequires:    gcc
73d6c6
BuildRequires:    kernel-rpm-macros
c1f630
BuildRequires:    kmod
c1f630
BuildRequires:    make
c1f630
BuildRequires:    redhat-rpm-config
c1f630
BuildRequires:    xz
c1f630
73d6c6
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
c1f630
BuildRequires:    kernel-devel = %{kernel_version}
c1f630
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
c1f630
73d6c6
Requires:         kernel >= %{kernel_version}
73d6c6
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
73d6c6
Requires:         kernel-modules >= %{kernel_version}
73d6c6
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
c1f630
c1f630
Provides:         installonlypkg(kernel-module)
73d6c6
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
c1f630
73d6c6
Requires(post):   %{_sbindir}/depmod
73d6c6
Requires(postun): %{_sbindir}/depmod
c1f630
73d6c6
Requires(post):   %{_sbindir}/weak-modules
73d6c6
Requires(postun): %{_sbindir}/weak-modules
c1f630
c1f630
c1f630
%description
c1f630
This driver supports Marvell's SAS/SATA 3Gb/s 88SE64XX and 6Gb/s 88SE94XX
c1f630
chip based PCI-E host adapters.
c1f630
c1f630
c1f630
%prep
Kmods SIG 036db7
%autosetup -p1 -n %{pkg}-%{driver_version}
c1f630
c1f630
c1f630
%build
c1f630
pushd src
c1f630
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
c1f630
popd
c1f630
c1f630
c1f630
%install
c1f630
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
c1f630
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
c1f630
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
c1f630
c1f630
# Make .ko objects temporarily executable for automatic stripping
c1f630
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
c1f630
c1f630
c1f630
%clean
c1f630
%{__rm} -rf %{buildroot}
c1f630
c1f630
c1f630
%post
c1f630
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
73d6c6
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg}/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
c1f630
c1f630
c1f630
%preun
c1f630
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
73d6c6
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
c1f630
c1f630
c1f630
%postun
73d6c6
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
c1f630
then
73d6c6
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
73d6c6
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
c1f630
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
73d6c6
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
c1f630
fi
c1f630
c1f630
73d6c6
%pretrans -p <lua>
73d6c6
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
73d6c6
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
73d6c6
73d6c6
c1f630
%posttrans
73d6c6
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
c1f630
then
73d6c6
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
73d6c6
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
c1f630
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
73d6c6
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
c1f630
fi
c1f630
c1f630
c1f630
%files
c1f630
%defattr(644,root,root,755)
c1f630
/lib/modules/%{kernel_version}.%{_arch}
c1f630
%license COPYING
c1f630
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
c1f630
c1f630
c1f630
%changelog
Kmods SIG 036db7
* Wed Jan 12 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.80-1
Kmods SIG 036db7
- Switch to EL kernel source and versioning
Kmods SIG 036db7
- kABI tracking kmod package (kernel >= 4.18.0-348.el8)