summaryrefslogtreecommitdiff
path: root/dev-debug
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-08-19 12:25:21 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-08-19 12:25:21 +0100
commit1f3e27f8fde0df9246ce9151ced7d2dd4e96cb07 (patch)
tree2ccd1e9121906f2bccf218e14e3ca943a2b84bf3 /dev-debug
parent16be64511bd21e32a29645b49e37611507709790 (diff)
gentoo auto-resync : 19:08:2024 - 12:25:21
Diffstat (limited to 'dev-debug')
-rw-r--r--dev-debug/Manifest.gzbin3850 -> 4009 bytes
-rw-r--r--dev-debug/dtrace/Manifest5
-rw-r--r--dev-debug/dtrace/dtrace-2.0.1.1.ebuild177
-rw-r--r--dev-debug/dtrace/dtrace-9999.ebuild177
-rw-r--r--dev-debug/dtrace/files/dtprobed.init15
-rw-r--r--dev-debug/dtrace/metadata.xml22
6 files changed, 396 insertions, 0 deletions
diff --git a/dev-debug/Manifest.gz b/dev-debug/Manifest.gz
index 1a04f7cab812..cb2d0c388514 100644
--- a/dev-debug/Manifest.gz
+++ b/dev-debug/Manifest.gz
Binary files differ
diff --git a/dev-debug/dtrace/Manifest b/dev-debug/dtrace/Manifest
new file mode 100644
index 000000000000..35f1b2bd43ae
--- /dev/null
+++ b/dev-debug/dtrace/Manifest
@@ -0,0 +1,5 @@
+AUX dtprobed.init 209 BLAKE2B f97bd2c0c681697becc2c6c7f87b8fdf779251d0473dd440bf30f0c3ce95e26e24b2496a2e8de4ff33a9ffc8a05e5bc64d066969dd7e4458ea65d2d10ae61723 SHA512 12a8e07747d8a8c3456675ea88060656dad2b594abc69daa15384abab4d11ea888d88287f921a095cad84f2e254dc858ea50e29f5e17b663f7b6be25dcbfd7b5
+DIST dtrace-2.0.1.1.tar.gz 1435524 BLAKE2B 761a931b9d871e9316f11ebe960f6bbfd3c16a82cf1cdd9ae5d69b22e0d8cea8d4b3924c960b7915f8843ce1e5c37bd257a52f1ce346957002b0ab00e59306fb SHA512 15809f2bc996bac9bd6cbb2b03eaa9a0c6a2aea9404642280f14d75b7d6feaec31b5d2c16915255cd202006cdff7835f578c042b087605708a9eb935407f1b95
+EBUILD dtrace-2.0.1.1.ebuild 4551 BLAKE2B 23dd7a35b14e9bc0d3f1e4b1acb873fc5bccc151e92905a06e72b6f7d4e923e9dba550f0a09fc8c4b415c08e6bcfd7812c0d972fc853750f3a58947beaa3ff83 SHA512 4ec4767650eeef7059944a516ce8147ce2a713dbf57bedf95d93143dad94ddccf1f838584db456d11de61a394fe6322204d71337a497364922de6e45ca88e092
+EBUILD dtrace-9999.ebuild 4495 BLAKE2B dff9525b91907f412168c79dcaab59f48afcce7cdd2c086340707b63fe37c732a06bd7d9eb301facf4cc33ed2b29854a7b6e528a838300a3f760abac6c021418 SHA512 a6dd940179317d770f8d47494ea99e1b50d17d3632343d32e2c6ec0db388803eedf93cf5680cffccf34bcc1d9ebbad48917c1d8b01ab1281ee2fd19469847d40
+MISC metadata.xml 647 BLAKE2B 4166a7a430a3cfa4967960edf9cc13673bc38b3b610669e13869d9ad0b99eaa643e31a7e07df964b1fb1b071aa437bd687de10968266a4d9b54fb04f5a3ce240 SHA512 19a73dac88ad46ae296698cd45b416fe08a75d666440518d913b78631bf11ae53087801e13936d6218f0c3b2083694acfafa5dca12ec9d5fd7fc4e2252d3deb3
diff --git a/dev-debug/dtrace/dtrace-2.0.1.1.ebuild b/dev-debug/dtrace/dtrace-2.0.1.1.ebuild
new file mode 100644
index 000000000000..5baf5c47c35c
--- /dev/null
+++ b/dev-debug/dtrace/dtrace-2.0.1.1.ebuild
@@ -0,0 +1,177 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit edo flag-o-matic linux-info systemd toolchain-funcs udev
+
+DESCRIPTION="Dynamic BPF-based system-wide tracing tool"
+HOMEPAGE="https://github.com/oracle/dtrace-utils https://wiki.gentoo.org/wiki/DTrace"
+
+if [[ ${PV} == 9999 ]]; then
+ EGIT_BRANCH="devel"
+ EGIT_REPO_URI="https://github.com/oracle/dtrace-utils"
+ inherit git-r3
+else
+ SRC_URI="https://github.com/oracle/dtrace-utils/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}"/dtrace-utils-${PV}
+
+ KEYWORDS="-* ~amd64"
+fi
+
+LICENSE="UPL-1.0"
+SLOT="0"
+IUSE="install-tests systemd"
+
+# XXX: right now, we auto-adapt to whether multilibs are present:
+# should we force them to be? how?
+#
+# XXX: binutils-libs will need an extra patch for what dtrace does with
+# it in the absence of in-kernel CTF: it will be backported
+# to 2.42, but perhaps a patch would be a good idea before that?
+DEPEND="
+ dev-libs/elfutils
+ dev-libs/libbpf
+ dev-libs/libpfm:=
+ net-analyzer/wireshark[dumpcap]
+ net-libs/libpcap
+ >=sys-fs/fuse-3.2.0:3
+ >=sys-libs/binutils-libs-2.42:=
+ sys-libs/zlib
+ systemd? ( sys-apps/systemd )
+"
+RDEPEND="
+ ${DEPEND}
+ !dev-debug/systemtap
+ net-analyzer/wireshark
+ install-tests? (
+ app-alternatives/bc
+ app-editors/vim-core
+ dev-build/make
+ dev-lang/perl
+ dev-util/perf
+ net-fs/nfs-utils
+ sys-apps/coreutils
+ sys-fs/xfsprogs
+ sys-process/time
+ virtual/jdk
+ virtual/perl-IO-Socket-IP
+ )
+"
+BDEPEND="
+ dev-build/make
+ sys-apps/gawk
+ sys-devel/bison
+ >=sys-devel/bpf-toolchain-14.1.0
+ sys-devel/flex
+"
+
+pkg_pretend() {
+ # TODO: optional kernel patches
+
+ # Basics for debugging information, BPF
+ local CONFIG_CHECK="~BPF ~DEBUG_INFO_BTF ~KALLSYMS_ALL"
+
+ CONFIG_CHECK+=" ~CUSE"
+
+ # Tracing
+ CONFIG_CHECK+=" ~FTRACE_SYSCALLS ~UPROBE_EVENTS ~DYNAMIC_FTRACE ~FUNCTION_TRACER"
+
+ # https://gcc.gnu.org/PR84052
+ CONFIG_CHECK+=" !GCC_PLUGIN_RANDSTRUCT"
+
+ check_extra_config
+}
+
+pkg_setup() {
+ eval unset ${!LC_*} LANG
+}
+
+src_configure() {
+ if tc-is-cross-compiler; then
+ die "DTrace does not yet support cross-compilation."
+ fi
+
+ tc-export CC
+
+ # TODO: Can drop once https://lore.kernel.org/dtrace/20240425164057.420580-1-nick.alcock@oracle.com/ is in
+ tc-enables-fortify-source && append-cppflags -U_FORTIFY_SOURCE
+
+ # lld does this by default, so fix that, although lld fails anyway...
+ # 'LIBDTRACE_1.0' to symbol 'dtrace_provider_modules' failed: symbol not defined
+ append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
+ # mold and lld can't cope with some relocation types used, e.g.
+ # 'test-triggers--usdt-tst-forker-prov.o:(.SUNW_dof): unknown relocation: R_X86_64_GLOB_DAT'
+ tc-ld-force-bfd
+
+ # -fno-semantic-interposition seems to lead to a broken dtrace
+ # that can't actually obtain results from probes, even trivial examples
+ # just hang.
+ filter-flags -fno-semantic-interposition
+ filter-lto
+
+ local confargs=(
+ # TODO: Maybe we should set the UNPRIV_UID to something? -3 is a bit... kludgy
+ --prefix="${EPREFIX}"/usr
+ --mandir="${EPREFIX}"/usr/share/man
+ --docdir="${EPREFIX}"/usr/share/doc/${PF}
+ HAVE_LIBCTF=yes
+ HAVE_LIBSYSTEMD=$(usex systemd)
+ HAVE_BPFV3=yes
+ )
+
+ edo ./configure "${confargs[@]}"
+}
+
+src_compile() {
+ emake verbose=1 $(usev !install-tests TRIGGERS='')
+}
+
+src_test() {
+ # Needs root and is also very time-consuming
+ :;
+}
+
+src_install() {
+ emake DESTDIR="${D}" install $(usev install-tests install-test)
+
+ # Stripping the BPF libs breaks them
+ dostrip -x "/usr/$(get_libdir)"
+
+ # It's a binary (TODO: move it?)
+ docompress -x /usr/share/doc/${PF}/showUSDT
+
+ newinitd "${FILESDIR}"/dtprobed.init dtprobed
+}
+
+pkg_postinst() {
+ # We need a udev reload to pick up the CUSE device node rules.
+ udev_reload
+
+ # TODO: Restart it on upgrade? (it will carry across its own persistent state)
+ if [[ -n ${REPLACING_VERSIONS} ]]; then
+ einfo "See https://wiki.gentoo.org/wiki/DTrace for getting started."
+
+ # TODO: Make this more intelligent wrt comparison
+ if systemd_is_booted ; then
+ einfo "Restart the DTrace 'dtprobed' service after upgrades:"
+ einfo " systemctl try-restart dtprobed"
+ else
+ einfo "Restart the DTrace 'dtprobed' service with:"
+ einfo " /etc/init.d/dtprobed restart"
+ fi
+ else
+ if systemd_is_booted ; then
+ einfo "Enable and start the DTrace 'dtprobed' service with:"
+ einfo " systemctl enable --now dtprobed"
+ else
+ einfo "Enable and start the DTrace 'dtprobed' service with:"
+ einfo " rc-update add dtprobed"
+ einfo " /etc/init.d/dtprobed start"
+ fi
+ fi
+}
+
+pkg_postrm() {
+ udev_reload
+}
diff --git a/dev-debug/dtrace/dtrace-9999.ebuild b/dev-debug/dtrace/dtrace-9999.ebuild
new file mode 100644
index 000000000000..73afc981b1fd
--- /dev/null
+++ b/dev-debug/dtrace/dtrace-9999.ebuild
@@ -0,0 +1,177 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit edo flag-o-matic linux-info systemd toolchain-funcs udev
+
+DESCRIPTION="Dynamic BPF-based system-wide tracing tool"
+HOMEPAGE="https://github.com/oracle/dtrace-utils https://wiki.gentoo.org/wiki/DTrace"
+
+if [[ ${PV} == 9999 ]]; then
+ EGIT_BRANCH="devel"
+ EGIT_REPO_URI="https://github.com/oracle/dtrace-utils"
+ inherit git-r3
+else
+ SRC_URI="https://github.com/oracle/dtrace-utils/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}"/dtrace-utils-${PV}
+
+ KEYWORDS="-* ~amd64"
+fi
+
+LICENSE="UPL-1.0"
+SLOT="0"
+IUSE="install-tests systemd"
+
+# XXX: right now, we auto-adapt to whether multilibs are present:
+# should we force them to be? how?
+#
+# XXX: binutils-libs will need an extra patch for what dtrace does with
+# it in the absence of in-kernel CTF: it will be backported
+# to 2.42, but perhaps a patch would be a good idea before that?
+DEPEND="
+ dev-libs/elfutils
+ dev-libs/libbpf
+ dev-libs/libpfm:=
+ net-analyzer/wireshark[dumpcap]
+ net-libs/libpcap
+ >=sys-fs/fuse-3.2.0:3
+ >=sys-libs/binutils-libs-2.42:=
+ sys-libs/zlib
+ systemd? ( sys-apps/systemd )
+"
+RDEPEND="
+ ${DEPEND}
+ !dev-debug/systemtap
+ net-analyzer/wireshark
+ install-tests? (
+ app-alternatives/bc
+ app-editors/vim-core
+ dev-build/make
+ dev-lang/perl
+ dev-util/perf
+ net-fs/nfs-utils
+ sys-apps/coreutils
+ sys-fs/xfsprogs
+ sys-process/time
+ virtual/jdk
+ virtual/perl-IO-Socket-IP
+ )
+"
+BDEPEND="
+ dev-build/make
+ sys-apps/gawk
+ sys-devel/bison
+ >=sys-devel/bpf-toolchain-14.1.0
+ sys-devel/flex
+"
+
+pkg_pretend() {
+ # TODO: optional kernel patches
+
+ # Basics for debugging information, BPF
+ local CONFIG_CHECK="~BPF ~DEBUG_INFO_BTF ~KALLSYMS_ALL"
+
+ CONFIG_CHECK+=" ~CUSE"
+
+ # Tracing
+ CONFIG_CHECK+=" ~FTRACE_SYSCALLS ~UPROBE_EVENTS ~DYNAMIC_FTRACE ~FUNCTION_TRACER"
+
+ # https://gcc.gnu.org/PR84052
+ CONFIG_CHECK+=" !GCC_PLUGIN_RANDSTRUCT"
+
+ check_extra_config
+}
+
+pkg_setup() {
+ eval unset ${!LC_*} LANG
+}
+
+src_configure() {
+ if tc-is-cross-compiler; then
+ die "DTrace does not yet support cross-compilation."
+ fi
+
+ tc-export CC
+
+ # https://github.com/oracle/dtrace-utils/issues/78
+ tc-enables-fortify-source && append-cppflags -U_FORTIFY_SOURCE
+
+ # lld does this by default, so fix that, although lld fails anyway...
+ # 'LIBDTRACE_1.0' to symbol 'dtrace_provider_modules' failed: symbol not defined
+ append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
+ # mold and lld can't cope with some relocation types used, e.g.
+ # 'test-triggers--usdt-tst-forker-prov.o:(.SUNW_dof): unknown relocation: R_X86_64_GLOB_DAT'
+ tc-ld-force-bfd
+
+ # -fno-semantic-interposition seems to lead to a broken dtrace
+ # that can't actually obtain results from probes, even trivial examples
+ # just hang.
+ filter-flags -fno-semantic-interposition
+ filter-lto
+
+ local confargs=(
+ # TODO: Maybe we should set the UNPRIV_UID to something? -3 is a bit... kludgy
+ --prefix="${EPREFIX}"/usr
+ --mandir="${EPREFIX}"/usr/share/man
+ --docdir="${EPREFIX}"/usr/share/doc/${PF}
+ HAVE_LIBCTF=yes
+ HAVE_LIBSYSTEMD=$(usex systemd)
+ HAVE_BPFV3=yes
+ )
+
+ edo ./configure "${confargs[@]}"
+}
+
+src_compile() {
+ emake verbose=1 $(usev !install-tests TRIGGERS='')
+}
+
+src_test() {
+ # Needs root and is also very time-consuming
+ :;
+}
+
+src_install() {
+ emake DESTDIR="${D}" install $(usev install-tests install-test)
+
+ # Stripping the BPF libs breaks them
+ dostrip -x "/usr/$(get_libdir)"
+
+ # It's a binary (TODO: move it?)
+ docompress -x /usr/share/doc/${PF}/showUSDT
+
+ newinitd "${FILESDIR}"/dtprobed.init dtprobed
+}
+
+pkg_postinst() {
+ # We need a udev reload to pick up the CUSE device node rules.
+ udev_reload
+
+ # TODO: Restart it on upgrade? (it will carry across its own persistent state)
+ if [[ -n ${REPLACING_VERSIONS} ]]; then
+ einfo "See https://wiki.gentoo.org/wiki/DTrace for getting started."
+
+ # TODO: Make this more intelligent wrt comparison
+ if systemd_is_booted ; then
+ einfo "Restart the DTrace 'dtprobed' service after upgrades:"
+ einfo " systemctl try-restart dtprobed"
+ else
+ einfo "Restart the DTrace 'dtprobed' service with:"
+ einfo " /etc/init.d/dtprobed restart"
+ fi
+ else
+ if systemd_is_booted ; then
+ einfo "Enable and start the DTrace 'dtprobed' service with:"
+ einfo " systemctl enable --now dtprobed"
+ else
+ einfo "Enable and start the DTrace 'dtprobed' service with:"
+ einfo " rc-update add dtprobed"
+ einfo " /etc/init.d/dtprobed start"
+ fi
+ fi
+}
+
+pkg_postrm() {
+ udev_reload
+}
diff --git a/dev-debug/dtrace/files/dtprobed.init b/dev-debug/dtrace/files/dtprobed.init
new file mode 100644
index 000000000000..b3d039671e2f
--- /dev/null
+++ b/dev-debug/dtrace/files/dtprobed.init
@@ -0,0 +1,15 @@
+#!/sbin/openrc-run
+
+depend() {
+ need localmount
+ need bootmisc
+ after logger
+}
+
+start() {
+ start-stop-daemon --start --exec /usr/sbin/dtprobed
+}
+
+stop() {
+ start-stop-daemon --stop --exec /usr/sbin/dtprobed
+}
diff --git a/dev-debug/dtrace/metadata.xml b/dev-debug/dtrace/metadata.xml
new file mode 100644
index 000000000000..00989594025b
--- /dev/null
+++ b/dev-debug/dtrace/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>sam@gentoo.org</email>
+ <name>Sam James</name>
+ </maintainer>
+ <maintainer type="person">
+ <email>arsen@gentoo.org</email>
+ <description>Arsen Arsenović</description>
+ </maintainer>
+ <use>
+ <flag name="install-tests">
+ Install the testsuite for manual use. It is not suitable
+ for automatic execution within the ebuild because it
+ requires root privlieges.
+ </flag>
+ </use>
+ <upstream>
+ <remote-id type="github">oracle/dtrace-utils</remote-id>
+ </upstream>
+</pkgmetadata>