| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
|
inherit go-module toolchain-funcs shell-completion
|
|
6 |
inherit go-env go-module shell-completion sysroot
|
| 7 |
7 |
|
| 8 |
8 |
DESCRIPTION="CLI to run commands against Kubernetes clusters"
|
| 9 |
9 |
HOMEPAGE="https://kubernetes.io"
|
| ... | ... | |
| 14 |
14 |
# Dependent licenses
|
| 15 |
15 |
LICENSE+=" Apache-2.0 BSD BSD-2 ISC MIT"
|
| 16 |
16 |
SLOT="0"
|
| 17 |
|
KEYWORDS="~amd64 ~arm64"
|
|
17 |
KEYWORDS="amd64 ~arm64"
|
| 18 |
18 |
IUSE="selinux"
|
| 19 |
19 |
RESTRICT="test"
|
| 20 |
20 |
|
| 21 |
|
BDEPEND=">=dev-lang/go-1.23.3"
|
| 22 |
|
RDEPEND+=" selinux? ( sec-policy/selinux-kubernetes )"
|
|
21 |
BDEPEND=">=dev-lang/go-1.26.1"
|
|
22 |
RDEPEND="selinux? ( sec-policy/selinux-kubernetes )"
|
| 23 |
23 |
|
| 24 |
24 |
QA_PRESTRIPPED=usr/bin/kubectl
|
| 25 |
25 |
|
| 26 |
26 |
src_compile() {
|
|
27 |
local GOOS=$(go-env_goos)
|
|
28 |
|
| 27 |
29 |
emake -j1 GOFLAGS="${GOFLAGS}" GOLDFLAGS="" LDFLAGS="" FORCE_HOST_GO=yes \
|
|
30 |
KUBE_BUILD_PLATFORMS="${GOOS}/${GOARCH}" KUBE_${GOOS@U}_${GOARCH@U}_CC="${CC}" \
|
| 28 |
31 |
WHAT=cmd/${PN}
|
| 29 |
32 |
|
| 30 |
|
if ! tc-is-cross-compiler; then
|
| 31 |
|
einfo "generating shell completion files"
|
| 32 |
|
_output/bin/${PN} completion bash > ${PN}.bash || die
|
| 33 |
|
_output/bin/${PN} completion zsh > ${PN}.zsh || die
|
| 34 |
|
_output/bin/${PN} completion fish > ${PN}.fish || die
|
| 35 |
|
fi
|
|
33 |
bin=_output/local/bin/${GOOS}/${GOARCH}/${PN}
|
|
34 |
|
|
35 |
einfo "generating shell completion files"
|
|
36 |
sysroot_try_run_prefixed ${bin} completion bash > ${PN}.bash || die
|
|
37 |
sysroot_try_run_prefixed ${bin} completion zsh > ${PN}.zsh || die
|
|
38 |
sysroot_try_run_prefixed ${bin} completion fish > ${PN}.fish || die
|
| 36 |
39 |
}
|
| 37 |
40 |
|
| 38 |
41 |
src_install() {
|
| 39 |
|
dobin _output/bin/${PN}
|
|
42 |
dobin ${bin}
|
| 40 |
43 |
|
| 41 |
|
if ! tc-is-cross-compiler; then
|
| 42 |
|
newbashcomp ${PN}.bash ${PN}
|
| 43 |
|
newzshcomp ${PN}.zsh _${PN}
|
| 44 |
|
dofishcomp ${PN}.fish
|
| 45 |
|
else
|
| 46 |
|
ewarn "Shell completion files not installed! Install them manually with '${PN} completion --help'"
|
| 47 |
|
fi
|
|
44 |
[[ -s ${PN}.bash ]] && newbashcomp ${PN}.bash ${PN}
|
|
45 |
[[ -s ${PN}.zsh ]] && newzshcomp ${PN}.zsh _${PN}
|
|
46 |
[[ -s ${PN}.fish ]] && dofishcomp ${PN}.fish
|
| 48 |
47 |
}
|