Gentoo Archives: gentoo-commits

From: Stefan Strogin <steils@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-kernel/kpatch/
Date: Tue, 30 Jul 2019 01:13:55
Message-Id: 1564449118.d1ad77934e0f1cea04a344365affb0b644a1251b.steils@gentoo
1 commit: d1ad77934e0f1cea04a344365affb0b644a1251b
2 Author: Stefan Strogin <steils <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 29 02:28:03 2019 +0000
4 Commit: Stefan Strogin <steils <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 30 01:11:58 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d1ad7793
7
8 sys-kernel/kpatch: sync live ebuild
9
10 Package-Manager: Portage-2.3.69, Repoman-2.3.16
11 Signed-off-by: Stefan Strogin <steils <AT> gentoo.org>
12
13 sys-kernel/kpatch/kpatch-9999.ebuild | 78 ++++++++++++++++++++++--------------
14 1 file changed, 48 insertions(+), 30 deletions(-)
15
16 diff --git a/sys-kernel/kpatch/kpatch-9999.ebuild b/sys-kernel/kpatch/kpatch-9999.ebuild
17 index 0d6aa6e706a..dd2b30d0b35 100644
18 --- a/sys-kernel/kpatch/kpatch-9999.ebuild
19 +++ b/sys-kernel/kpatch/kpatch-9999.ebuild
20 @@ -1,9 +1,9 @@
21 -# Copyright 1999-2017 Gentoo Foundation
22 +# Copyright 1999-2019 Gentoo Authors
23 # Distributed under the terms of the GNU General Public License v2
24
25 -EAPI="6"
26 +EAPI=7
27
28 -inherit linux-info linux-mod flag-o-matic
29 +inherit flag-o-matic linux-mod
30
31 if [[ "${PV}" == "9999" ]]; then
32 inherit git-r3
33 @@ -18,45 +18,46 @@ HOMEPAGE="https://github.com/dynup/kpatch"
34
35 LICENSE="GPL-2+"
36 SLOT="0"
37 -IUSE="examples +modules test"
38 +IUSE="contrib +kpatch +kpatch-build kmod test"
39
40 RDEPEND="
41 app-crypt/pesign
42 - dev-libs/openssl:0=
43 sys-libs/zlib
44 sys-apps/pciutils
45 "
46
47 DEPEND="
48 ${RDEPEND}
49 - test? ( dev-util/shellcheck )
50 dev-libs/elfutils
51 sys-devel/bison
52 + test? ( dev-util/shellcheck-bin )
53 "
54
55 -pkg_pretend() {
56 - if kernel_is gt 3 9 0; then
57 - if ! linux_config_exists; then
58 - eerror "Unable to check the currently running kernel for kpatch support"
59 - eerror "Please be sure a .config file is available in the kernel src dir"
60 - eerror "and ensure the kernel has been built."
61 +pkg_setup() {
62 + if use kmod; then
63 + if kernel_is gt 3 9 0; then
64 + if ! linux_config_exists; then
65 + eerror "Unable to check the currently running kernel for kpatch support"
66 + eerror "Please be sure a .config file is available in the kernel src dir"
67 + eerror "and ensure the kernel has been built."
68 + else
69 + # Fail to build if these kernel options are not enabled (see kpatch/kmod/core/Makefile)
70 + CONFIG_CHECK="FUNCTION_TRACER HAVE_FENTRY MODULES SYSFS KALLSYMS_ALL"
71 + ERROR_FUNCTION_TRACER="CONFIG_FUNCTION_TRACER must be enabled in the kernel's config file"
72 + ERROR_HAVE_FENTRY="CONFIG_HAVE_FENTRY must be enabled in the kernel's config file"
73 + ERROR_MODULES="CONFIG_MODULES must be enabled in the kernel's config file"
74 + ERROR_SYSFS="CONFIG_SYSFS must be enabled in the kernel's config file"
75 + ERROR_KALLSYMS_ALL="CONFIG_KALLSYMS_ALL must be enabled in the kernel's config file"
76 + fi
77 else
78 - # Fail to build if these kernel options are not enabled (see kpatch/kmod/core/Makefile)
79 - CONFIG_CHECK="FUNCTION_TRACER HAVE_FENTRY MODULES SYSFS KALLSYMS_ALL"
80 - ERROR_FUNCTION_TRACER="CONFIG_FUNCTION_TRACER must be enabled in the kernel's config file"
81 - ERROR_HAVE_FENTRY="CONFIG_HAVE_FENTRY must be enabled in the kernel's config file"
82 - ERROR_MODULES="CONFIG_MODULES must be enabled in the kernel's config file"
83 - ERROR_SYSFS="CONFIG_SYSFS must be enabled in the kernel's config file"
84 - ERROR_KALLSYMS_ALL="CONFIG_KALLSYMS_ALL must be enabled in the kernel's config file"
85 + eerror
86 + eerror "kpatch is not available for Linux kernels below 4.0.0"
87 + eerror
88 + die "Upgrade the kernel sources before installing kpatch."
89 fi
90 - else
91 - eerror
92 - eerror "kpatch is not available for Linux kernels below 4.0.0"
93 - eerror
94 - die "Upgrade the kernel sources before installing kpatch."
95 + check_extra_config
96 fi
97
98 - check_extra_config
99 }
100
101 src_prepare() {
102 @@ -65,13 +66,30 @@ src_prepare() {
103 }
104
105 src_compile() {
106 - set_arch_to_kernel
107 - emake all
108 + use kpatch-build && emake -C kpatch-build
109 + use kpatch && emake -C kpatch
110 + use kmod && set_arch_to_kernel && emake -C kmod
111 + use contrib && emake -C contrib
112 + use test && emake check
113 }
114
115 src_install() {
116 - set_arch_to_kernel
117 - emake DESTDIR="${D}" PREFIX="/usr" install
118 + if use kpatch-build; then
119 + emake DESTDIR="${D}" PREFIX="/usr" install -C kpatch-build
120 + insinto /usr/share/${PN}/patch
121 + doins kmod/patch/kpatch{.lds.S,-macros.h,-patch.h,-patch-hook.c}
122 + doins kmod/patch/{livepatch-patch-hook.c,Makefile,patch-hook.c}
123 + doins kmod/core/kpatch.h
124 + doman man/kpatch-build.1
125 + fi
126 +
127 + if use kpatch; then
128 + emake DESTDIR="${D}" PREFIX="/usr" install -C kpatch
129 + doman man/kpatch.1
130 + fi
131 +
132 + use kmod && set_arch_to_kernel && emake DESTDIR="${D}" PREFIX="/usr" install -C kmod
133 + use contrib && emake DESTDIR="${D}" PREFIX="/usr" install -C contrib
134
135 - einstalldocs
136 + dodoc README.md doc/patch-author-guide.md
137 }