dev-go/go-bindata: bump to 1.0.0
[gentoo.git] / app-metrics / redis_exporter / redis_exporter-0.15.0.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit user golang-build golang-vcs-snapshot systemd
6
7 EGO_PN="github.com/oliver006/redis_exporter"
8 EGIT_COMMIT="a0d9e4c704b4d35cd08544d395038f417716a03a"
9 ARCHIVE_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
10 KEYWORDS="~amd64"
11
12 DESCRIPTION="Prometheus Exporter for Redis Metrics. Supports Redis 2.x, 3.x and 4.x"
13 HOMEPAGE="https://github.com/oliver006/redis_exporter"
14 SRC_URI="${ARCHIVE_URI}"
15 LICENSE="MIT"
16 SLOT="0"
17 IUSE=""
18
19 pkg_setup() {
20         enewgroup ${PN}
21         enewuser ${PN} -1 -1 -1 ${PN}
22 }
23
24 src_prepare() {
25         default
26         sed -e "s|\(^[[:space:]]*VERSION[[:space:]]*=[[:space:]]*\).*|\1\"${PV}\"|" \
27                 -e "s|\(^[[:space:]]*BUILD_DATE[[:space:]]*=[[:space:]]*\).*|\1\"$(LC_ALL=C date -u)\"|" \
28                 -e "s|\(^[[:space:]]*COMMIT_SHA1[[:space:]]*=[[:space:]]*\).*|\1\"${EGIT_COMMIT}\"|" \
29                 -i src/${EGO_PN}/main.go || die
30 }
31
32 src_compile() {
33         pushd src/${EGO_PN} || die
34         GOPATH="${S}" \
35                 go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}"
36         popd || die
37 }
38
39 src_install() {
40         dobin bin/redis_exporter
41         dodoc src/${EGO_PN}/README.md
42         local dir
43         for dir in /var/{lib,log}/${PN}; do
44                 keepdir "${dir}"
45                 fowners ${PN}:${PN} "${dir}"
46         done
47         newinitd "${FILESDIR}"/${PN}.initd ${PN}
48         newconfd "${FILESDIR}"/${PN}.confd ${PN}
49         insinto /etc/logrotate.d
50         newins "${FILESDIR}/${PN}.logrotated" "${PN}"
51         systemd_dounit "${FILESDIR}/${PN}.service"
52 }