app-emulation/cri-tools: apply Flatcar patches

Update to 1.19.0, to keep up with recent releases of cri-tools.
Note that we should not simply update to 1.20.0, because its crictl
binary file is 30M, so bigger than the usual size.
On the other hand, crictl 1.19.0 is only 21M.

To optimize the binary size of crictl, make use of the existing
helpers provided by `coreos-go.eclass`.
Add "-X $(PROJECT)/pkg/version.Version=$(VERSION)" to GO_LDFLAGS,
as the original cri-tools Makefile does.
Note, we cannot run the native command like `emake crictl`, because
the cri-tools Makefile does not allow custom env variables like
BUILDTAGS or GO_LDFLAGS to be configured.

Add `arm64` to ACCEPTED_KEYWORDS.

Remove unnecessary files from installation, as well as the bash
completion eclass.
This commit is contained in:
Dongsu Park 2021-02-02 14:12:14 +01:00
parent 94a00872df
commit 13946b551d
3 changed files with 45 additions and 33 deletions

View File

@ -1 +1 @@
DIST cri-tools-1.18.0.tar.gz 5295512 BLAKE2B 9dda4a401b858e98aa60521d3268d8f6ff6a2c1bd2c219a0e5e9e5360fba58d41e97258c636da26ee57bbfc3286798c74107c7de92d3e3398bdf53b7d9078e94 SHA512 849b496e6d19eec29e0e56f0b37c094649311b80514f319b0c68c6519e3ddd48e1973c3d288144db998826676416644ec705b7ea0916c21898b40928ea800af1
DIST cri-tools-1.19.0.tar.gz 5199406 BLAKE2B 59102098a29b2454ab21e5fae0440f1ed7a550f48890806b2663c97de936e9a88c44c9c1dee1b65e94e3495d823c03dbaa9fc28319e4eb5cae736559e1692c55 SHA512 40c9df3623258a0b787a903113d522f93cb084f8c5840cebdfdf36ba57b6ae3ac0ee11fda1414f4ed4c977f8bc2d255dee7f1b07832fa82ab65010717952fb64

View File

@ -1,32 +0,0 @@
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit bash-completion-r1 go-module
MY_PV="v${PV/_beta/-beta.}"
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/${MY_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"
RESTRICT+=" test"
src_compile() {
emake VERSION="${MY_PV}"
_output/crictl completion bash > ${PN}.bash || die
_output/crictl completion zsh > ${PN}.zsh || die
}
src_install() {
dobin _output/crictl
newbashcomp ${PN}.bash ${PN}
insinto /usr/share/zsh/site-functions
newins ${PN}.zsh _${PN}
dodoc -r docs {README,RELEASE,CHANGELOG,CONTRIBUTING}.md
}

View File

@ -0,0 +1,44 @@
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit coreos-go
COREOS_GO_VERSION="go1.15"
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/${MY_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"
# Flatcar: keyword arm64
KEYWORDS="amd64 arm64"
S=${WORKDIR}/cri-tools-${PV}
DEPEND=""
RDEPEND="${DEPEND}"
src_compile() {
# Flatcar: to optimize the binary size of crictl, make use of the existing
# helpers provided by `coreos-go.eclass`.
# Add "-X $(PROJECT)/pkg/version.Version=$(VERSION)" to GO_LDFLAGS,
# as the original cri-tools Makefile does.
# Note, we cannot run the native command like `emake crictl`, because
# the cri-tools Makefile does not allow custom env variables like BUILDTAGS
# or GO_LDFLAGS to be configured.
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() {
# Flatcar: install only crictl binary
dobin "${GOBIN}/crictl"
}