mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-05-13 11:34:20 +02:00
88 lines
3 KiB
Text
88 lines
3 KiB
Text
maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
|
|
pkgname=buf
|
|
pkgver=1.50.1
|
|
pkgrel=2
|
|
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="
|
|
571e5f60c73c35db53d58a232c3f0bcbc10aba9652028bb291a9a60a069270d7282ce470da5d1035f88b9224c5868197bf82ec7ca27fdd2e8ba38b12a60361fd buf-1.50.1.tar.gz
|
|
0fa6fef80d2eba7d59344c458ecf5ddaa448dee338c3bc4d24d4a29748eedd98ab2046847ddbf96e09f8c99b7c0dcb1ecb69389e344c042169c838a6a91b8ea9 remove-deprecated-testcorpus-field.patch
|
|
"
|