Blame SPECS/kmod-sata_sis.spec

85d2b5
%global pkg sata_sis
85d2b5
Kmods SIG 2083c2
%global kernel_version 4.18.0-358.el8
85d2b5
85d2b5
%global _use_internal_dependency_generator 0
e7f239
%global __find_requires /usr/lib/rpm/redhat/find-requires
e7f239
%global __find_provides /usr/lib/rpm/redhat/find-provides
85d2b5
85d2b5
%global debug_package %{nil}
85d2b5
85d2b5
%global __spec_install_post \
85d2b5
  %{?__debug_package:%{__debug_install_post}} \
85d2b5
  %{__arch_install_post} \
85d2b5
  %{__os_install_post} \
85d2b5
  %{__mod_compress_install_post}
85d2b5
85d2b5
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
85d2b5
85d2b5
85d2b5
Name:             kmod-%{pkg}
85d2b5
Version:          4.18
Kmods SIG 2083c2
Release:          7%{?dist}
fee39f
Summary:          SiS P/SATA Controller (pata_sis and %{pkg}) driver
85d2b5
85d2b5
License:          GPLv2
85d2b5
URL:              https://www.kernel.org/
85d2b5
85d2b5
Source0:          %{pkg}-%{version}.tar.xz
85d2b5
85d2b5
ExclusiveArch:    x86_64
85d2b5
85d2b5
BuildRequires:    elfutils-libelf-devel
85d2b5
BuildRequires:    gcc
e7f239
BuildRequires:    kernel-rpm-macros
85d2b5
BuildRequires:    kmod
85d2b5
BuildRequires:    make
85d2b5
BuildRequires:    redhat-rpm-config
85d2b5
BuildRequires:    xz
85d2b5
e7f239
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
85d2b5
BuildRequires:    kernel-devel = %{kernel_version}
85d2b5
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
85d2b5
e7f239
Requires:         kernel >= %{kernel_version}
e7f239
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
e7f239
Requires:         kernel-modules >= %{kernel_version}
e7f239
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
85d2b5
85d2b5
Provides:         installonlypkg(kernel-module)
e7f239
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
85d2b5
e7f239
Requires(post):   %{_sbindir}/depmod
e7f239
Requires(postun): %{_sbindir}/depmod
85d2b5
e7f239
Requires(post):   %{_sbindir}/weak-modules
e7f239
Requires(postun): %{_sbindir}/weak-modules
85d2b5
eda587
Provides:         kmod-pata_sis = %{?epoch:%{epoch}:}%{version}-%{release}
eda587
85d2b5
85d2b5
%description
fee39f
This driver supports SiS P/SATA controllers.
85d2b5
85d2b5
85d2b5
%prep
85d2b5
%autosetup -p1 -n %{pkg}-%{version}
85d2b5
85d2b5
85d2b5
%build
85d2b5
pushd src
85d2b5
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
85d2b5
popd
85d2b5
85d2b5
85d2b5
%install
eda587
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata src/%{pkg}.ko src/pata_sis.ko
85d2b5
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
85d2b5
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
eda587
echo "add_drivers+=\" pata_sis \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/pata_sis.conf
85d2b5
85d2b5
# Make .ko objects temporarily executable for automatic stripping
85d2b5
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
85d2b5
85d2b5
85d2b5
%clean
85d2b5
%{__rm} -rf %{buildroot}
85d2b5
85d2b5
85d2b5
%post
85d2b5
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
e7f239
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
eda587
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata/pata_sis.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
85d2b5
85d2b5
85d2b5
%preun
85d2b5
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
e7f239
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
85d2b5
85d2b5
85d2b5
%postun
e7f239
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
85d2b5
then
e7f239
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
e7f239
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
85d2b5
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
e7f239
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
85d2b5
fi
85d2b5
85d2b5
e7f239
%pretrans -p <lua>
e7f239
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
e7f239
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
e7f239
e7f239
85d2b5
%posttrans
e7f239
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
85d2b5
then
e7f239
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
e7f239
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
85d2b5
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
e7f239
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
85d2b5
fi
85d2b5
85d2b5
85d2b5
%files
85d2b5
%defattr(644,root,root,755)
85d2b5
/lib/modules/%{kernel_version}.%{_arch}
85d2b5
%license COPYING
85d2b5
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
eda587
%config(noreplace) %{_sysconfdir}/dracut.conf.d/pata_sis.conf
85d2b5
85d2b5
85d2b5
%changelog
Kmods SIG 2083c2
* Mon Jan 10 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18-7
Kmods SIG 2083c2
- Rebuild for 4.18.0-358.el8
Kmods SIG 2083c2
eda587
* Wed Nov 03 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-6
eda587
- Add contents of package pata_sis
eda587
e7f239
* Tue Sep 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-5
e7f239
- Convert to kABI tracking kmod package (kernel >= 4.18.0-315.el8)