maintainer="Hoang Nguyen " pkgname=buf pkgver=1.50.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="git-daemon 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 remove-deprecated-testcorpus-field.patch " options="net" # download Go modules # riscv64, ppc64le: private/bufpkg/bufstudioagent tests time out # s390x: tests fail making GET requests to external HTTP endpoints easily (context deadline exceeded) case "$CARCH" in riscv64|ppc64le|s390x) options="$options !check" esac 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 # See https://github.com/bufbuild/buf/blob/main/make/buf/all.mk for the list of binaries needed to be built mkdir -p "$builddir"/bin go build -v -o bin/ ./private/buf/cmd/buf/command/generate/internal/protoc-gen-top-level-type-names-yaml 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 for plugin in panic suffix protovalidate-ext rpc-ext duplicate-category duplicate-rule; do go build -v -o bin/ ./private/bufpkg/bufcheck/internal/cmd/buf-plugin-$plugin done } check() { export PATH="$PATH:$builddir/bin" # TestCompareGeneratedStubsGoogleapisGo fails due to difference in protoc versions # TestCompareGoogleapis fails (TODO: investigate more) # TestWorkspaceGit checks the project root whether it is a git repo # TestRunLintCustomWasmPlugins relies on buf-plugin-suffix.wasm file we can't produce with -buildmode=pie go test -skip 'Test(CompareGeneratedStubsGoogleapisGo|CompareGoogleapis|WorkspaceGit|RunLintCustomWasmPlugins)' ./... } 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=" fad60b3be7423bbab34aedb8ed533922fe8477598a06100b927851a2e11f7f9dce360243a5a6e02c6c82965da6930cdb583a5a92ea56fe381bbad16816503f28 buf-1.50.0.tar.gz 0fa6fef80d2eba7d59344c458ecf5ddaa448dee338c3bc4d24d4a29748eedd98ab2046847ddbf96e09f8c99b7c0dcb1ecb69389e344c042169c838a6a91b8ea9 remove-deprecated-testcorpus-field.patch "