svn commit: r491463 - head/sysutils/node_exporter
Mateusz Piotrowski
0mp at FreeBSD.org
Mon Jan 28 09:16:26 UTC 2019
Author: 0mp
Date: Mon Jan 28 09:16:24 2019
New Revision: 491463
URL: https://svnweb.freebsd.org/changeset/ports/491463
Log:
sysutils/node_exporter: Add tests, docs and examples
- Define LICENSE_FILE.
- Sort variables.
- Add a do-test target and prepare a testing environment. One test is
skipped at the moment due to a problem with detecting procfs(5) on
FreeBSD.
- Install documentation and examples.
- Change pkg-descr to better match upstream's README.
PR: 234791
Reviewed by: mat
Approved by: mat (mentor), maintainer timeout
Sponsored by: BALLY WULFF Games & Entertainment GmbH
Differential Revision: https://reviews.freebsd.org/D18792
Added:
head/sysutils/node_exporter/pkg-plist (contents, props changed)
Modified:
head/sysutils/node_exporter/Makefile
head/sysutils/node_exporter/pkg-descr
Modified: head/sysutils/node_exporter/Makefile
==============================================================================
--- head/sysutils/node_exporter/Makefile Mon Jan 28 09:00:35 2019 (r491462)
+++ head/sysutils/node_exporter/Makefile Mon Jan 28 09:16:24 2019 (r491463)
@@ -4,24 +4,34 @@
PORTNAME= node_exporter
PORTVERSION= 0.17.0
DISTVERSIONPREFIX=v
+PORTREVISION= 1
CATEGORIES= sysutils
MAINTAINER= ports at ecadlabs.com
COMMENT= Prometheus exporter for machine metrics
LICENSE= APACHE20
+LICENSE_FILE= ${WRKSRC}/LICENSE
-USES= go
-USE_GITHUB= yes
+TEST_DEPENDS= promtool:net-mgmt/prometheus2 \
+ bash:shells/bash \
+ gsed:textproc/gsed
+USES= gmake go shebangfix
+USE_GITHUB= yes
GH_ACCOUNT= prometheus
+USE_RC_SUBR= node_exporter
+# The ttar script is used to run the tests.
+SHEBANG_FILES= ttar
+
GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME}
GO_TARGET= github.com/${GH_ACCOUNT}/${PORTNAME}
-PLIST_FILES= bin/node_exporter
+# A "checkrules" target is being added in >0.17.0.
+TEST_TARGET= test
-USE_RC_SUBR= node_exporter
+TEST_ENV= PROMTOOL=${LOCALBASE}/bin/promtool
BUILD_USER?= ${USER}
LD_FLAG_X_PREFIX= -X ${GO_PKGNAME}/vendor/${GO_PKGNAME:H}/common/version
@@ -32,7 +42,38 @@ LD_FLAG_STRING= -s \
${LD_FLAG_X_PREFIX}.BuildUser=${BUILD_USER}
GO_BUILDFLAGS= -v -ldflags "${LD_FLAG_STRING}"
+OPTIONS_DEFINE= DOCS EXAMPLES
+
do-install:
${INSTALL_PROGRAM} ${WRKDIR}/bin/node_exporter ${STAGEDIR}${PREFIX}/bin
+
+post-install-DOCS-on:
+ ${MKDIR} ${STAGEDIR}${DOCSDIR}
+ cd ${WRKSRC}/docs && \
+ ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}
+
+post-install-EXAMPLES-on:
+ ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/text_collector_examples
+ cd ${WRKSRC} && ${COPYTREE_SHARE} ./text_collector_examples ${STAGEDIR}${EXAMPLESDIR}
+
+# TestFileDescriptorLeak is being skipped at the moment because procfs(5) is
+# not properly detected.
+pre-test:
+ # Prevent Go from attempting to use Git to redownload its dependencies.
+ # They are already present in ${WRKSRC}/vendor.
+ ${RM} ${WRKSRC}/go.mod
+
+ ${REINPLACE_CMD} -e 's|sed|${LOCALBASE}/bin/gsed|g' ${WRKSRC}/ttar
+
+ ${RM} -r ${WRKDIR}/src
+ ${LN} -sf ${WRKSRC}/vendor ${WRKDIR}/src
+ ${MKDIR} ${WRKSRC}/vendor/${GO_PKGNAME}
+ ${LN} -sf ${WRKSRC}/collector ${WRKSRC}/vendor/${GO_PKGNAME}/collector
+
+ # GOPATH has to have exactly one element in order to have the test
+ # suite detect the node_exporter binary. "-v" is added here for us to
+ # see skipped tests.
+ ${REINPLACE_CMD} -E 's|(\$$\(GO\) test)|env GOPATH="${WRKDIR}" \1 -v|g' ${WRKSRC}/Makefile
.include <bsd.port.mk>
Modified: head/sysutils/node_exporter/pkg-descr
==============================================================================
--- head/sysutils/node_exporter/pkg-descr Mon Jan 28 09:00:35 2019 (r491462)
+++ head/sysutils/node_exporter/pkg-descr Mon Jan 28 09:16:24 2019 (r491463)
@@ -1,4 +1,4 @@
-node_exporter is a prometheus exporter for machine metrics, written in Go
-with pluggable metric collectors.
+Node exporter is a Prometheus exporter for hardware and OS metrics, written in
+Go with pluggable metric collectors.
WWW: https://github.com/prometheus/node_exporter
Added: head/sysutils/node_exporter/pkg-plist
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/sysutils/node_exporter/pkg-plist Mon Jan 28 09:16:24 2019 (r491463)
@@ -0,0 +1,17 @@
+bin/node_exporter
+%%PORTDOCS%%%%DOCSDIR%%/README.md
+%%PORTDOCS%%%%DOCSDIR%%/TIME.md
+%%PORTDOCS%%%%DOCSDIR%%/V0_16_UPGRADE_GUIDE.md
+%%PORTDOCS%%%%DOCSDIR%%/example-16-compatibility-rules-new-to-old.yml
+%%PORTDOCS%%%%DOCSDIR%%/example-16-compatibility-rules.yml
+%%PORTDOCS%%%%DOCSDIR%%/example-17-compatibility-rules-new-to-old.yml
+%%PORTDOCS%%%%DOCSDIR%%/example-17-compatibility-rules.yml
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/README.md
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/apt.sh
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/deleted_libraries.py
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/directory-size.sh
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/ipmitool
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/md_info.sh
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/ntpd_metrics.py
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/smartmon.sh
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/text_collector_examples/storcli.py
More information about the svn-ports-head
mailing list