archrelease: copy trunk to extra-x86_64
[arch-packages.git] / prometheus-node-exporter / trunk / PKGBUILD
blobc6bf8185fb932274db447cef5aef68e0693e2447
1 # Maintainer: Johannes Löthberg <johannes@kyriasis.com>
3 pkgname=prometheus-node-exporter
4 pkgver=1.3.1
5 pkgrel=1
7 pkgdesc='Exporter for machine metrics'
8 url='https://github.com/prometheus/node_exporter'
9 arch=('x86_64')
10 license=('Apache')
12 depends=('glibc')
13 makedepends=('go' 'git')
15 backup=('etc/conf.d/prometheus-node-exporter')
17 source=("$pkgname-$pkgver.tar.gz::https://github.com/prometheus/node_exporter/archive/v$pkgver.tar.gz"
18         prometheus-node-exporter.conf
19         prometheus-node-exporter.service
20         prometheus-node-exporter.sysusers)
22 sha256sums=('66856b6b8953e094c46d7dd5aabd32801375cf4d13d9fe388e320cbaeaff573a'
23             'ce93e2b95bfc86a8a046e2f9175408e1cbffa784fd3b65dd141fde70b5bb2585'
24             '457e305760323f941d20248e2ca5817ae4a8b5586f79a2331b968bf3baa66c5b'
25             'c7fd0b1793dfe7a354a28e978d3c79e7195eaf43376b9eece37e996fe0772c5c')
27 build() {
28   cd node_exporter-$pkgver
30   go build \
31     -trimpath \
32     -buildmode=pie \
33     -mod=readonly \
34     -modcacherw \
35     -ldflags "-linkmode external -extldflags ${LDFLAGS} \
36       -X github.com/prometheus/common/version.Version=$pkgver \
37       -X github.com/prometheus/common/version.Revision=$pkgver \
38       -X github.com/prometheus/common/version.Branch=tarball \
39       -X github.com/prometheus/common/version.BuildUser=someone@builder \
40       -X github.com/prometheus/common/version.BuildDate=$(date -d=@"$SOURCE_DATE_EPOCH" +%Y%m%d-%H:%M:%S)" \
41     .
44 check() {
45   cd node_exporter-$pkgver
47   make collector/fixtures/sys/.unpacked
48   go test ./...
49   ./end-to-end-test.sh
52 package () {
53   install -Dm644 prometheus-node-exporter.conf "$pkgdir"/etc/conf.d/prometheus-node-exporter
54   install -Dm644 prometheus-node-exporter.service "$pkgdir"/usr/lib/systemd/system/prometheus-node-exporter.service
55   install -Dm644 prometheus-node-exporter.sysusers "$pkgdir"/usr/lib/sysusers.d/prometheus-node-exporter.conf
57   cd node_exporter-$pkgver
59   install -Dm755 node_exporter "$pkgdir"/usr/bin/prometheus-node-exporter