diff options
author | Rahil Bhimjiani <me@rahil.rocks> | 2024-02-13 23:31:01 +0530 |
---|---|---|
committer | Joonas Niilola <juippis@gentoo.org> | 2024-03-16 11:07:09 +0200 |
commit | 5e9eb52e406f20e90540b3f4f782ed29eb1977a0 (patch) | |
tree | debb2ad5a8078dc3b64e0d2308d4018fba274057 /app-metrics | |
parent | app-crypt/tpm2-openssl: Fix src_prepare and let upstream script setup TPM sim... (diff) | |
download | gentoo-5e9eb52e406f20e90540b3f4f782ed29eb1977a0.tar.gz gentoo-5e9eb52e406f20e90540b3f4f782ed29eb1977a0.tar.bz2 gentoo-5e9eb52e406f20e90540b3f4f782ed29eb1977a0.zip |
app-metrics/node_exporter: add 1.7.0-r1
* Remove the patch, staying close to upstream. Adjust conf.d and
systemd.service exec args accordingly
* update 9999 ebuild to code style of 1.7.0
* Fix ordering of src_prepare
Signed-off-by: Rahil Bhimjiani <me@rahil.rocks>
Closes: https://github.com/gentoo/gentoo/pull/35308
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'app-metrics')
4 files changed, 92 insertions, 16 deletions
diff --git a/app-metrics/node_exporter/files/node_exporter-1.7.0.service b/app-metrics/node_exporter/files/node_exporter-1.7.0.service index e704c809b8e5..b1723196b9db 100644 --- a/app-metrics/node_exporter/files/node_exporter-1.7.0.service +++ b/app-metrics/node_exporter/files/node_exporter-1.7.0.service @@ -9,7 +9,7 @@ User=node_exporter Group=node_exporter Restart=on-failure Type=exec -ExecStart=/usr/sbin/node_exporter +ExecStart=/usr/sbin/node_exporter --collector.textfile.directory=/var/lib/node_exporter ExecReload=/usr/bin/kill -HUP $MAINPID TimeoutStopSec=20s SendSIGKILL=no diff --git a/app-metrics/node_exporter/files/node_exporter.confd b/app-metrics/node_exporter/files/node_exporter.confd index b65652001308..2feccf6346e4 100644 --- a/app-metrics/node_exporter/files/node_exporter.confd +++ b/app-metrics/node_exporter/files/node_exporter.confd @@ -1,2 +1,2 @@ # arguments for prometheus node exporter -command_args="--collector.textfile.directory=/var/lib/node_exporter/" +command_args="--collector.textfile.directory=/var/lib/node_exporter/ --collector.textfile.directory=/var/lib/node_exporter" diff --git a/app-metrics/node_exporter/node_exporter-1.7.0-r1.ebuild b/app-metrics/node_exporter/node_exporter-1.7.0-r1.ebuild new file mode 100644 index 000000000000..9e3f1d237576 --- /dev/null +++ b/app-metrics/node_exporter/node_exporter-1.7.0-r1.ebuild @@ -0,0 +1,75 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit go-module systemd + +DESCRIPTION="Prometheus exporter for machine metrics" +HOMEPAGE="https://github.com/prometheus/node_exporter" + +if [[ ${PV} == 9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/prometheus/node_exporter.git" +else + SRC_URI="https://github.com/prometheus/node_exporter/archive/v${PV}.tar.gz -> ${P}.tar.gz" + SRC_URI+=" https://github.com/rahilarious/gentoo-distfiles/releases/download/${P}/deps.tar.xz -> ${P}-deps.tar.xz" + KEYWORDS="~amd64 ~arm64 ~loong ~riscv ~x86" +fi + +# main pkg +LICENSE="Apache-2.0" +# deps +LICENSE+=" BSD BSD-2 MIT" +SLOT="0" +IUSE="selinux systemd" + +COMMON_DEPEND=" + acct-group/node_exporter + acct-user/node_exporter + selinux? ( sec-policy/selinux-node_exporter ) + systemd? ( sys-apps/systemd ) +" +DEPEND="${COMMON_DEPEND}" +RDEPEND="${COMMON_DEPEND}" +BDEPEND=">=dev-util/promu-0.3.0" + +src_unpack() { + if [[ ${PV} == 9999* ]]; then + git-r3_src_unpack + go-module_live_vendor + else + go-module_src_unpack + fi +} + +src_prepare() { + default + use systemd && { sed -i -e "s|defaultDisabled|defaultEnabled|g;" collector/systemd_linux.go || die; } +} + +src_compile() { + if use x86; then + #917577 pie breaks build on x86 + GOFLAGS=${GOFLAGS//-buildmode=pie} + fi + promu build -v || die + ./"${PN}" --help-man > "${PN}".1 || die +} + +src_test() { + emake test-flags= test +} + +src_install() { + dosbin "${PN}" + dodoc example-rules.yml *.md + doman "${PN}".1 + systemd_newunit "${FILESDIR}"/node_exporter-1.7.0.service node_exporter.service + newinitd "${FILESDIR}"/${PN}.initd-1 ${PN} + newconfd "${FILESDIR}"/${PN}.confd ${PN} + insinto /etc/logrotate.d + newins "${FILESDIR}"/node_exporter-1.7.0.logrotate "${PN}" + keepdir /var/lib/node_exporter /var/log/node_exporter + fowners ${PN}:${PN} /var/lib/node_exporter /var/log/node_exporter +} diff --git a/app-metrics/node_exporter/node_exporter-9999.ebuild b/app-metrics/node_exporter/node_exporter-9999.ebuild index e02032dc5f61..9e3f1d237576 100644 --- a/app-metrics/node_exporter/node_exporter-9999.ebuild +++ b/app-metrics/node_exporter/node_exporter-9999.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -24,22 +24,15 @@ LICENSE+=" BSD BSD-2 MIT" SLOT="0" IUSE="selinux systemd" -RDEPEND=" +COMMON_DEPEND=" acct-group/node_exporter acct-user/node_exporter selinux? ( sec-policy/selinux-node_exporter ) systemd? ( sys-apps/systemd ) " -DEPEND="${RDEPEND}" +DEPEND="${COMMON_DEPEND}" +RDEPEND="${COMMON_DEPEND}" BDEPEND=">=dev-util/promu-0.3.0" -PATCHES=( - "${FILESDIR}"/01-default-settings-1.7.0.patch -) - -src_prepare() { - default - use !systemd && { sed -i -e "s|defaultEnabled|defaultDisabled|g;" collector/systemd_linux.go || die; } -} src_unpack() { if [[ ${PV} == 9999* ]]; then @@ -50,7 +43,16 @@ src_unpack() { fi } +src_prepare() { + default + use systemd && { sed -i -e "s|defaultDisabled|defaultEnabled|g;" collector/systemd_linux.go || die; } +} + src_compile() { + if use x86; then + #917577 pie breaks build on x86 + GOFLAGS=${GOFLAGS//-buildmode=pie} + fi promu build -v || die ./"${PN}" --help-man > "${PN}".1 || die } @@ -61,6 +63,8 @@ src_test() { src_install() { dosbin "${PN}" + dodoc example-rules.yml *.md + doman "${PN}".1 systemd_newunit "${FILESDIR}"/node_exporter-1.7.0.service node_exporter.service newinitd "${FILESDIR}"/${PN}.initd-1 ${PN} newconfd "${FILESDIR}"/${PN}.confd ${PN} @@ -68,7 +72,4 @@ src_install() { newins "${FILESDIR}"/node_exporter-1.7.0.logrotate "${PN}" keepdir /var/lib/node_exporter /var/log/node_exporter fowners ${PN}:${PN} /var/lib/node_exporter /var/log/node_exporter - - doman "${PN}".1 - dodoc example-rules.yml *.md } |