aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ytt/APKBUILD
blob: 9542dd2475931913c038f337f6c599100371f5a2 (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
# Contributor: techknowlogick <techknowlogick@gitea.io>
# Maintainer: techknowlogick <techknowlogick@gitea.io>
pkgname=ytt
pkgver=0.40.1
pkgrel=1
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"

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

build() {
	local ldflags="-w -s -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="
d7c623f7e9266472e58b94b35bd6e72ef27606d7e2f917e2654000f238df8948dec2098ede62a21e4050195b059ffd1cd569c887c42374972e1d2fe7aecedcc5  ytt-0.40.1.tar.gz
7e90b64b9f5ed789002f30e1dfbe0c0a8176f1e619c14aa1e9d541359f2f24ff17165785c09b2f7b7bcc21082b568527506c20b6a33987a03f9c88a0c418cfaf  0001-e2e-tests.patch
"