aports/testing/buf/APKBUILD
2023-11-15 11:38:56 +00:00

74 lines
2.1 KiB
Plaintext

# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=buf
pkgver=1.28.0
pkgrel=1
pkgdesc="CLI to work with Protocol Buffers"
url="https://buf.build/"
# 32bit: fail tests with int overflow
arch="all !x86 !armhf !armv7"
license="Apache-2.0"
makedepends="go"
checkdepends="protobuf-dev protoc-gen-go"
subpackages="
$pkgname-bash-completion
$pkgname-fish-completion
$pkgname-zsh-completion
$pkgname-protoc-plugins:_protoc
"
source="$pkgname-$pkgver.tar.gz::https://github.com/bufbuild/buf/archive/refs/tags/v$pkgver.tar.gz"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
build() {
for binary in buf protoc-gen-buf-breaking protoc-gen-buf-lint; do
go build -v ./cmd/$binary
done
for shell in bash fish zsh; do
./buf completion $shell > buf.$shell
done
# These programs are required for check phase
mkdir -p "$builddir"/bin
for cmd in writer receiver; do
go build -v -o bin/ ./private/buf/cmd/buf/command/alpha/protoc/internal/protoc-gen-insertion-point-$cmd
done
}
check() {
export PATH="$PATH:$builddir/bin"
# TestCompareGeneratedStubsGoogleapisGo fails due to difference in protoc versions
# TestCompareGoogleapis fails (TODO: investigate more)
# TestGitCloner tries to clone a remote repository
# TestWorkspaceGit checks the project root whether it is a git repo
go test -skip 'TestCompareGeneratedStubsGoogleapisGo|TestCompareGoogleapis|TestGitCloner|TestWorkspaceGit' ./...
}
package() {
install -Dm755 buf -t "$pkgdir"/usr/bin/
install -Dm644 buf.bash \
"$pkgdir"/usr/share/bash-completion/completions/buf
install -Dm644 buf.fish \
"$pkgdir"/usr/share/fish/vendor_completions.d/buf.fish
install -Dm644 buf.zsh \
"$pkgdir"/usr/share/zsh/site-functions/_buf
install -Dm755 protoc-gen-buf-breaking protoc-gen-buf-lint \
-t "$pkgdir"/usr/bin/
}
_protoc() {
pkgdesc="$pkgdesc (protoc plugins)"
depends="protoc"
amove usr/bin/protoc-gen-buf-*
}
sha512sums="
ba50f1267893e07a3b6a1d6ad546ee89310e57963ebf9ad5f297ed10ab1857fe6799c3693cd68e81f67cb5765b4ce624826608cae22d869a4cca4025a9b3afdd buf-1.28.0.tar.gz
"