Bug 287028 - net-mgmt/netdata: Update 2.4.0 => 2.5.2
Summary: net-mgmt/netdata: Update 2.4.0 => 2.5.2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Vladimir Druzenko
URL:
Keywords: needs-patch
Depends on:
Blocks:
 
Reported: 2025-05-23 19:49 UTC by Jordan Ostreff
Modified: 2025-06-03 19:59 UTC (History)
3 users (show)

See Also:
vvd: maintainer-feedback? (nk)


Attachments
net-mgmt/netdata: Update to v2.5.2 (28.41 KB, patch)
2025-05-28 03:15 UTC, Namkhai B.
no flags Details | Diff
net-mgmt/netdata: Update to v2.5.2 (30.84 KB, patch)
2025-05-29 03:01 UTC, Namkhai B.
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jordan Ostreff 2025-05-23 19:49:25 UTC
more information https://github.com/netdata/netdata/releases/tag/v2.5.2
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2025-05-23 20:54:04 UTC
The patch will speed up the update.
Comment 2 Namkhai B. 2025-05-23 21:07:12 UTC
Working on this unfortunately there's some issues with the vendored libbacktrace build I'm trying to fix
Comment 3 Jordan Ostreff 2025-05-25 09:14:38 UTC
(In reply to Namkhai B. from comment #2)

I wish you success with the development of port version 2.5.2 :) 

I have tried to use kickstart method of using netdata. I have do:
curl https://get.netdata.cloud/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --stable-channel
It works for almost 2 days with 2.5.1, then it has probably tried upgrade to newer version, but actually it crashed and never started again. 
Now i'm back to net-mgmt/netdata port version 2.40 which works as expected.
Comment 4 Namkhai B. 2025-05-28 03:15:36 UTC
Created attachment 260746 [details]
net-mgmt/netdata: Update to v2.5.2

Initial v2.5.2 update
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2025-05-28 23:35:45 UTC
1. The port is statically linked with the libbacktrace.a library at build time, rather than dynamically with libbacktrace.so:
-BUILD_DEPENDS=  ${LOCALBASE}/bin/mmv:misc/mmv
+BUILD_DEPENDS=  ${LOCALBASE}/bin/mmv:misc/mmv \
+                ${LOCALBASE}/lib/libbacktrace.a:devel/libbacktrace

2. Remove go version after default go version was increased to 1.24:
GOPLUGIN_DISTFILES=     go.mod:goplugin
GOPLUGIN_FETCH_DEPENDS= go${GO_SUFFIX}:lang/go${GO_SUFFIX}
GOPLUGIN_USES=          go:no_targets,modules
GOPLUGIN_CMAKE_BOOL=    ENABLE_PLUGIN_GO

3. Reducing the number of calls REINPLACE_CMD:
pre-patch:
-       @${REINPLACE_CMD} -e 's|usr/lib/|lib/|g' ${WRKSRC}/CMakeLists.txt
-       @${REINPLACE_CMD} -e 's|usr/libexec/|libexec/|g' ${WRKSRC}/CMakeLists.txt
-       @${REINPLACE_CMD} -e 's|usr/share/|share/|g' ${WRKSRC}/CMakeLists.txt
+       @${REINPLACE_CMD} -e 's|usr/lib/|lib/|g; s|usr/libexec/|libexec/|g; \
+                s|usr/share/|share/|g' ${WRKSRC}/CMakeLists.txt

post-patch:
-       @${REINPLACE_CMD} -e 's|%%NETDATA_CACHE%%|${NETDATA_CACHE}|g' \
-           ${PATCH_WRKSRC}/CMakeLists.txt
-       @${REINPLACE_CMD} -e 's|%%NETDATA_LOG%%|${NETDATA_LOG}|g' \
-           ${PATCH_WRKSRC}/CMakeLists.txt
-       @${REINPLACE_CMD} -e 's|%%NETDATA_PERST%%|${NETDATA_PERST}|g' \
-           ${PATCH_WRKSRC}/CMakeLists.txt
-       @${REINPLACE_CMD} -e 's|%%NETDATA_RUN%%|${NETDATA_RUN}|g' \
-           ${PATCH_WRKSRC}/CMakeLists.txt
-       @${REINPLACE_CMD} -e 's|%%ETCDIR%%|${ETCDIR}|g' \
+       @${REINPLACE_CMD} -e 's|%%NETDATA_CACHE%%|${NETDATA_CACHE}|g; \
+               s|%%NETDATA_LOG%%|${NETDATA_LOG}|g; \
+               s|%%NETDATA_PERST%%|${NETDATA_PERST}|g; \
+               s|%%NETDATA_RUN%%|${NETDATA_RUN}|g; \
+               s|%%ETCDIR%%|${ETCDIR}|g' \
            ${PATCH_WRKSRC}/CMakeLists.txt

