Gentoo Archives: gentoo-commits

From: "Jakov Smolić" <jsmolic@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/bcc/
Date: Sun, 07 Nov 2021 20:59:47
Message-Id: 1636318714.aa3d066f2b9904a46cfec836c3de140b742fafbf.jsmolic@gentoo
1 commit: aa3d066f2b9904a46cfec836c3de140b742fafbf
2 Author: Jakov Smolić <jsmolic <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 7 20:58:05 2021 +0000
4 Commit: Jakov Smolić <jsmolic <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 7 20:58:34 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa3d066f
7
8 dev-util/bcc: Correctly append "old" prefix to old tools' names
9
10 Previous fix solved the bug where bcc would install old versions on top
11 of the new ones, but it failed to append the "old" prefix to old tools
12 correctly, so they were not really installed. While at, let's do this in
13 src_prepare rather than in src_install phase.
14
15 Closes: https://bugs.gentoo.org/811288
16 Signed-off-by: Jakov Smolić <jsmolic <AT> gentoo.org>
17
18 dev-util/bcc/bcc-0.22.0-r1.ebuild | 119 ++++++++++++++++++++++++++++++++++++++
19 1 file changed, 119 insertions(+)
20
21 diff --git a/dev-util/bcc/bcc-0.22.0-r1.ebuild b/dev-util/bcc/bcc-0.22.0-r1.ebuild
22 new file mode 100644
23 index 00000000000..36f7b33c57d
24 --- /dev/null
25 +++ b/dev-util/bcc/bcc-0.22.0-r1.ebuild
26 @@ -0,0 +1,119 @@
27 +# Copyright 1999-2021 Gentoo Authors
28 +# Distributed under the terms of the GNU General Public License v2
29 +
30 +EAPI=7
31 +
32 +LUA_COMPAT=( luajit )
33 +PYTHON_COMPAT=( python3_{7..10} )
34 +
35 +inherit cmake linux-info llvm lua-single python-r1
36 +
37 +DESCRIPTION="Tools for BPF-based Linux IO analysis, networking, monitoring, and more"
38 +HOMEPAGE="https://iovisor.github.io/bcc/"
39 +
40 +SRC_URI="https://github.com/iovisor/bcc/archive/v${PV}.tar.gz -> ${P}.tar.gz"
41 +
42 +LICENSE="Apache-2.0"
43 +SLOT="0"
44 +KEYWORDS="~amd64 ~arm64 ~x86"
45 +IUSE="+lua test"
46 +REQUIRED_USE="${PYTHON_REQUIRED_USE}
47 + lua? ( ${LUA_REQUIRED_USE} )"
48 +
49 +RDEPEND="
50 + || (
51 + ~dev-libs/libbpf-0.5.0
52 + ~dev-libs/libbpf-9999
53 + )
54 + dev-libs/libbpf:=[static-libs(-)]
55 + >=sys-kernel/linux-headers-5.13
56 + >=dev-libs/elfutils-0.166:=
57 + <=sys-devel/clang-13:=
58 + <=sys-devel/llvm-13:=[llvm_targets_BPF(+)]
59 + lua? ( ${LUA_DEPS} )
60 + ${PYTHON_DEPS}
61 +"
62 +DEPEND="${RDEPEND}
63 + test? (
64 + || (
65 + net-misc/iputils[arping]
66 + net-analyzer/arping
67 + )
68 + net-analyzer/netperf
69 + net-misc/iperf:*
70 + )
71 +"
72 +BDEPEND="
73 + dev-util/cmake
74 + virtual/pkgconfig
75 +"
76 +
77 +PATCHES=(
78 + "${FILESDIR}/bcc-0.9.0-no-luajit-automagic-dep.patch"
79 + "${FILESDIR}/bcc-0.14.0-cmakelists.patch"
80 +)
81 +
82 +# tests need root access
83 +RESTRICT="test"
84 +
85 +pkg_pretend() {
86 + local CONFIG_CHECK="~BPF ~BPF_SYSCALL ~NET_CLS_BPF ~NET_ACT_BPF
87 + ~HAVE_EBPF_JIT ~BPF_EVENTS ~DEBUG_INFO ~FUNCTION_TRACER ~KALLSYMS_ALL
88 + ~KPROBES"
89 +
90 + check_extra_config
91 +}
92 +
93 +pkg_setup() {
94 + LLVM_MAX_SLOT=12 llvm_pkg_setup
95 + python_setup
96 +}
97 +
98 +src_prepare() {
99 + local bpf_link_path
100 +
101 + # this avoids bundling
102 + bpf_link_path="$(realpath --relative-to="${S}/src/cc/libbpf" /usr/include/bpf)" || die
103 + ln -sfn "${bpf_link_path}" src/cc/libbpf/include || die
104 +
105 + # bug 811288
106 + local script scriptname
107 + for script in $(find tools/old -type f -name "*.py"); do
108 + scriptname=$(basename ${script})
109 + mv ${script} tools/old/old-${scriptname} || die
110 + done
111 +
112 + cmake_src_prepare
113 +}
114 +
115 +python_add_impl() {
116 + bcc_python_impls+="${EPYTHON};"
117 +}
118 +
119 +src_configure() {
120 + local bcc_python_impls
121 + python_foreach_impl python_add_impl
122 +
123 + local -a mycmakeargs=(
124 + -DREVISION=${PV%%_*}
125 + -DENABLE_LLVM_SHARED=ON
126 + -DCMAKE_USE_LIBBPF_PACKAGE=ON
127 + -DKERNEL_INCLUDE_DIRS="${KERNEL_DIR}"
128 + -DPYTHON_CMD="${bcc_python_impls%;}"
129 + -Wno-dev
130 + )
131 + if use lua && use lua_single_target_luajit; then
132 + mycmakeargs+=( -DWITH_LUAJIT=1 )
133 + fi
134 +
135 + cmake_src_configure
136 +}
137 +
138 +src_install() {
139 + cmake_src_install
140 +
141 + python_replicate_script $(grep -Flr '#!/usr/bin/python' "${ED}/usr/share/bcc/tools")
142 + python_foreach_impl python_optimize
143 +
144 + newenvd "${FILESDIR}"/60bcc.env 60bcc.env
145 +}