From d5a24aa9ba9b2677be08613f1bcf97ad8a057069 Mon Sep 17 00:00:00 2001 From: Enguerrand de Ribaucourt Date: Tue, 1 Oct 2024 13:54:17 +0200 Subject: netdata: add go plugin PACKAGECONFIG Many netdata plugins are written in go, add a PACKAGECONFIG to enable them. Signed-off-by: Enguerrand de Ribaucourt Signed-off-by: Khem Raj --- .../recipes-webadmin/netdata/netdata/go.d.conf | 2 ++ .../recipes-webadmin/netdata/netdata_1.47.1.bb | 27 ++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 meta-webserver/recipes-webadmin/netdata/netdata/go.d.conf diff --git a/meta-webserver/recipes-webadmin/netdata/netdata/go.d.conf b/meta-webserver/recipes-webadmin/netdata/netdata/go.d.conf new file mode 100644 index 0000000000..e0b3a0b18c --- /dev/null +++ b/meta-webserver/recipes-webadmin/netdata/netdata/go.d.conf @@ -0,0 +1,2 @@ +modules: + logind: yes diff --git a/meta-webserver/recipes-webadmin/netdata/netdata_1.47.1.bb b/meta-webserver/recipes-webadmin/netdata/netdata_1.47.1.bb index ef8e05c8d5..33a4299dde 100644 --- a/meta-webserver/recipes-webadmin/netdata/netdata_1.47.1.bb +++ b/meta-webserver/recipes-webadmin/netdata/netdata_1.47.1.bb @@ -13,6 +13,7 @@ SRC_URI = " \ file://0002-Do-not-hardcode-systemd-unit-directories.patch \ file://netdata.conf \ file://netdata-volatiles.conf \ + ${@bb.utils.contains('PACKAGECONFIG', 'go', 'file://go.d.conf', '', d)} \ " SRC_URI[sha256sum] = "fb970a4b571ffd542b7d24220ef806a4c1b56c535e0f549a9978860a9f1dcc9c" @@ -24,7 +25,9 @@ S = "${WORKDIR}/${BPN}-v${PV}" # Stop sending anonymous statistics to Google Analytics NETDATA_ANONYMOUS ??= "enabled" -inherit pkgconfig cmake useradd systemd +inherit pkgconfig useradd systemd +# Inherit cmake last to use its do_compile task (and not go's) +inherit_defer ${@bb.utils.filter("PACKAGECONFIG", "go", d)} cmake TARGET_CC_ARCH:append:libc-musl = " -D_LARGEFILE64_SOURCE" @@ -34,6 +37,15 @@ LIBS:riscv32 = "-latomic" LIBS:mips = "-latomic" export LIBS +# Skip go.d plugins QA issues +CFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'go', \ + '-Wno-aggressive-loop-optimizations -Wno-nonnull -Wno-stringop-overflow' \ + , '', d)}" +INSANE_SKIP:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'go', 'already-stripped buildpaths', '', d)}" + +# network is required by go to get dependent packages +do_compile[network] = "1" + #systemd SYSTEMD_PACKAGES = "${PN}" export SERVICE_FILES = "netdata.service netdata-updater.service netdata-updater.timer" @@ -56,11 +68,19 @@ PACKAGECONFIG[xenstat] = "-DENABLE_PLUGIN_XENSTAT=ON,-DENABLE_PLUGIN_XENSTAT=OFF PACKAGECONFIG[cups] = "-DENABLE_PLUGIN_CUPS=ON,-DENABLE_PLUGIN_CUPS=OFF,cups" PACKAGECONFIG[systemd] = "-DENABLE_PLUGIN_SYSTEMD_JOURNAL=ON,-DENABLE_PLUGIN_SYSTEMD_JOURNAL=OFF,systemd" PACKAGECONFIG[docker] = ",,virtual/docker," +PACKAGECONFIG[go] = "-DENABLE_PLUGIN_GO=ON, -DENABLE_PLUGIN_GO=OFF" # ebpf doesn't compile (or detect) the cross compilation well -EXTRA_OECMAKE += "-DENABLE_PLUGIN_EBPF=OFF -DENABLE_PLUGIN_GO=OFF -DBUILD_FOR_PACKAGING=${@bb.utils.contains('DISTRO_FEATURES','systemd','ON','OFF',d)} \ +EXTRA_OECMAKE += "-DENABLE_PLUGIN_EBPF=OFF -DBUILD_FOR_PACKAGING=${@bb.utils.contains('DISTRO_FEATURES','systemd','ON','OFF',d)} \ -DENABLE_ACLK=OFF -DENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE=OFF -DCMAKE_INSTALL_PREFIX='${base_prefix}'" +do_compile:append() { + # Go dependencies are protected with read-only permissions, but would prevent cleaning + if ${@bb.utils.contains('PACKAGECONFIG', 'go', 'true', 'false', d)}; then + chmod -R a+w ${B}/pkg + fi +} + do_install:append() { #set S UID for plugins chmod 4755 ${D}${libexecdir}/netdata/plugins.d/apps.plugin @@ -74,6 +94,9 @@ do_install:append() { # Install default netdata.conf install -d ${D}${sysconfdir}/netdata install -m 0644 ${UNPACKDIR}/netdata.conf ${D}${sysconfdir}/netdata/ + if ${@bb.utils.contains('PACKAGECONFIG', 'go', 'true', 'false', d)}; then + install -m 0644 ${UNPACKDIR}/go.d.conf ${D}${sysconfdir}/netdata/ + fi sed -i -e 's,@@datadir,${datadir},g' ${D}${sysconfdir}/netdata/netdata.conf sed -i -e 's,@@libdir,${libdir},g' ${D}${sysconfdir}/netdata/netdata.conf sed -i -e 's,@@libexecdir,${libexecdir},g' ${D}${sysconfdir}/netdata/netdata.conf -- cgit v1.2.3-54-g00ecf