aboutsummaryrefslogtreecommitdiffstats
path: root/testing/distrobuilder/APKBUILD
blob: ef1c94e916d0bb7b4fd014cf2730bdc7afd5db63 (plain) (blame)
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
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer:
pkgname=distrobuilder
pkgver=0_git20181004
_commit=d2329be9569d45028a38836186d2353b8ddfe1ca
pkgrel=2
pkgdesc="System container image builder"
url="https://linuxcontainers.org/"
arch="" # Build fails on the builders
license="Apache-2.0"
depends="gnupg1"
makedepends="go linux-headers glide"
subpackages="$pkgname-lxc::noarch $pkgname-lxd::noarch"
options="!check" # has no check
source="$pkgname-$pkgver.tar.gz::https://github.com/lxc/distrobuilder/archive/$_commit.tar.gz
	glide-$pkgver.yaml
	glide-$pkgver.lock
	"
builddir="$srcdir/src/github.com/lxc/$pkgname"

prepare() {
	mkdir -p ${builddir%/*}
	mv "$srcdir"/$pkgname-$_commit "$builddir"/
	cp "$srcdir"/glide-$pkgver.yaml glide.yaml
	cp "$srcdir"/glide-$pkgver.lock glide.lock
	export GLIDE_HOME="$srcdir/.glide"
	export GOPATH="$srcdir"
	glide install --skip-test
	default_prepare
}

glide_init() {
	abuild clean deps unpack prepare
	cd "$builddir"
	export GLIDE_HOME="$srcdir/.glide"
	export GOPATH="$srcdir"
	rm -f glide.yaml glide.lock
	glide init --non-interactive
	glide update
	cp glide.yaml "$startdir"/glide-$pkgver.yaml
	cp glide.lock "$startdir"/glide-$pkgver.lock
	cd "$startdir" && abuild checksum clean
}

build() {
	export GOPATH="$srcdir"
	go build -o bin/$pkgname ./$pkgname
}

package() {
	install -Dm755 bin/$pkgname "$pkgdir"/usr/bin/$pkgname
}

lxc() {
	pkgdesc="$pkgdesc (for LXC)"
	depends="$pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel lxc"
	mkdir -p "$subpkgdir"
}

lxd() {
	pkgdesc="$pkgdesc (for LXD)"
	depends="$pkgname squashfs-tools"
	install_if="$pkgname=$pkgver-r$pkgrel lxd"
	mkdir -p "$subpkgdir"
}

sha512sums="de50479ab6de5bca80c48ca14ae29ad712a5c6ac1ec7661d28da5b42c77ef0bbc4c00f95080abad2838663c3cf015466c2e2d1ba75168a440df18dfebc2bc0a5  distrobuilder-0_git20181004.tar.gz
602a97b07d6c0b0eca1cec26e3b66223cf0148842ccef429de273d77be2d91c24d98732977fc42b1f068f6f08807faebb061607bf27384bc1555daa8137d235f  glide-0_git20181004.yaml
1d941f26aaaebff4bccf6bc50688cd38f315e819f0521a1a0fa43acca00173c561376dd5ef7d2bf42d0fe03a016a5bb303e7c42786b847033215ebb2d74e5ba7  glide-0_git20181004.lock"