# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=kind
pkgver=0.25.0
pkgrel=5
pkgdesc="Kubernetes IN Docker - local clusters for testing Kubernetes"
url="https://kind.sigs.k8s.io/"
license="Apache-2.0"
arch="all"
makedepends="go"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/kubernetes-sigs/kind/archive/v$pkgver/kind-$pkgver.tar.gz
	skip-version-test.patch
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build

	./kind completion bash > $pkgname.bash
	./kind completion fish > $pkgname.fish
	./kind completion zsh > $pkgname.zsh
}

check() {
	go test -tags=nointegration ./...
}

package() {
	install -Dm755 $pkgname -t "$pkgdir"/usr/bin/

	install -Dm644 $pkgname.bash "$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 $pkgname.fish "$pkgdir"/usr/share/fish/vendor_completions.d/$pkgname.fish
	install -Dm644 $pkgname.zsh "$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
e08921b2f0290b37a4239b63ab0f3bc4994eb6f2f3de0f4a0e619fc83a616bc3c910f4abd032064e6f2da25d463f65c558d80c62fdd41eb3c209fc4d9f508ab4  kind-0.25.0.tar.gz
6993628a0a5c938b0e59b92e04b32bd7d454dc4ee7e5c445c4122dacdb786d0372836c59749c767f5921b9ac96b4452c5d696c2c7d701ea8e10ac256d6d7d67c  skip-version-test.patch
"
