# Template file for 'kops'
pkgname=kops
version=1.19.0
revision=1
archs="x86_64*"
build_wrksrc=src/k8s.io/kops
build_style=go
go_import_path=k8s.io/kops
hostmakedepends="git"
depends="kubectl"
short_desc="Production Grade K8s Installation, Upgrades, and Management"
maintainer="Mate Gabri <iam@theguy.io>"
license="Apache-2.0"
homepage="https://github.com/kubernetes/kops"

do_fetch() {
	# We must clone it instead of downloading the tarball because the build
	# process expects the directory to be a git repository
	rm -rf $wrksrc
	mkdir -p $wrksrc/src/k8s.io
	git clone -b v${version} https://github.com/kubernetes/kops \
		$wrksrc/src/k8s.io/kops
}

do_build() {
	export GOPATH="$wrksrc"

	make

	../../../bin/kops completion bash > completion.bash
	../../../bin/kops completion zsh | sed -n '/#compdef/,$p' > completion.zsh
}

do_install() {
	vbin ../../../bin/kops
	vinstall completion.bash 644 usr/share/bash-completion/completions kops
	vinstall completion.zsh 644 usr/share/zsh/site-functions _kops
}
