Blob Blame History Raw
%define kpatch_dnf_ver	0.4

Name:		kpatch
Version:	0.9.8
Release:	1.2%{?dist}
Summary:	Dynamic kernel patch manager

Group:		System Environment/Kernel
License:	GPLv2
URL:		https://github.com/dynup/kpatch
Source0:	https://github.com/dynup/kpatch/archive/v%{version}.tar.gz
Source1:	kpatch-dnf-v%{kpatch_dnf_ver}.tar.gz

# RHEL-only
Patch0:		0001-contrib-disable-upstart-kpatch.conf-install.patch
Patch1:		0002-kpatch-clarify-unload-unsupport.patch
Patch2:		0003-do-not-rm-selinux-rpm-owned-directory.patch

# Upstream backports
Patch100:       0100-support-ubsan-for-kpatch.patch
Patch101:       0101-create-diff-object-handle-__initcall_stub-with-CONFI.patch
Patch102:       0102-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch
Patch103:       0103-create-diff-object-compare-section-name-with-kpatch_.patch
Patch104:       0104-kpatch-build-add-support-for-clang-pgo.patch
Patch105:       0105-create-diff-object-ignore-section-.rel.llvm.call-gra.patch
Patch106:       0106-kpatch-build-Run-objtool-on-thinlto-files.patch
Patch107:       0107-kpatch-build-skip-more-symbols-in-locals_match.patch
Patch108:       0108-kpatch-build-Fix-setlocalversion-issue-with-6.3-kern.patch
Patch109:       0109-kpatch-build-ignore-changes-in-.comment-section.patch
Patch110:       0110-kpatch-build-handle-init-version-timestamp.o.patch

# kpatch-dnf backports (inactive -- for future reference)
#Patch200:	0200-foo-bar-etcetera.patch

%description
kpatch is a live kernel patch module manager.  It allows the user to manage
a collection of binary kernel patch modules which can be used to dynamically
patch the kernel without rebooting.

%package -n kpatch-build
Summary:	Build tool for kpatch
BuildRequires:	gcc kernel-devel elfutils elfutils-devel
ExcludeArch:	aarch64

%description -n kpatch-build
kpatch-build is a tool to build patches for kpatch.

%package -n kpatch-runtime
Summary:	Dynamic kernel patch manager
Requires:	bash kmod binutils
Suggests:	kpatch-dnf
Provides:	kpatch = %{version}-%{release}
Obsoletes:	kpatch < 0.9.4-1.6
BuildArch:	noarch

%description -n kpatch-runtime
kpatch is a live kernel patch module manager.  It allows the user to manage
a collection of binary kernel patch modules which can be used to dynamically
patch the kernel without rebooting.

%package -n kpatch-dnf
Summary:	kpatch-patch manager plugin for DNF
Version:	%{version}_%{kpatch_dnf_ver}
BuildRequires:	python3-devel python3-dnf
Requires:	python3-dnf python3-hawkey
Provides:	kpatch-dnf
BuildArch:	noarch

%description -n kpatch-dnf
kpatch-dnf is a DNF plugin that manages subscription to kpatch-patch updates.
When enabled, kernel packages are automatically subscribed to corresponding
kpatch-patch packages updates.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
# Use this to apply upstream patches to kpatch
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1

%setup -D -T -a 1

# Use this to apply patches to kpatch-dnf (inactive)
#cd kpatch-dnf-%{kpatch_dnf_ver}
#%patch200 -p1
#cd ..

%build
make

make -C kpatch-dnf-%{kpatch_dnf_ver}

%install
make install PREFIX=/usr DESTDIR=%{buildroot}
mkdir -p %{buildroot}/%{_sharedstatedir}/kpatch

make install PREFIX=/usr DESTDIR=%{buildroot} PYTHONSITES=%{python3_sitelib} -C kpatch-dnf-%{kpatch_dnf_ver}

%files -n kpatch-build
%{_bindir}/kpatch-build
%{_libexecdir}/%{name}
%{_datadir}/%{name}
%{_mandir}/man1/kpatch-build.1*

%files -n kpatch-runtime
%{_sbindir}/kpatch
%{_usr}/lib/systemd/system/kpatch.service
%{_sharedstatedir}/kpatch
%doc %{_mandir}/man1/kpatch.1.gz

%files -n kpatch-dnf
%{python3_sitelib}/dnf-plugins/kpatch.py
%{python3_sitelib}/dnf-plugins/__pycache__
%config(noreplace) %{_sysconfdir}/dnf/plugins/kpatch.conf
%doc %{_mandir}/man8/dnf.kpatch.8.gz

%post -n kpatch-dnf
echo "To enable automatic kpatch-patch subscription, run:"
echo -e "\t$ dnf kpatch auto"

%changelog
* Fri Oct 27 2023 Davide Cavalca <dcavalca@centosproject.org> - 0.9.8-1.2
- Backport three upstream fixes

* Wed Mar 15 2023 Davide Cavalca <dcavalca@centosproject.org> - 0.9.8-1.1
- Update to 0.9.8
- Refresh clang PGO patches

* Wed Dec 07 2022 Davide Cavalca <dcavalca@centosproject.org> - 0.9.7-2.1
- Merge upstream changes into Hyperscale

* Wed Nov 16 2022 Yannick Cote <ycote@redhat.com> 0.9.7-2
- augment kpatch-dnf package versioning to satisfy build (rhbz#2121212)

* Wed Nov 09 2022 Yannick Cote <ycote@redhat.com> 0.9.7-1
- rebase kpatch user utility code to v0.9.7 (rhbz#2121212)

* Tue Oct 25 2022 Davide Cavalca <dcavalca@centosproject.org> - 0.9.7-1.1
- Update to 0.9.7
- Backport patches for clang PGO

* Fri Jun 10 2022 Yannick Cote <ycote@redhat.com> 0.9.4-3
- Do not rm selinux rpm owned directory (rhbz#2053413)

* Thu Jan 27 2022 Yannick Cote <ycote@redhat.com> 0.9.4-2
- Add /usr/lib/kpatch to install and files list to appease SELinux (rhbz#2030004)

* Wed Sep 29 2021 Artem Savkov <asavkov@redhat.com> - 0.9.4-1
- Rebase to 0.9.4

* Fri Sep 03 2021 Davide Cavalca <dcavalca@centosproject.org> - 0.9.4-1.6
- Sync with c8s-sig-hyperscale
- Update to 0.9.4
- Add kpatch-build arched subpackage
- Add kpatch-runtime noarch subpackage to provide and obsolete kpatch

* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 0.9.3-3
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
  Related: rhbz#1991688

* Thu Jun 10 2021 Joe Lawrence <joe.lawrence@redhat.com> - 0.9.3-2
- Rebase to latest upstream (via backport patch)

* Tue May 18 2021 Joel Savitz <jsavitz@redhat.com> - 0.9.3-1
- Rebase to latest upstream

* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.9.2-5
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937

* Fri Mar 05 2021 Joe Lawrence <joe.lawrence@redhat.com> 0.9.2-4
- Fix kpatch-dnf package description typos (rhbz#1934292)

* Mon Jan 04 2021 Julien Thierry <jthierry@redhat.com> 0.9.2-2
- Remove kpatch-dnf dependency on python3 (rhbz#1912457)

* Wed Dec 2 2020 Joe Lawrence <joe.lawrence@redhat.com> 0.9.2-1
- initial kpatch utility build for rhel-9.0.0 (rhbz#1901593)