commit:     3a742792b48ded9dbfc2d3c685b2d912930dd068
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  8 10:39:01 2026 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Feb 13 17:27:52 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a742792

sys-cluster/kubelet: Fix cross-compiling, add shell completion

Closes: https://github.com/gentoo/gentoo/pull/45684

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
Signed-off-by: William Hubbs <williamh <AT> gentoo.org>

 sys-cluster/kubelet/kubelet-1.35.0.ebuild | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/sys-cluster/kubelet/kubelet-1.35.0.ebuild 
b/sys-cluster/kubelet/kubelet-1.35.0.ebuild
index 9db1a5d37cf8..b4b089d8e925 100644
--- a/sys-cluster/kubelet/kubelet-1.35.0.ebuild
+++ b/sys-cluster/kubelet/kubelet-1.35.0.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit go-module systemd
+inherit go-env go-module shell-completion sysroot systemd
 
 DESCRIPTION="Kubernetes Node Agent"
 HOMEPAGE="https://kubernetes.io";
@@ -24,13 +24,28 @@ BDEPEND=">=dev-lang/go-1.25.4"
 QA_PRESTRIPPED=usr/bin/kubelet
 
 src_compile() {
+       local GOOS=$(go-env_goos)
+
        CGO_LDFLAGS="$(usex hardened '-fno-PIC ' '')" \
                emake -j1 GOFLAGS="${GOFLAGS}" GOLDFLAGS="" LDFLAGS="" 
FORCE_HOST_GO=yes \
+               KUBE_BUILD_PLATFORMS="${GOOS}/${GOARCH}" 
KUBE_${GOOS@U}_${GOARCH@U}_CC="${CC}" \
                WHAT=cmd/${PN}
+
+       bin=_output/local/bin/${GOOS}/${GOARCH}/${PN}
+
+       einfo "generating shell completion files"
+       sysroot_try_run_prefixed ${bin} completion bash > ${PN}.bash || die
+       sysroot_try_run_prefixed ${bin} completion zsh > ${PN}.zsh || die
+       sysroot_try_run_prefixed ${bin} completion fish > ${PN}.fish || die
 }
 
 src_install() {
-       dobin _output/bin/${PN}
+       dobin ${bin}
+
+       [[ -s ${PN}.bash ]] && newbashcomp ${PN}.bash ${PN}
+       [[ -s ${PN}.zsh ]] && newzshcomp ${PN}.zsh _${PN}
+       [[ -s ${PN}.fish ]] && dofishcomp ${PN}.fish
+
        keepdir /etc/kubernetes/manifests /var/log/kubelet /var/lib/kubelet
        newinitd "${FILESDIR}"/${PN}.initd ${PN}
        newconfd "${FILESDIR}"/${PN}.confd ${PN}

Reply via email to