~dricottone/huttese-apk

ref: b858cc074ac51266bde1973e83112ab44a82e418 huttese-apk/prometheus/grafana/APKBUILD -rw-r--r-- 3.2 KiB
b858cc07 — Drew DeVault prometheus/grafana: new APKBUILD 5 years ago
                                                                                
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
63
64
65
66
67
# Contributor: Konstantin Kulikov <k.kulikov2@gmail.com>
# Maintainer: Konstantin Kulikov <k.kulikov2@gmail.com>
pkgname=grafana
pkgver=6.5.0
pkgrel=0
_commit=24a5d2fe8b # git rev-parse --short HEAD
_stamp=1574679696 # git --no-pager show -s --format=%ct
pkgdesc="Open source, feature rich metrics dashboard and graph editor"
url="https://grafana.com"
arch="x86_64" # Builds are slow on arm archs, x86 requires python2.
license="Apache-2.0"
makedepends="go nodejs yarn"
options="chmod-clean" # Can be replaced with -modcacherw in go1.14
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/grafana/grafana/archive/v$pkgver.tar.gz
	go.mod go.sum apk.go $pkgname.initd $pkgname.confd"
builddir=$srcdir
options="!check" # Upstream will be given tests when they learn how to use them responsibly

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

# secfixes:
#   6.3.4-r0:
#   - CVE-2019-15043

build() {
	local ldflags="-X main.version=$pkgver -X main.commit=$_commit -X main.buildstamp=$_stamp"
	for pkg in $(go list -f '{{ join .Imports " " }}'); do
		go build -ldflags "$ldflags" -mod=readonly -v $pkg
	done

	cd $builddir/$pkgname-$pkgver

	# Don't pollute our git repo with grafanas commit hooks.
	# Also don't try to install phantomjs since it depends on glibc.
	# This command also acts as "yarn install".
	# ignore-engines is needed because grafana specifies max node version 11
	# but alpine ships 12, quick test shows that it works fine.
	yarn remove --pure-lockfile -W --ignore-engines husky phantomjs-prebuilt

	yarn --ignore-engines build --force
}

check() {
	# Skipped tests do not work in module mode.
	go test $(go list github.com/grafana/grafana/pkg/... | grep -Ev '(provisioning/dashboards)|(infra/log)|(grafana-cli/commands)')
}

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/$pkgname-$pkgver/conf/sample.ini" "$pkgdir/etc/grafana.ini"
	install -dm755 "$pkgdir/usr/share/grafana"
	cp -r "$builddir/$pkgname-$pkgver/conf" "$builddir/$pkgname-$pkgver/public" "$pkgdir/usr/share/$pkgname/"
}

sha512sums="ba13149485f6b4a4d1de9740a33d46377c694e321d2a5d26bcbf452cad3a91cda54e9979a9aa112318918ae7c011ce1b47cb797bd01e481c506a9a81d1299f5e  grafana-6.5.0.tar.gz
ee3e915c75aad9b80218f98c47eef418a5655a7dd4d7b3f6b1923aaca13a065b0f5b04ad92922d365ce84d1e0b2c700a434c315a18a363c25b8c23959892a449  go.mod
10caa000cba330bb9e223c3072b492b2c88152f21f49a857ce498f5306a504c9fe6eaa271e971b004fa0adf937cf5e4c584f56dce9318b2aeab36c550396fb0a  go.sum
8fff794134b497c1d272ac69972bb468849007cb32b9255d792b74a58aea7be739d3db348da686a26fb092244c614a300dfffafb74c58a34a7c7505138158b19  apk.go
b0a781e1b1e33741a97e231c761b1200239c6f1235ffbe82311fe883387eb23bef262ad68256ebd6cf87d74298041b53b947ea7a493cfa5aa814b2a1c5181e13  grafana.initd
c2afa7f6baf8f468fbd781b0522cbff173bb0c3964eb08fc4a0951d034e8a1f3f9c14798e2ac487b3c20db834110883db8162039b18195e97bb9f4bc5baffc33  grafana.confd"