app-metrics/node_exporter: sync live

Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
This commit is contained in:
Arthur Zamarin 2025-10-28 22:44:00 +02:00
parent 8cc572ae05
commit 994be66c9e
No known key found for this signature in database
GPG Key ID: 02A0AF503D120504

View File

@ -13,26 +13,24 @@ if [[ ${PV} == 9999* ]]; then
EGIT_REPO_URI="https://github.com/prometheus/node_exporter.git" EGIT_REPO_URI="https://github.com/prometheus/node_exporter.git"
else else
SRC_URI="https://github.com/prometheus/node_exporter/archive/v${PV}.tar.gz -> ${P}.tar.gz" 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" SRC_URI+=" https://github.com/gentoo-golang-dist/${PN}/releases/download/v${PV}/${P}-vendor.tar.xz"
KEYWORDS="~amd64 ~arm64 ~loong ~riscv ~x86" KEYWORDS="~amd64 ~arm64 ~loong ~riscv ~x86"
fi fi
# main pkg # main pkg
LICENSE="Apache-2.0" LICENSE="Apache-2.0"
# deps # Dependent licenses
LICENSE+=" BSD BSD-2 MIT" LICENSE+=" Apache-2.0 BSD BSD-2 MIT MPL-2.0"
SLOT="0" SLOT="0"
IUSE="selinux" IUSE="selinux"
COMMON_DEPEND=" DEPEND="
acct-group/node_exporter acct-group/node_exporter
acct-user/node_exporter acct-user/node_exporter
selinux? ( sec-policy/selinux-node_exporter ) selinux? ( sec-policy/selinux-node_exporter )
" "
DEPEND="${COMMON_DEPEND}" RDEPEND="${DEPEND}"
RDEPEND="${COMMON_DEPEND}"
BDEPEND=">=dev-util/promu-0.17.0"
src_unpack() { src_unpack() {
if [[ ${PV} == 9999* ]]; then if [[ ${PV} == 9999* ]]; then
@ -43,17 +41,19 @@ src_unpack() {
fi fi
} }
src_prepare() {
[[ ${PV} != 9999* ]] && { ln -sv ../vendor ./ || die ; }
default
}
src_compile() { src_compile() {
if use x86; then if use x86; then
#917577 pie breaks build on x86 #917577 pie breaks build on x86
GOFLAGS=${GOFLAGS//-buildmode=pie} GOFLAGS=${GOFLAGS//-buildmode=pie}
fi fi
promu build -v || die local go_ldflags=(
-X github.com/prometheus/common/version.Version=${PV}
-X github.com/prometheus/common/version.Revision=${GIT_COMMIT}
-X github.com/prometheus/common/version.Branch=master
-X github.com/prometheus/common/version.BuildUser=gentoo
-X github.com/prometheus/common/version.BuildDate="$(date +%F-%T)"
)
ego build -mod=vendor -ldflags "${go_ldflags[*]}" -o ${PN} .
./"${PN}" --help-man > "${PN}".1 || die ./"${PN}" --help-man > "${PN}".1 || die
} }
@ -65,13 +65,17 @@ src_install() {
dosbin "${PN}" dosbin "${PN}"
dodoc example-rules.yml *.md dodoc example-rules.yml *.md
doman "${PN}".1 doman "${PN}".1
systemd_dounit examples/systemd/node_exporter.{service,socket} systemd_dounit examples/systemd/node_exporter.{service,socket}
insinto /etc/sysconfig
newins examples/systemd/sysconfig.node_exporter node_exporter
newinitd "${FILESDIR}"/${PN}.initd-1 ${PN} newinitd "${FILESDIR}"/${PN}.initd-1 ${PN}
newconfd "${FILESDIR}"/${PN}.confd ${PN} newconfd "${FILESDIR}"/${PN}.confd ${PN}
insinto /etc/sysconfig
newins examples/systemd/sysconfig.node_exporter node_exporter
insinto /etc/logrotate.d insinto /etc/logrotate.d
newins "${FILESDIR}"/node_exporter-1.7.0.logrotate "${PN}" newins "${FILESDIR}"/node_exporter-1.7.0.logrotate "${PN}"
keepdir /var/lib/node_exporter/textfile_collector /var/log/node_exporter keepdir /var/lib/node_exporter/textfile_collector /var/log/node_exporter
fowners -R ${PN}:${PN} /var/lib/node_exporter /var/log/node_exporter fowners -R ${PN}:${PN} /var/lib/node_exporter /var/log/node_exporter
} }