Skip to contentSkip to conversation

RFC: some issues with go?

PATCH In review Jan Vermaete 2 participants 3 messages Sep 15, 2024 – Sep 23, 2024

lore
Share & tools
lore
#0 lore raw

cover RFC: some issues with go?

Could someone review this patch that enables the Go-based plugins of Netdata?

I tested it in QEMU with the Go example package enable locally.

I have this error when building the image (with Kas)
----------------------------------------------------

NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 5371 tasks of which 5341 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 2 seconds
Exception ignored in: <function SetupHome.__del__ at 0x7fe2f82682c0>
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/kas/libcmds.py", line 166, in __del__
shutil.rmtree(self.tmpdirname)
File "/usr/lib/python3.11/shutil.py", line 732, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.11/shutil.py", line 660, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib/python3.11/shutil.py", line 660, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib/python3.11/shutil.py", line 660, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
[Previous line repeated 2 more times]
File "/usr/lib/python3.11/shutil.py", line 683, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.11/shutil.py", line 681, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'rounder_example_test.go'

Workaround for network access
-----------------------------

I there a way to avoid the 'do_compile[network] = "1"'. It seems to be needed to fetch the Go packages specified in the go.mod file.

INSAGE_SKIP
-----------

How to avoid the QA error/warning already-stripped?

ERROR: netdata-1.47.1-r0 do_package: QA Issue: File '/usr/libexec/netdata/plugins.d/go.d.plugin' from netdata was already stripped, this will prevent future debugging! [already-stripped]
ERROR: netdata-1.47.1-r0 do_package: Fatal QA errors were found, failing task.

Jan Vermaete (1):
netdata: enable Go-based plugins

 .../recipes-webadmin/netdata/netdata_1.47.1.bb  | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/1 netdata: enable Go-based plugins

Default enabled because netdata is transforming the plugins from Python to Go rapidly.

---
 .../recipes-webadmin/netdata/netdata_1.47.1.bb  | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
meta-webserver/recipes-webadmin/netdata/netdata_1.47.1.bb +15 -2
index e134c06b0..7d922dbca 100644
@@ -7,6 +7,17 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=fc9b848046ef54b5eaee6071947abd24"
 
 DEPENDS += "json-c libuv libyaml util-linux zlib lz4"
 
+GO_ROOT = "${STAGING_LIBDIR}/go"
+export GO_ROOT
+#export GOPROXY = "https://proxy.golang.org,direct"
+
+# Workaround for network access issue during compile step
+# this needs to be fixed in the recipes buildsystem to move
+# this such that it can be accomplished during do_fetch task
+do_compile[network] = "1"
+
+INSANE_SKIP:${PN} += "already-stripped buildpaths"
+
 SRC_URI = "\
     https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BPN}-v${PV}.tar.gz \
     file://netdata.conf \
@@ -42,7 +53,7 @@ SYSTEMD_AUTO_ENABLE:${PN} = "enable"
 USERADD_PACKAGES = "${PN}"
 USERADD_PARAM:${PN} = "--system --no-create-home --home-dir ${localstatedir}/run/netdata --user-group netdata"
 
-PACKAGECONFIG ??= "openssl freeipmi ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
+PACKAGECONFIG ??= "openssl freeipmi ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} go"
 PACKAGECONFIG[brotli] = ",,brotli"
 PACKAGECONFIG[cloud] = "-DENABLE_CLOUD=ON,-DENABLE_CLOUD=OFF,"
 PACKAGECONFIG[openssl] = "-DENABLE_OPENSSL=ON,-DENABLE_OPENSSL=OFF,openssl"
@@ -53,8 +64,10 @@ 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[go] = "-DENABLE_PLUGIN_GO=ON,-DENABLE_PLUGIN_GO=OFF,go-native"
+
 # ebpf doesn't compile (or detect) the cross compilation well
-EXTRA_OECMAKE += "-DENABLE_PLUGIN_EBPF=OFF -DENABLE_PLUGIN_GO=OFF \
+EXTRA_OECMAKE += "-DENABLE_PLUGIN_EBPF=OFF \
                   -DENABLE_ACLK=OFF -DENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE=OFF -DCMAKE_INSTALL_PREFIX='${base_prefix}'"
 
 do_install:append() {
Signature · 1 line
2.39.2
#2 lore raw
In reply to Jan Vermaete
Quoted 11 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Jan Vermaete
Sent: den 15 september 2024 19:53
To: [email protected]
Cc: Jan Vermaete <[email protected]>
Subject: [oe] [PATCH 0/1] RFC: some issues with go?

Could someone review this patch that enables the Go-based plugins of Netdata?

I tested it in QEMU with the Go example package enable locally.

[cut]

Quoted 5 lines

Workaround for network access
-----------------------------

I there a way to avoid the 'do_compile[network] = "1"'. It seems to be needed to fetch the Go packages specified in the go.mod file.

A fetcher for Go modules was just added to bitbake and will be present in Styhead. Unfortunately the necessary changes to go-mod.bbclass to make it usable did not make it in time and are only available on master. :(

I intend to send patches to update the Go recipes in meta-oe to use the new fetcher, but unfortunately I am a bit backlogged after having attended OSS + LPC + Yocto Dev Day in Vienna last week.

//Peter