4. Reducing the number of calls MKDIR:
-       ${MKDIR} ${STAGEDIR}${ETCDIR}
+       ${MKDIR} ${STAGEDIR}${ETCDIR} \
+               ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d \
+               ${STAGEDIR}${NETDATA_CACHE} \
+               ${STAGEDIR}${NETDATA_LOG} \
+               ${STAGEDIR}${NETDATA_PERST}
        ${INSTALL_DATA} ${WRKDIR}/netdata.conf.sample ${STAGEDIR}${ETCDIR}/netdata.conf.sample
_       ${MKDIR} ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d
        ${INSTALL_DATA} ${FILESDIR}/netdata.newsyslog.conf.sample ${STAGEDIR}${ETCDIR}/netdata.newsyslog.conf.sample
        ${TOUCH} ${STAGEDIR}${ETCDIR}/.opt-out-from-anonymous-statistics
-       ${MKDIR} ${STAGEDIR}${NETDATA_CACHE}
-       ${MKDIR} ${STAGEDIR}${NETDATA_LOG}
-       ${MKDIR} ${STAGEDIR}${NETDATA_PERST}

This reduce IO during build on build servers.

Tested in poudriere, but please check too - what if I made a mistake somewhere.
Comment 7 Namkhai B. 2025-05-29 03:01:57 UTC
Created attachment 260779 [details]
net-mgmt/netdata: Update to v2.5.2

Thanks Vladimir for the suggested changes
Comment 8 Daniel Engberg freebsd_committer freebsd_triage 2025-05-29 07:48:29 UTC
Indents should be 4 spaces, not tab

