# Contributor: Konstantin Kulikov # Maintainer: Konstantin Kulikov pkgname=grafana pkgver=6.4.3 pkgrel=0 _commit=3a2bfb7e38 # git rev-parse --short HEAD _stamp=1571218329 # 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 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". yarn remove husky phantomjs-prebuilt --pure-lockfile -W yarn 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="50eb98fd7144db0648dbe7bc03fa18a95afb88e5655235922c590a4e092edf19071cbe45e810db8b54647217aa51afd0b66650f13d8036212e8347fb347fcb2f grafana-6.4.3.tar.gz 02ae5ee6e7b349aaeefc3c794f9b78704352785c8bea54fdce3c02c62150003bb734d963fb564548bf70d300597084b50ef42b2dc97ae19238e57ab23cf65f06 go.mod 7c7c02726688590d3a4140acb261c463500e5a07f23f839af2886204afe11e4ff0039e32cf9a73ebe40772c2cee8baadb97498e3ce9b552353e4618804371d50 go.sum 8fff794134b497c1d272ac69972bb468849007cb32b9255d792b74a58aea7be739d3db348da686a26fb092244c614a300dfffafb74c58a34a7c7505138158b19 apk.go b0a781e1b1e33741a97e231c761b1200239c6f1235ffbe82311fe883387eb23bef262ad68256ebd6cf87d74298041b53b947ea7a493cfa5aa814b2a1c5181e13 grafana.initd c2afa7f6baf8f468fbd781b0522cbff173bb0c3964eb08fc4a0951d034e8a1f3f9c14798e2ac487b3c20db834110883db8162039b18195e97bb9f4bc5baffc33 grafana.confd"