aboutsummaryrefslogtreecommitdiffstats
path: root/community/grafana/APKBUILD
blob: 025311eaea7d8494b936d9acbe43741a4a8f08b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Contributor: Konstantin Kulikov <k.kulikov2@gmail.com>
# Maintainer: Konstantin Kulikov <k.kulikov2@gmail.com>
pkgname=grafana
pkgver=7.3.6
pkgrel=0
_commit=f25d63954b # git rev-parse --short HEAD
_stamp=1608198868 # git --no-pager show -s --format=%ct
pkgdesc="Open source, feature rich metrics dashboard and graph editor"
url="https://grafana.com"
arch="all !mips !mips64" # go is missing
license="Apache-2.0"
makedepends="go"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
options="net chmod-clean"
source="$pkgname-$pkgver.tar.gz::https://github.com/grafana/grafana/archive/v$pkgver.tar.gz
	$pkgname-$pkgver-bin.tar.gz::https://dl.grafana.com/oss/release/grafana-$pkgver.linux-amd64.tar.gz
	$pkgname.initd
	$pkgname.confd"

export GOPATH=${GOPATH:-$srcdir/go}
export GOCACHE=${GOCACHE:-$srcdir/go-build}
export GOTMPDIR=${GOTMPDIR:-$srcdir}

# secfixes:
#   7.0.2-r0:
#     - CVE-2020-13379
#   6.3.4-r0:
#     - CVE-2019-15043

build() {
	local ldflags="-X main.version=$pkgver -X main.commit=$_commit -X main.buildstamp=$_stamp"
	go build -ldflags "$ldflags" -v github.com/grafana/grafana/pkg/cmd/grafana-server
	go build -ldflags "$ldflags" -v github.com/grafana/grafana/pkg/cmd/grafana-cli
}

check() {
	local pkgs="./..."
	case "$CARCH" in
	# https://github.com/grafana/grafana/issues/26389
	x86) pkgs="$(go list ./... | grep -Ev '(pkg/tsdb$)')" ;;
	# https://github.com/grafana/grafana/issues/26390
	s390x) pkgs="$(go list ./... | grep -Ev '(pkg/tsdb/influxdb/flux$)')" ;;
	esac

	go test $pkgs
}

package() {
	install -Dm755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
	install -Dm644 "$srcdir/$pkgname.confd" "$pkgdir/etc/conf.d/$pkgname"
	install -Dm755 "$builddir/$pkgname-server" "$pkgdir/usr/sbin/$pkgname-server"
	install -Dm755 "$builddir/$pkgname-cli" "$pkgdir/usr/bin/$pkgname-cli"
	install -Dm644 "$builddir/conf/sample.ini" "$pkgdir/etc/grafana.ini"
	install -dm755 "$pkgdir/usr/share/grafana"
	cp -r "$builddir/conf" "$builddir/public" "$pkgdir/usr/share/$pkgname/"
}

sha512sums="c500565c6cd7b7f3a7d8c1d4924b9ba576db2a765ad184e9bd32373ebbb8792c1812b6c866ba652634f134105af59ddaf023f0da44c067bb77112bcd431a30b4  grafana-7.3.6.tar.gz
b3a0111acf8ce061fcdab69d75c5dd1011e97d87f90caaaa95fc31ee4af9fff390ceb07e01afc1140ac30900e50cb39146337b2a127cac50934d2714c4d2b3e2  grafana-7.3.6-bin.tar.gz
b0a781e1b1e33741a97e231c761b1200239c6f1235ffbe82311fe883387eb23bef262ad68256ebd6cf87d74298041b53b947ea7a493cfa5aa814b2a1c5181e13  grafana.initd
c2d9896ae9a9425f759a47aeab42b7c43b63328e82670d50185de8c08cda7b8df264c8b105c5c3138b90dd46e86598b16826457eb3b2979a899b3a508cbe4e8c  grafana.confd"