While the suggestions reduces calls it also reduces readability but that's up to the maintainer.
Comment 9 Daniel Engberg freebsd_committer freebsd_triage 2025-05-29 07:51:24 UTC
(In reply to Daniel Engberg from comment #8)
...while it is slower in theory there barely any practical impact given that everything is cached. That being said, we don't need to make ports unnecessary slow just because but there is almost always a tradeoff. If you want to reduce I/O and build times there are much larger fishes to catch in the tree.
Comment 10 Vladimir Druzenko freebsd_committer freebsd_triage 2025-05-29 11:51:23 UTC
(In reply to Daniel Engberg from comment #8)
Good formatting will only improve readability.
Compare:
-       @${REINPLACE_CMD} -e 's|%%NETDATA_CACHE%%|${NETDATA_CACHE}|g' \
-           ${PATCH_WRKSRC}/CMakeLists.txt
-       @${REINPLACE_CMD} -e 's|%%NETDATA_LOG%%|${NETDATA_LOG}|g' \
-           ${PATCH_WRKSRC}/CMakeLists.txt
-       @${REINPLACE_CMD} -e 's|%%NETDATA_PERST%%|${NETDATA_PERST}|g' \
-           ${PATCH_WRKSRC}/CMakeLists.txt
-       @${REINPLACE_CMD} -e 's|%%NETDATA_RUN%%|${NETDATA_RUN}|g' \
-           ${PATCH_WRKSRC}/CMakeLists.txt
-       @${REINPLACE_CMD} -e 's|%%ETCDIR%%|${ETCDIR}|g' \
-           ${PATCH_WRKSRC}/CMakeLists.txt
with
+       @${REINPLACE_CMD} -e '\
+               s|%%NETDATA_CACHE%%|${NETDATA_CACHE}|g; \
+               s|%%NETDATA_LOG%%|${NETDATA_LOG}|g; \
+               s|%%NETDATA_PERST%%|${NETDATA_PERST}|g; \
+               s|%%NETDATA_RUN%%|${NETDATA_RUN}|g; \
+               s|%%ETCDIR%%|${ETCDIR}|g' \
+           ${PATCH_WRKSRC}/CMakeLists.txt
Comment 11 Vladimir Druzenko freebsd_committer freebsd_triage 2025-05-29 11:53:52 UTC
(In reply to Daniel Engberg from comment #9)
I fix it in the ports I touch.
But really, just "rm -rf /usr/port/lang/rust" alone would help significantly more. :-D
Comment 12 commit-hook freebsd_committer freebsd_triage 2025-05-29 12:46:20 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8a16dc3383ba2fc713b36fee340867f51d6bf3c8

commit 8a16dc3383ba2fc713b36fee340867f51d6bf3c8
Author:     Namkhai B. <nk@nkeor.me>
AuthorDate: 2025-05-29 12:32:49 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-05-29 12:44:05 +0000

    net-mgmt/netdata: Update 2.40 => 2.5.2

    Changelogs:
    https://github.com/netdata/netdata/releases/tag/v2.5.0
    https://github.com/netdata/netdata/releases/tag/v2.5.1
    https://github.com/netdata/netdata/releases/tag/v2.5.2

    Improve port:
    - Reducing the number of calls REINPLACE_CMD and MKDIR.
    - Remove go version after default go version was increased to 1.24.
    - Fix ident in MASTER_SITES.
    - Refresh patches.

    PR:     287028

 net-mgmt/netdata/Makefile                          |  52 ++---
 net-mgmt/netdata/distinfo                          |  14 +-
 net-mgmt/netdata/files/patch-CMakeLists.txt        |  22 +-
 ...ging_cmake_Modules_NetdataBacktrace.cmake (new) |  50 ++++
 ...ch-packaging_cmake_Modules_NetdataGoTools.cmake |   4 +-
 ...ch-packaging_cmake_Modules_NetdataVersion.cmake |   4 +-
 net-mgmt/netdata/pkg-plist                         | 260 +++++++++++----------
 7 files changed, 237 insertions(+), 169 deletions(-)
Comment 13 Vladimir Druzenko freebsd_committer freebsd_triage 2025-05-29 12:48:01 UTC
Thanks.
Comment 14 Daniel Engberg freebsd_committer freebsd_triage 2025-05-29 12:49:31 UTC
(In reply to Vladimir Druzenko from comment #11)
Please refrain from off topic rants

..and idents are still wrong.
Comment 15 Daniel Engberg freebsd_committer freebsd_triage 2025-05-29 12:51:29 UTC
..and we should hardcode PREFIX to /usr/local/ in packaging/cmake/Modules/NetdataBacktrace.cmake
Comment 16 Daniel Engberg freebsd_committer freebsd_triage 2025-05-29 12:51:40 UTC
(In reply to Daniel Engberg from comment #15)
err.. shouldn't
Comment 17 commit-hook freebsd_committer freebsd_triage 2025-05-29 18:45:23 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0f06c18df2a81178b35e56404e79f817c1ae6520

commit 0f06c18df2a81178b35e56404e79f817c1ae6520
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2025-05-29 18:37:03 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-05-29 18:43:52 +0000

    net-mgmt/netdata: Replace hardcoded /usr/local with LOCALBASE in patch

    PR:             287028
    Reported by:    diizzy
    Approved by:    Namkhai B. <nk@nkeor.me> (maintainer, implicit)

 net-mgmt/netdata/Makefile                                               | 2 ++
 .../netdata/files/patch-packaging_cmake_Modules_NetdataBacktrace.cmake  | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
Comment 18 Vladimir Druzenko freebsd_committer freebsd_triage 2025-05-29 19:01:37 UTC
(In reply to Daniel Engberg from comment #14)
> ..and idents are still wrong.
Can you show me what you mean?
And so that it does not spoil the readability of the code.
Comment 19 Daniel Engberg freebsd_committer freebsd_triage 2025-06-01 10:15:58 UTC
Something like this? https://projects.pyret.net/files/freebsd-patches/netdata-fixup-indent.patch
Comment 20 Vladimir Druzenko freebsd_committer freebsd_triage 2025-06-03 19:59:26 UTC
(In reply to Daniel Engberg from comment #19)
This patch makes the code less readable. But if the porter's handbook says to do it this way and/or the maintainer asks to do it this way, I'll fix it. Otherwise I'd leave it as is now.