archrelease: copy trunk to extra-x86_64
[arch-packages.git] / prometheus-node-exporter / repos / extra-x86_64 / PKGBUILD
blob132999e4214755d64ec9b54a6b033cee7e1a4743
1 # Maintainer: Johannes Löthberg <johannes@kyriasis.com>
3 pkgname=prometheus-node-exporter
4 pkgver=1.5.0
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')
14 options=(!lto)
16 backup=('etc/conf.d/prometheus-node-exporter')
18 source=("$pkgname-$pkgver.tar.gz::https://github.com/prometheus/node_exporter/archive/v$pkgver.tar.gz"
19         prometheus-node-exporter.conf
20         prometheus-node-exporter.service
21         prometheus-node-exporter.sysusers)
23 sha256sums=('67c6d59359d8c484e1e28d0a52a971eebe687f083c5fbb35c5e651543e5d0ea4'
24             'ce93e2b95bfc86a8a046e2f9175408e1cbffa784fd3b65dd141fde70b5bb2585'
25             '457e305760323f941d20248e2ca5817ae4a8b5586f79a2331b968bf3baa66c5b'
26             'c7fd0b1793dfe7a354a28e978d3c79e7195eaf43376b9eece37e996fe0772c5c')
28 build() {
29   cd node_exporter-$pkgver
31   go build \
32     -trimpath \
33     -buildmode=pie \
34     -mod=readonly \
35     -modcacherw \
36     -ldflags "-linkmode external -extldflags ${LDFLAGS} \
37       -X github.com/prometheus/common/version.Version=$pkgver \
38       -X github.com/prometheus/common/version.Revision=$pkgver \
39       -X github.com/prometheus/common/version.Branch=tarball \
40       -X github.com/prometheus/common/version.BuildUser=someone@builder \
41       -X github.com/prometheus/common/version.BuildDate=$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m%d-%H:%M:%S)" \
42     .
45 check() {
46   cd node_exporter-$pkgver
47   make test
48   ./end-to-end-test.sh
51 package () {
52   install -Dm644 prometheus-node-exporter.conf "$pkgdir"/etc/conf.d/prometheus-node-exporter
53   install -Dm644 prometheus-node-exporter.service "$pkgdir"/usr/lib/systemd/system/prometheus-node-exporter.service
54   install -Dm644 prometheus-node-exporter.sysusers "$pkgdir"/usr/lib/sysusers.d/prometheus-node-exporter.conf
56   cd node_exporter-$pkgver
58   install -Dm755 node_exporter "$pkgdir"/usr/bin/prometheus-node-exporter