public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-metrics/portage-exporter/, app-metrics/portage-exporter/files/
@ 2023-03-08  1:01 Robin H. Johnson
  0 siblings, 0 replies; only message in thread
From: Robin H. Johnson @ 2023-03-08  1:01 UTC (permalink / raw
  To: gentoo-commits

commit:     e296d2dccc964091675d6b275ead7020ca8b7375
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  8 01:00:45 2023 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed Mar  8 01:01:00 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e296d2dc

app-metrics/portage-exporter: new package

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 app-metrics/portage-exporter/Manifest              |  2 +
 .../portage-exporter/files/portage-exporter.confd  | 26 +++++++++++
 .../portage-exporter/files/portage-exporter.initd  | 49 ++++++++++++++++++++
 app-metrics/portage-exporter/metadata.xml          | 14 ++++++
 .../portage-exporter-0_p20230307.ebuild            | 52 ++++++++++++++++++++++
 5 files changed, 143 insertions(+)

diff --git a/app-metrics/portage-exporter/Manifest b/app-metrics/portage-exporter/Manifest
new file mode 100644
index 000000000000..f79a57b4631c
--- /dev/null
+++ b/app-metrics/portage-exporter/Manifest
@@ -0,0 +1,2 @@
+DIST portage-exporter-0_p20230307.tar.gz 32044 BLAKE2B 23e590aba88bf071568e9643b22ec51d6fcaff11b5eb5ea1e66d39cf49468238cbb80a44a865ba7bbccb631540e33ab5a417201ec995227e84d122601c868fad SHA512 1e3bd18cf44ad849b0ee0a2dc737f6d334ce9dd29d03f53a05298df2013be8c77a7ed66c3171cc6c765ad21ab7705fd747856d95ef3259cc83fac85544e81781
+DIST portage-exporter-ae39c6be10364896683ab1af0512ee8453bc153e-vendor.tar.xz 784800 BLAKE2B 600f207b15e54ab0f4c27691ce41efcdd3706bfc82c9170da3ebf2eb6283b5595bca08d7eebd3c7b5a6b2c7bcef704e70946e3fab63a537cf03ffa7dbe4a57a0 SHA512 e6e91296e8220d9fb34e0837714108d8806801d6799e49dc27b7dcaf8ddf39a92bff232ec3d616019ef5ae5c437bc81eee719ca658c299a35e8f1b165e38d3eb

diff --git a/app-metrics/portage-exporter/files/portage-exporter.confd b/app-metrics/portage-exporter/files/portage-exporter.confd
new file mode 100644
index 000000000000..3bd24a22a809
--- /dev/null
+++ b/app-metrics/portage-exporter/files/portage-exporter.confd
@@ -0,0 +1,26 @@
+# /etc/conf.d/portage-exporter
+
+# PID file
+#EXPORTER_PIDFILE="/run/${RC_SVCNAME}.pid"
+
+# The termination timeout (start-stop-daemon parameter "retry") ensures
+# that the service will be terminated within a given time (60 + 5 seconds
+# per default) when you are stopping the service.
+#EXPORTER_TERMTIMEOUT="TERM/60/KILL/5"
+
+# User to run exporter as
+#EXPORTER_USER="portage-exporter"
+
+# User group to run exporter as
+#EXPORTER_GROUP="portage-exporter"
+
+# You can use this configuration option to pass additional options to the
+# start-stop-daemon, see start-stop-daemon(8) for more details.
+# Per default we wait 1000ms after we have started the service to ensure
+# that the daemon is really up and running.
+#EXPORTER_SSDARGS="--wait 1000"
+
+# Exporter flags (passed via env)
+#SERVE_ADDRESS=":2112"
+#SERVE_PATH=/metrics
+VDB_UPDATE_INTERVAL=1800

diff --git a/app-metrics/portage-exporter/files/portage-exporter.initd b/app-metrics/portage-exporter/files/portage-exporter.initd
new file mode 100644
index 000000000000..9aa53f509a6e
--- /dev/null
+++ b/app-metrics/portage-exporter/files/portage-exporter.initd
@@ -0,0 +1,49 @@
+#!/sbin/openrc-run
+# Copyright 2016-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Prometheus exporter for Portage packages"
+
+EXPORTER_FLAGS=${EXPORTER_FLAGS:-""}
+#EXPORTER_USER=${EXPORTER_USER:-"portage-exporter"}
+#EXPORTER_GROUP=${EXPORTER_GROUP:-"portage-exporter"}
+EXPORTER_PIDFILE=${EXPORTER_PIDFILE:-"/run/${RC_SVCNAME}.pid"}
+EXPORTER_SSDARGS=${EXPORTER_SSDARGS:-"--wait 1000"}
+EXPORTER_TERMTIMEOUT=${EXPORTER_TERMTIMEOUT:-"TERM/60/KILL/5"}
+
+command="/usr/bin/portage-exporter"
+command_args="${EXPORTER_FLAGS}"
+command_background="true"
+start_stop_daemon_args="${EXPORTER_SSDARGS}"
+start_stop_daemon_args="${start_stop_daemon_args} ${EXPORTER_USER:+--user }${EXPORTER_USER}"
+start_stop_daemon_args="${start_stop_daemon_args} ${EXPORTER_GROUP:+--group }${EXPORTER_GROUP}"
+
+getconfig() {
+	local key="$1"
+	local value_default="$2"
+	local value=
+
+	if service_started; then
+		value="$(service_get_value "${key}")"
+	fi
+
+	if [ -z "${value}" ]; then
+		# Value not explicitly set
+		echo "${value_default}"
+	else
+		echo "${value}"
+	fi
+
+	return 0
+}
+
+pidfile="$(getconfig pidfile ${EXPORTER_PIDFILE})"
+retry="$(getconfig retry ${EXPORTER_TERMTIMEOUT})"
+
+depend() {
+	after net.lo loopback
+}
+
+start_post() {
+	service_set_value retry "${EXPORTER_TERMTIMEOUT}"
+}

diff --git a/app-metrics/portage-exporter/metadata.xml b/app-metrics/portage-exporter/metadata.xml
new file mode 100644
index 000000000000..7fe25777ee4c
--- /dev/null
+++ b/app-metrics/portage-exporter/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person">
+		<email>robbat2@gentoo.org</email>
+	</maintainer>
+	<maintainer type="person">
+		<!-- upstream -->
+		<email>arthurzam@gentoo.org</email>
+	</maintainer>
+	<upstream>
+		<remote-id type="github">projg2/portage-exporter</remote-id>
+	</upstream>
+</pkgmetadata>

diff --git a/app-metrics/portage-exporter/portage-exporter-0_p20230307.ebuild b/app-metrics/portage-exporter/portage-exporter-0_p20230307.ebuild
new file mode 100644
index 000000000000..539b7fd8c786
--- /dev/null
+++ b/app-metrics/portage-exporter/portage-exporter-0_p20230307.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit go-module
+# uncomment the first setting of MY_PV for a normal release
+# MY_PV="v${PV/_rc/-rc.}"
+# set MY_PV to the full commit hash for a snapshot release
+MY_PV_HASH=ae39c6be10364896683ab1af0512ee8453bc153e
+HOMEPAGE="https://github.com/projg2/portage-exporter"
+if [[ -n "${MY_PV_HASH}" ]]; then
+	MY_PV=${MY_PV_HASH}
+	EXPORTER_COMMIT=${MY_PV_HASH:0:8}
+	SRC_URI_UPSTREAM="${HOMEPAGE}/archive/${MY_PV}.tar.gz"
+else
+	MY_PV=${PV}
+	EXPORTER_COMMIT=
+	SRC_URI_UPSTREAM="${HOMEPAGE}/archive/refs/tags/v${PV}.tar.gz"
+fi
+MY_P=${PN}-${MY_PV}
+SRC_URI_VENDOR="https://dev.gentoo.org/~robbat2/distfiles/${MY_P}-vendor.tar.xz"
+#SRC_URI_VENDOR="https://dev.gentoo.org/~robbat2/distfiles/${MY_P}-go-mod.tar.xz"
+
+DESCRIPTION="Prometheus exporter for Gentoo Portage"
+SRC_URI="
+	${SRC_URI_UPSTREAM} -> ${P}.tar.gz
+	${SRC_URI_VENDOR}
+	"
+
+LICENSE="Apache-2.0 BSD MIT GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+BDEPEND=""
+DEPEND=""
+RDEPEND=""
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+PATCHES=( )
+
+src_compile() {
+	#cd ./cmd/portage-exporter/
+	#ego build
+	ego build -o "${PN}" ./cmd/portage-exporter/
+}
+
+src_install() {
+	dobin ${PN}
+
+	newinitd "${FILESDIR}"/${PN}.initd ${PN}
+	newconfd "${FILESDIR}"/${PN}.confd ${PN}
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-08  1:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-08  1:01 [gentoo-commits] repo/gentoo:master commit in: app-metrics/portage-exporter/, app-metrics/portage-exporter/files/ Robin H. Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox