summaryrefslogtreecommitdiff
path: root/community/yq/APKBUILD
blob: fb5c3dfb32441505380df1447b034883eae34674 (plain)
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
# Contributor: Tuan Hoang <tmhoang@linux.ibm.com>
# Maintainer: Tuan Hoang <tmhoang@linux.ibm.com>
pkgname=yq
pkgver=4.4.1
pkgrel=0
pkgdesc="portable command-line YAML processor written in Go"
url="https://github.com/mikefarah/yq"
arch="all"
license="MIT"
makedepends="go govendor"
options="chmod-clean"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/mikefarah/yq/archive/v$pkgver.tar.gz"

builddir="$srcdir/${url##*//}"

prepare() {
	mkdir -p ${builddir%/*}
	mv "$srcdir"/$pkgname-$pkgver "$builddir"/
	default_prepare
}

build() {
	GOPATH="$srcdir" go build -v
}

check() {
	GOPATH="$srcdir" go test
}

package() {
	install -Dm755 yq "$pkgdir"/usr/bin/yq
	for file in LICENSE README.md; do
		install -Dm644 $file "$pkgdir"/usr/share/doc/$pkgname/$file
	done

	mkdir -p "$pkgdir"/usr/share/bash-completion/completions \
			"$pkgdir"/usr/share/zsh/site-functions \
			"$pkgdir"/usr/share/fish/completions
	"$pkgdir"/usr/bin/yq shell-completion bash \
		> "$pkgdir"/usr/share/bash-completion/completions/yq.bash
	"$pkgdir"/usr/bin/yq shell-completion zsh \
		> "$pkgdir"/usr/share/zsh/site-functions/_yq
	"$pkgdir"/usr/bin/yq shell-completion fish \
		> "$pkgdir"/usr/share/fish/completions/yq.fish
}

sha512sums="e7d400fb41892fcaedae80f6cfa3abd83e6510688e83a707cdeaa8b048bfc2202ac48700b0352981e7392025cb09529562bed9d122a530e1a746847708c21bc7  yq-4.4.1.tar.gz"