# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit go-module DESCRIPTION="Prometheus exporter that exposes metrics from apcupsd's NIS" HOMEPAGE="https://github.com/mdlayher/apcupsd_exporter" BDEPEND=" >=dev-lang/go-1.14 " RDEPEND=" acct-group/apcupsd_exporter acct-user/apcupsd_exporter " SRC_URI=" https://github.com/mdlayher/apcupsd_exporter/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz https://gitlab.phys-el.ru/gentoo/phackerlay-distfiles/-/raw/master/${P}-deps.tar.xz " LICENSE="MIT" SLOT="0" KEYWORDS="~amd64" RESTRICT+=" test" A=' PV=0.3.0 PN=apcupsd_exporter wget https://github.com/mdlayher/apcupsd_exporter/archive/refs/tags/v${PV}.tar.gz && \ tar -xf v$PV.tar.gz && \ rm v$PV.tar.gz && \ cd $PN-$PV/ && \ GOMODCACHE="${PWD}"/go-mod go mod download -modcacherw && \ XZ_OPT="-T0 -9" tar -acf $PN-$PV-deps.tar.xz go-mod && \ mv $PN-$PV-deps.tar.xz ../../../distfiles/ && \ cd .. && \ rm -rf $PN-${PV} ' src_compile() { unset LDFLAGS cd ${S} && go build ${S}/cmd/apcupsd_exporter/main.go } src_install() { newbin ${S}/main apcupsd_exporter newconfd "${FILESDIR}"/apcupsd_exporter.confd apcupsd_exporter newinitd "${FILESDIR}"/apcupsd_exporter.rc apcupsd_exporter }