On 2019/05/28 21:29, William Leuschner wrote:
> Hello ports@,
>
> I mentioned about a year ago that I was working on porting Netdata. Slow progress, I know :D
>
> I've run into a problem with my port. Netdata does a code-as-configuration thing where it dumps a bunch of python files into folders in /etc when you run it, which it uses to determine how to behave. Right now, make update-plist reports this to me:
>
> Can't put into any plist (no applicable prefix):
> /etc/netdata
> /etc/netdata/charts.d
> /etc/netdata/charts.d/.keep
> /etc/netdata/edit-config
> /etc/netdata/health.d
> /etc/netdata/health.d/.keep
> /etc/netdata/node.d
> /etc/netdata/node.d/.keep
> /etc/netdata/python.d
> /etc/netdata/python.d/.keep
> /etc/netdata/statsd.d
> /etc/netdata/statsd.d/.keep
> /var/cache/netdata
> /var/cache/netdata/.keep
> /var/lib
> /var/lib/netdata
> /var/lib/netdata/.keep
> /var/lib/netdata/registry
> /var/lib/netdata/registry/.keep
> /var/log/netdata
> /var/log/netdata/.keep
>
> Do any of you have experience porting programs like this, where clobbering its own config in /etc is intended behavior? I would appreciate any tips for how to create a PLIST for a program like this. My current port is attached, so you don't have to repeat my work if you want to poke at it.
>
> Also, this is my first from-scratch port. I'm not finished yet, but if you see anything else obviously wrong with what I've done, I'd appreciate guidance there too!
>
> Sincerely,
> William Leuschner
Started looking at the plists and got a bit carried away with other
things :) Here's what I have which takes it a bit further.
New tgz attached but I'll explain some of it inline (and there are
comments in Makefile)
: +# XXX restrict for now; 64-bit time_t issues;
: +ONLY_FOR_ARCHS = ${LP64_ARCHS}
you made a start at this but there are still some left; seems best to
disable on !lp64 arches until that's complete
: COMMENT = real time performance monitoring daemon and web interface
:
: -#
: -# What port/package will be created
: -#
: -V = v1.15.0
: -DISTNAME = netdata-${V}
: +V = 1.15.0
: +DISTNAME = netdata-v${V}
: +PKGNAME = netdata-${V}
by default PKGNAME=${DISTNAME}, but -v1.15.0 isn't a proper version number
for packages
: -CATEGORIES = net
: +CATEGORIES = sysutils
think sysutils is a better fit considering the location of other similar-ish ports
: +# in main binary
: +LIB_DEPENDS = archivers/lz4 \
: + devel/libuv \
: + sysutils/e2fsprogs
: +
: +# used by multiple plugins
: +RUN_DEPENDS += net/curl \
: + shells/bash
i've listed the deps that i've found so far, split up into "used in lots of
places" and "used only in specific plugins" because it might be preferable
to split the package up into main + extras (to reduce the dependencies
needed for the main thing)
: +FAKE_FLAGS = configdir="${PREFIX}/share/examples/netdata"
this relates to the PLIST handling; overrides the directory used for the
files/dirs previously installed to WRKINST/etc/netdata to place them
into share/examples instead for the port. (then they are copied at
pkg_add time by using @sample in PLIST).
if it was *just* the empty dir's I would have probably just used @sample
to create them and not bothered overriding the install directory, but
there's also the edit-config file which needs to be installed somewhere.
there are also the /var directories; they only have junk .keep files in
them so for those I've just @sample'd the directories for these.
: +CONFIGURE_ENV = CPPFLAGS="-I${LOCALBASE}/include" \
: + LDFLAGS="-L${LOCALBASE}/lib"
i modified your configure.ac patch that add -I/usr/local/include etc;
these are supposed to not be hardcoded; rather than patching for
variable names we can just pass them via env instead
: +CONFIGURE_ARGS += --with-user=_netdata
upstream default is nobody; that is meant to be only used for nfs,
we use per-service uids
: +# the following are used by individual plugins; these could be split off
: +# into sub-packages to avoid heavier deps for the main netdata package
: +# (though not worth it for lighter deps). probably an incomplete list.
: +
: +# - freeipmi.plugin (--enable-plugin-freeipmi)
: +LIB_DEPENDS += sysutils/freeipmi
: +WANTLIB += ipmimonitoring
: +
: +# - cups.plugin (--enable-plugin-cups)
: +# are libs enough or does it also need bins?
: +LIB_DEPENDS += print/cups,-libs
: +WANTLIB += cups
: +
: +# - fping.plugin
: +RUN_DEPENDS += net/fping
: +
: +# - ioping.plugin
: +RUN_DEPENDS += sysutils/ioping
list deps, as above
there are definitely dep's missing still; some plugins use node,
py-mysqlclient, py-psycopg2, py-dnspython, ..
: +# needs libyajl and libxenstat
: +CONFIGURE_ARGS += --disable-plugin-xenstat
: +# needs libcurl and libaws-cpp-sdk-{core,kinesis}
: +CONFIGURE_ARGS += --disable-backend-kinesis
: +# linux netflow accounting
: +CONFIGURE_ARGS += --disable-plugin-nfacct
explicitly disable some things that we don't have
: +post-install:
: + find ${WRKINST} -name .keep -delete
: + ${INSTALL_DATA} ${WRKSRC}/system/netdata.conf \
: + ${PREFIX}/share/examples/netdata/netdata.conf
remove the junk .keep files, install sample netdata.conf
: --- libnetdata/threads/threads.c.orig
: +++ libnetdata/threads/threads.c
: -@@ -26,25 +26,7 @@ const char *netdata_thread_tag(void) {
: - // compatibility library functions
: +@@ -30,7 +30,7 @@ pid_t gettid(void) {
: +
: + return (pid_t)pthread_getthreadid_np();
:
: - pid_t gettid(void) {
: --#ifdef __FreeBSD__
: --
: -- return (pid_t)pthread_getthreadid_np();
: --
: -#elif defined(__APPLE__)
: ++#elif defined(__APPLE__) || defined(__OpenBSD__)
: --
: -- #if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)
: -- uint64_t curthreadid;
: -- pthread_threadid_np(NULL, &curthreadid);
: -- return (pid_t)curthreadid;
: -- #else /* __MAC_OS_X_VERSION_MIN_REQUIRED */
: -- return (pid_t)pthread_self;
: --
No comments:
Post a Comment