diff options
author | Matthias Lisin | 2020-07-08 17:31:21 +0200 |
---|---|---|
committer | Matthias Lisin | 2020-07-08 17:31:21 +0200 |
commit | 1a3dd7ae2968f6271624824e73c4d7b022f1cec4 (patch) | |
tree | 40096934fe1ae0febe658fc6a7c3d703914ee743 /PKGBUILD | |
download | aur-1a3dd7ae2968f6271624824e73c4d7b022f1cec4.tar.gz |
newpkg: kubectl-krew 0.3.4-1
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..bf6f0d70d09d --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,53 @@ +# Maintainer: ml <ml@visu.li> +pkgname=kubectl-krew +_pkgname=${pkgname#kubectl-} +pkgver=0.3.4 +pkgrel=1 +pkgdesc='Plugin manager for kubectl command-line tool' +arch=('x86_64' 'aarch64' 'arm' 'armv6h' 'armv7h') +url='https://krew.sigs.k8s.io/' +license=('Apache') +depends=('kubectl' 'git') +makedepends=('go') +install=kubectl-krew.install +groups=('kubectl-plugins') +source=("https://github.com/kubernetes-sigs/krew/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz") +sha256sums=('dc96db650fb7f973a6a3fcf6ce35bb6ba1218bca9c3858459d5cacc2c321113c') + +prepare() { + cd "${_pkgname}-${pkgver}" + go mod download +} + +build() { + local _commit= + _commit=$(bsdcat "${pkgname}-${pkgver}.tar.gz" | git get-tar-commit-id) + local -a x=( + sigs.k8s.io/krew/internal/version.gitCommit="${_commit:?}" + sigs.k8s.io/krew/internal/version.gitTag="v${pkgver}" + ) + cd "${_pkgname}-${pkgver}" + export CGO_ENABLED=1 + export CGO_LDFLAGS="$LDFLAGS" + export CGO_CFLAGS="$CFLAGS" + export CGO_CPPFLAGS="$CPPFLAGS" + export CGO_CXXFLAGS="$CXXFLAGS" + export GOFLAGS='-buildmode=pie -trimpath -modcacherw -mod=readonly' + go build -o . -ldflags "${x[*]/#/-X=}" ./cmd/{krew,validate-krew-manifest} +} + +check() { + cd "${_pkgname}-${pkgver}" + # unit- and integrationtests + KREW_BINARY="${PWD}/${pkgname#kubectl-}" go test ./... +} + +package() { + cd "${_pkgname}-${pkgver}" + install -Dm755 krew "${pkgdir}/usr/bin/kubectl-krew" + install -m755 validate-krew-manifest -t "${pkgdir}/usr/bin" + + # docs + install -Dm755 README.md -t "${pkgdir}/usr/share/doc/${pkgname}" + cp -a docs/* -t "${pkgdir}/usr/share/doc/${pkgname}" +} |