Gentoo Archives: gentoo-commits

From: "Göktürk Yüksek" <gokturk@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-kernel/kpatch/
Date: Tue, 24 Oct 2017 00:08:36
Message-Id: 1508803683.4fdae0b0e6ed6bd89f770ebbcd68d8717972e34c.gokturk@gentoo
1 commit: 4fdae0b0e6ed6bd89f770ebbcd68d8717972e34c
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 8 17:25:37 2017 +0000
4 Commit: Göktürk Yüksek <gokturk <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 24 00:08:03 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4fdae0b0
7
8 sys-kernel/kpatch: add live ebuild
9
10 Package-Manager: Portage-2.3.6, Repoman-2.3.1
11
12 sys-kernel/kpatch/kpatch-9999.ebuild | 77 ++++++++++++++++++++++++++++++++++++
13 1 file changed, 77 insertions(+)
14
15 diff --git a/sys-kernel/kpatch/kpatch-9999.ebuild b/sys-kernel/kpatch/kpatch-9999.ebuild
16 new file mode 100644
17 index 00000000000..0d6aa6e706a
18 --- /dev/null
19 +++ b/sys-kernel/kpatch/kpatch-9999.ebuild
20 @@ -0,0 +1,77 @@
21 +# Copyright 1999-2017 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI="6"
25 +
26 +inherit linux-info linux-mod flag-o-matic
27 +
28 +if [[ "${PV}" == "9999" ]]; then
29 + inherit git-r3
30 + EGIT_REPO_URI="https://github.com/dynup/${PN}.git"
31 +else
32 + SRC_URI="https://github.com/dynup/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
33 + KEYWORDS="~amd64"
34 +fi
35 +
36 +DESCRIPTION="Dynamic kernel patching for Linux"
37 +HOMEPAGE="https://github.com/dynup/kpatch"
38 +
39 +LICENSE="GPL-2+"
40 +SLOT="0"
41 +IUSE="examples +modules test"
42 +
43 +RDEPEND="
44 + app-crypt/pesign
45 + dev-libs/openssl:0=
46 + sys-libs/zlib
47 + sys-apps/pciutils
48 +"
49 +
50 +DEPEND="
51 + ${RDEPEND}
52 + test? ( dev-util/shellcheck )
53 + dev-libs/elfutils
54 + sys-devel/bison
55 +"
56 +
57 +pkg_pretend() {
58 + if kernel_is gt 3 9 0; then
59 + if ! linux_config_exists; then
60 + eerror "Unable to check the currently running kernel for kpatch support"
61 + eerror "Please be sure a .config file is available in the kernel src dir"
62 + eerror "and ensure the kernel has been built."
63 + else
64 + # Fail to build if these kernel options are not enabled (see kpatch/kmod/core/Makefile)
65 + CONFIG_CHECK="FUNCTION_TRACER HAVE_FENTRY MODULES SYSFS KALLSYMS_ALL"
66 + ERROR_FUNCTION_TRACER="CONFIG_FUNCTION_TRACER must be enabled in the kernel's config file"
67 + ERROR_HAVE_FENTRY="CONFIG_HAVE_FENTRY must be enabled in the kernel's config file"
68 + ERROR_MODULES="CONFIG_MODULES must be enabled in the kernel's config file"
69 + ERROR_SYSFS="CONFIG_SYSFS must be enabled in the kernel's config file"
70 + ERROR_KALLSYMS_ALL="CONFIG_KALLSYMS_ALL must be enabled in the kernel's config file"
71 + fi
72 + else
73 + eerror
74 + eerror "kpatch is not available for Linux kernels below 4.0.0"
75 + eerror
76 + die "Upgrade the kernel sources before installing kpatch."
77 + fi
78 +
79 + check_extra_config
80 +}
81 +
82 +src_prepare() {
83 + replace-flags '-O?' '-O1'
84 + default
85 +}
86 +
87 +src_compile() {
88 + set_arch_to_kernel
89 + emake all
90 +}
91 +
92 +src_install() {
93 + set_arch_to_kernel
94 + emake DESTDIR="${D}" PREFIX="/usr" install
95 +
96 + einstalldocs
97 +}