Blame SPECS/kmod-pata_sis.spec

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