db-move: moved polari from [testing] to [extra] (x86_64)
[arch-packages.git] / prometheus-memcached-exporter / repos / extra-x86_64 / PKGBUILD
blobcc4aaa1b6741d85a65325c63f44ff04c1a0cbff3
1 # Maintainer: Jelle van der Waa <jelle@dwaa.nl>
3 pkgname=prometheus-memcached-exporter
4 pkgver=0.11.2
5 pkgrel=1
6 pkgdesc="Exports metrics from memcached servers for consumption by Prometheus"
7 arch=('x86_64')
8 url="https://github.com/prometheus/memcached_exporter"
9 license=('Apache')
10 depends=(glibc memcached)
11 makedepends=(go)
12 backup=('etc/conf.d/prometheus-memcached-exporter')
13 source=($pkgname-$pkgver.tar.gz::https://github.com/prometheus/memcached_exporter/archive/v${pkgver}.tar.gz prometheus-memcached-exporter.service
14         prometheus-memcached-exporter.conf)
15 sha512sums=('36999cdaa2b1de36e661d359861b86379f7d7cc9176f10d6ed33748b50570815511ad881500eaed403991a62fee3fd4b5646956a5b38dc5d9ce47dd883e86a04'
16             '13ae8e9cc8445cffab1e51f000fbe5ca0dd2a30532f8303957dc376c8891552e719681e49ffd8a83c4cd01aca897031770c9d96ed92276ff85c2e32c4fa999ee'
17             'bc92af08207bee78a48cc764f038d6f5175b0051873f1238d90531f81d9b403085ec7ac62dfe934ee804794426c6bed4c309b374a418c9f7a4dbdbb157d58c23')
19 check() {
20   cd memcached_exporter-$pkgver
21   memcached_pids=()
22   memcached -p 11211 -U 11211 >/dev/null        & memcached_pids+=($!)
24   local ret=0
25   go test ./... || ret=1
27   kill ${memcached_pids[@]}
29   return $ret
32 build() {
33   cd memcached_exporter-$pkgver
34   go build \
35     -trimpath \
36     -buildmode=pie \
37     -mod=readonly \
38     -modcacherw \
39     -ldflags "-linkmode external -extldflags \"${LDFLAGS}\" \
40       -X github.com/prometheus/common/version.Version=$pkgver \
41       -X github.com/prometheus/common/version.Revision=$pkgver \
42       -X github.com/prometheus/common/version.Branch=tarball \
43       -X github.com/prometheus/common/version.BuildUser=someone@builder \
44       -X github.com/prometheus/common/version.BuildDate=$(date -d=@"$SOURCE_DATE_EPOCH" +%Y%m%d-%H:%M:%S)" \
45     -o memcached_exporter cmd/memcached_exporter/main.go
48 package() {
49   install -Dm644 prometheus-memcached-exporter.service "$pkgdir"/usr/lib/systemd/system/prometheus-memcached-exporter.service
50   install -Dm644 prometheus-memcached-exporter.conf "${pkgdir}"/etc/conf.d/prometheus-memcached-exporter
52   cd memcached_exporter-$pkgver
53   install -Dm755 memcached_exporter "$pkgdir"/usr/bin/prometheus-memcached-exporter