From 40532081c3b00f93aa2f408220a86204bfaaa1e7 Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Thu, 26 Jan 2023 10:47:15 +0100 Subject: [PATCH] app-emulation/cri-tools: apply Flatcar patches Make use of the existing helpers provided by `coreos-go.eclass`. To optimize the binary size of crictl, add "-X" to GO_LDFLAGS, like "-X $(PROJECT)/pkg/version.Version=$(VERSION)" in the original Makefile of cri-tools. We cannot follow way of Gentoo ebuilds like `emake`, because Makefile of cri-tools does not allow users to pass in ${GOARCH}. Add `arm64` to ACCEPTED_KEYWORDS. Remove unnecessary files from installation, as well as the shell completion eclass. --- .../cri-tools/cri-tools-1.24.2.ebuild | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.24.2.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.24.2.ebuild index 0ae021d253..ec5b2f855c 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.24.2.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.24.2.ebuild @@ -3,32 +3,44 @@ EAPI=7 -inherit bash-completion-r1 go-module +# Flatcar: remove bash-completion, inherit coreos-go +inherit go-module coreos-go +COREOS_GO_VERSION="go1.19" +COREOS_GO_PACKAGE="github.com/kubernetes-sigs/cri-tools" +COREOS_GO_MOD="vendor" + +MY_PV="v${PV/_beta/-beta.}" + +EGO_PN="${COREOS_GO_PACKAGE}" DESCRIPTION="CLI and validation tools for Kubelet Container Runtime (CRI)" HOMEPAGE="https://github.com/kubernetes-sigs/cri-tools" SRC_URI="https://github.com/kubernetes-sigs/cri-tools/archive/v${PV}.tar.gz -> ${P}.tar.gz" LICENSE="Apache-2.0 BSD BSD-2 CC-BY-SA-4.0 ISC MIT MPL-2.0" SLOT="0" -KEYWORDS="~amd64" +# Flatcar: keyword arm64 +KEYWORDS="amd64 arm64" -DEPEND="dev-lang/go" +S=${WORKDIR}/cri-tools-${PV} RESTRICT+=" test" src_compile() { - emake VERSION="${PV}" - ./build/bin/crictl completion bash > "crictl.bash" || die - ./build/bin/crictl completion zsh > "crictl.zsh" || die + # Flatcar: make use of the existing helpers provided by `coreos-go.eclass`. + # To optimize the binary size of crictl, add "-X" to GO_LDFLAGS, + # like "-X $(PROJECT)/pkg/version.Version=$(VERSION)" in the original + # Makefile of cri-tools. We cannot follow way of Gentoo ebuilds like `emake`, + # because Makefile of cri-tools does not allow users to pass in ${GOARCH}. + # Remove shell completions. + GO_LDFLAGS="-s -w -extldflags=-Wl,-z,now,-z,relro,-z,defs " + GO_LDFLAGS+="-X ${COREOS_GO_PACKAGE}/pkg/version.Version=${PV} " + go_build "${COREOS_GO_PACKAGE}/cmd/crictl" } src_install() { - dobin ./build/bin/crictl - - newbashcomp crictl.bash crictl - insinto /usr/share/zsh/site-functions - newins crictl.zsh _crictl + # Flatcar: install only crictl binary, remove shell completions. + dobin "${GOBIN}/crictl" dodoc -r docs {README,RELEASE,CHANGELOG,CONTRIBUTING}.md }