aports/testing/sq/APKBUILD
2025-04-11 19:40:50 +02:00

78 lines
2.4 KiB
Text

# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=sq
pkgver=0.48.5
pkgrel=4
pkgdesc="CLI tool that provides jq-style access to structured data sources"
url="https://sq.io/"
# arm*, loongarch64, s390x, x86: tests fail
arch="all !armhf !armv7 !loongarch64 !s390x !x86"
license="MIT"
makedepends="go icu-dev"
checkdepends="tzdata"
subpackages="
$pkgname-doc
$pkgname-bash-completion
$pkgname-fish-completion
$pkgname-zsh-completion
"
source="https://github.com/neilotoole/sq/archive/v$pkgver/sq-$pkgver.tar.gz"
options="net" # for downloading Go modules
export GOFLAGS="$GOFLAGS -tags=sqlite_vtable,sqlite_stat4,sqlite_fts5,sqlite_icu,sqlite_introspect,sqlite_json,sqlite_math_functions"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
build() {
export CGO_CFLAGS="$CFLAGS"
export CGO_LDFLAGS="$LDFLAGS"
local _goldflags="
-X github.com/neilotoole/sq/cli/buildinfo.Version=v$pkgver
-X github.com/neilotoole/sq/cli/buildinfo.Commit=RELEASE
-X 'github.com/neilotoole/sq/cli/buildinfo.Timestamp=$(date -d @"$SOURCE_DATE_EPOCH" -u '+%Y-%m-%dT%H:%M:%SZ')'
"
go build -ldflags "$_goldflags"
local shell; for shell in bash fish zsh; do
./sq completion $shell > sq.$shell
done
./sq man > sq.1
}
check() {
# clean up leftover test files that may cause tests to fail
rm -rf /tmp/sq/test /tmp/sq_test*
# shellcheck disable=2046
case "$CARCH" in
# TestCompleteFilterActiveGroup: failed on the builder
# TestJSONData_Cities: test timed out after 2h0m0s
x86_64) go test -v -timeout 60m \
-skip 'Test(CompleteFilterActiveGroup|JSONData_Cities)' \
$(go list ./... | grep -v /libsq/driver) ;;
*) go test -v -timeout 60m $(go list ./... | grep -v /libsq/driver) ;;
esac
}
package() {
install -Dvm755 sq -t "$pkgdir"/usr/bin/
install -Dvm644 sq.bash \
"$pkgdir"/usr/share/bash-completion/completions/sq
install -Dvm644 sq.fish \
"$pkgdir"/usr/share/fish/vendor_completions.d/sq.fish
install -Dvm644 sq.zsh \
"$pkgdir"/usr/share/zsh/site-functions/_sq
install -Dvm644 sq.1 \
"$pkgdir"/usr/share/man/man1/sq.1
install -Dvm644 LICENSE \
"$pkgdir"/usr/share/licenses/sq/LICENSE
}
sha512sums="
4f16fee8a38d50b9a7aeeaf92205093028dd9088f9ec681c563d6b61e05b366e1250c77f79ea211dc5b4c52ccc3a753a7b48e65d1d08ca8f8411386b4cfbe1d3 sq-0.48.5.tar.gz
"