From b5857ab778aa09346a769de240b67958cd9639e1 Mon Sep 17 00:00:00 2001 From: Patrice Clement Date: Thu, 11 Apr 2024 11:19:54 +0200 Subject: [PATCH] app-metrics/sql_exporter: rework ebuild --- .../sql_exporter/sql_exporter-0.5.3.ebuild | 63 +++++++++---------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/app-metrics/sql_exporter/sql_exporter-0.5.3.ebuild b/app-metrics/sql_exporter/sql_exporter-0.5.3.ebuild index 332b19d3..8a3cf388 100644 --- a/app-metrics/sql_exporter/sql_exporter-0.5.3.ebuild +++ b/app-metrics/sql_exporter/sql_exporter-0.5.3.ebuild @@ -14,48 +14,43 @@ SLOT="0" KEYWORDS="~amd64" IUSE="doc" -DEPEND="dev-lang/go - acct-group/sql_exporter - acct-user/sql_exporter" -RDEPEND="acct-group/sql_exporter - acct-user/sql_exporter" +DEPEND=" + dev-lang/go + acct-group/sql_exporter + acct-user/sql_exporter" + +RDEPEND=" + ${DEPEND}" + EGO_PN="github.com/justwatchcom/sql_exporter" src_prepare() { - default - cd "${S}" || die - export GO111MODULE=auto + default + cd "${S}" || die + export GO111MODULE=auto } src_compile() { - export GOPATH="${S}" - cd "${S}/src/${EGO_PN}" || die - echo "compiling from $(pwd)" || die - go build -o "${S}/bin/sql_exporter" || die "Failed to build sql_exporter" + export GOPATH="${S}" + cd "${S}/src/${EGO_PN}" || die + echo "compiling from $(pwd)" || die + go build -o "${S}/bin/sql_exporter" || die "Failed to build sql_exporter" } -src_install() { - # Create user and group - enewgroup sql_exporter - enewuser sql_exporter -1 -1 /var/log/sql_exporter sql_exporter - - dobin "${S}/bin/sql_exporter" || die - newinitd "${FILESDIR}/sql_exporter.init.d" sql_exporter || die - exeinto /etc/init.d - newexe "${FILESDIR}/sql_exporter.init.d" sql_exporter || die - dosym /etc/init.d/sql_exporter /etc/runlevels/default/sql_exporter || die - - insinto /etc/sql_exporter - doins "${FILESDIR}/sql_exporter.yml" - - # Create log directory and file - if ! dodir /var/log/sql_exporter; then - die "Failed to create log directory" - fi - newins /dev/null sql_exporter.log || die "Failed to create log file" +src_test() { + cd "${S}/src/${EGO_PN}" || die + go test -v ./... || die "Tests failed" } -src_test() { - cd "${S}/src/${EGO_PN}" || die - go test -v ./... || die "Tests failed" +src_install() { + dobin "${S}/bin/sql_exporter" + newinitd "${FILESDIR}/sql_exporter.init.d" sql_exporter + dosym /etc/init.d/sql_exporter /etc/runlevels/default/sql_exporter || die + + insinto /etc/sql_exporter + doins "${FILESDIR}/sql_exporter.yml" + + # Create log directory and file + dodir /var/log/sql_exporter + touch "${ED}"/var/log/sql_exporter/sql_exporter.log || die "failed to create log file" }