summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorMatthias Lisin2020-04-28 15:32:13 +0200
committerMatthias Lisin2020-04-28 15:37:10 +0200
commit5e4606d8a5d66a0d58da7752d84ed50c3e97a36f (patch)
tree974330c36a89e4ac37352beb5e75e6e29d4afd11 /PKGBUILD
downloadaur-5e4606d8a5d66a0d58da7752d84ed50c3e97a36f.tar.gz
newpkg: krew 0.3.4-1
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD48
1 files changed, 48 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..a12152255b81
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,48 @@
+# Maintainer: ml <ml@visu.li>
+pkgname=krew
+pkgver=0.3.4
+pkgrel=1
+pkgdesc='Plugin manager for kubectl command-line tool'
+arch=('x86_64' 'aarch64' 'arm' 'arm6h' 'arm7h')
+url='https://krew.sigs.k8s.io/'
+license=('Apache')
+depends=('kubectl')
+makedepends=('git' 'go' 'gzip')
+source=("${pkgname}-${pkgver}.tar.gz::https://github.com/kubernetes-sigs/krew/archive/v${pkgver}.tar.gz")
+sha256sums=('dc96db650fb7f973a6a3fcf6ce35bb6ba1218bca9c3858459d5cacc2c321113c')
+# see build(), check()
+_commit=
+
+prepare() {
+ cd "${pkgname}-${pkgver}"
+ go mod download
+}
+
+build() {
+ _commit=$(zcat "${srcdir}/${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_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}"
+ go test -short ./...
+
+ echo "Verify './krew version' contains version (v${pkgver}) and commit id (${_commit:?})"
+ [[ $(./krew version 2>/dev/null) == *"v${pkgver}"*"${_commit}"* ]]
+}
+
+package() {
+ cd "${pkgname}-${pkgver}"
+ install -Dm755 krew validate-krew-manifest -t "${pkgdir}/usr/bin"
+}