summaryrefslogtreecommitdiff
path: root/testing/ytt/APKBUILD
blob: 92303ae28112bf37c6fbab7febc4ec7ec9dfc607 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Contributor: techknowlogick <techknowlogick@gitea.io>
# Maintainer: techknowlogick <techknowlogick@gitea.io>
pkgname=ytt
pkgver=0.41.1
pkgrel=3
pkgdesc="YAML templating tool that works on YAML structure instead of text"
url="https://get-ytt.io/"
arch="all !armhf !armv7 !x86"
license="Apache-2.0"
makedepends="go"
options="chmod-clean net"
source="$pkgname-$pkgver.tar.gz::https://github.com/vmware-tanzu/carvel-ytt/archive/v$pkgver.tar.gz
	0001-e2e-tests.patch"
builddir="$srcdir/src/github.com/k14s/$pkgname"

export GOCACHE="$srcdir/go-cache"
export GOTMPDIR="$srcdir"
export GOMODCACHE="$srcdir/go"

prepare() {
	mkdir -p ${builddir%/*}
	mv "$srcdir"/carvel-$pkgname-$pkgver "$builddir"/
	default_prepare
}

build() {
	local ldflags="-X github.com/vmware-tanzu/carvel-ytt/pkg/version.Version=$pkgver"
	export GOPATH="$srcdir"
	export CGO_ENABLED=0
	rm -f website/generated.go

	go fmt ./cmd/... ./pkg/...
	go mod vendor
	go mod tidy

	rm -f pkg/website/generated.go
	go build -trimpath -ldflags="$ldflags" -o ytt ./cmd/ytt/...
	./ytt version

	(
		# Use newly built binary to template all website assets
		# into a single Go file
		cd pkg/website
		./../../ytt \
			-f . \
			-f ../../examples/playground/basics \
			-f ../../examples/playground/overlays \
			-f ../../examples/playground/getting-started \
			--file-mark 'alt-example**/*:type=data' \
			--file-mark 'example**/*:type=data' \
			--file-mark 'generated.go.txt:exclusive-for-output=true' \
			--dangerous-emptied-output-directory ../../tmp/
	)
	mv tmp/generated.go.txt pkg/website/generated.go

	# Rebuild ytt with website assets
	rm -f ./ytt
	go build -trimpath -ldflags="$ldflags" -o ytt ./cmd/ytt/...
}

check() {
	# disable specific shellcheck test as wordsplitting is wanted
	# shellcheck disable=SC2046
	go test -v $(go list ./...|grep -v yaml.v2) "$@"
	./ytt version
}

package() {
	install -D -m 755 $pkgname "$pkgdir"/usr/bin/$pkgname
}

sha512sums="
6d03e20eabdf8bfb423add54015eb3b48acd352b4e65a330c9890fe3a45ef97b1642c2ff22b3ce11fb6b717b9b7875753c539779b10da56e7083982370694457  ytt-0.41.1.tar.gz
7e90b64b9f5ed789002f30e1dfbe0c0a8176f1e619c14aa1e9d541359f2f24ff17165785c09b2f7b7bcc21082b568527506c20b6a33987a03f9c88a0c418cfaf  0001-e2e-tests.patch
"