aboutsummaryrefslogtreecommitdiffstats
path: root/testing/gogs/APKBUILD
blob: 5aa717d8916da1571ac58f1728b2d84efa609734 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: 7heo <7heo@mail.com>
pkgname=gogs
pkgver=0.9.13
pkgrel=0
pkgdesc="A self-hosted Git service written in Go"
url="http://gogs.io/"
arch="all"
license="MIT"
depends="git"
makedepends="go-tools perl libcap"
install="$pkgname.pre-install"
pkgusers="gogs"
pkggroups="www-data"
options="!strip"
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	$pkgname.ini"
builddir="$srcdir/src/github.com/gogits"

_disturl="dev.alpinelinux.org:/archive/$pkgname/"
_gourl="github.com/gogits/gogs"

snapshot() {
	abuild clean && abuild deps
	export GOPATH="$srcdir"
	msg "Checking out v${pkgver} tag"
	# go get will not checkout a specific tag
	# so we run our own git checkout branch
	git clone --quiet --branch v${pkgver} \
		https://$_gourl $builddir || return 1
	cd $builddir
	# fetch deps
	go get -v -d -tags "sqlite redis memcache" || return 1
	cd "$srcdir"
	tar zcf $pkgname-$pkgver.tar.gz src || return 1
	rsync --progress -La $pkgname-$pkgver.tar.gz \
		$_disturl || return 1
	cd $startdir && abuild undeps
}

build() {
	cd "$builddir"/$pkgname || return 1
	export GOPATH="$srcdir"
	go fix || return 1
	go build -v -tags "sqlite redis memcache cert" || return 1
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/usr/share/webapps/$pkgname \
		 "$pkgdir"/var/lib/$pkgname/git \
		 "$pkgdir"/var/lib/$pkgname/db \
		 "$pkgdir"/var/lib/$pkgname/avatars \
		 "$pkgdir"/var/lib/$pkgname/attachements \
		 "$pkgdir"/var/cache/$pkgname/sessions \
		 "$pkgdir"/var/log/$pkgname || return 1
	chown -R gogs:www-data "$pkgdir"/var/lib/$pkgname \
		"$pkgdir"/var/cache/gogs/sessions \
		"$pkgdir"/var/log/$pkgname || return 1
	install -Dm 0755 $pkgname/$pkgname \
		"$pkgdir"/usr/bin/$pkgname || return 1
	# allow to bind to port 80
	setcap cap_net_bind_service=+ep \
		"$pkgdir"/usr/bin/$pkgname || return 1
	install -d -o gogs -g www-data \
			"$pkgdir"/etc/$pkgname/conf || return 1
	install -Dm 0664 -o gogs -g www-data "$srcdir"/${pkgname}.ini \
		"$pkgdir"/etc/$pkgname/conf/app.ini || return 1
	mv $pkgname/public "$pkgdir"/usr/share/webapps/$pkgname/ || return 1
	mv $pkgname/templates "$pkgdir"/usr/share/webapps/$pkgname/ || return 1
	install -D -m755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname || return 1
	install -D -m644 "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname || return 1
}

md5sums="0d609a490ea2b225cfc9153b47d7392a  gogs-0.9.13.tar.gz
91cd8b6b27509beecb53594463315f43  gogs.initd
6b3f501f9c37b5032cab8b49b5621fc4  gogs.confd
82edfdabfdf0ac64dc545036ca499465  gogs.ini"
sha256sums="6c2f79eecfd89197ad6359f389e9de39cd4f7211566ef6488437e7f5dc94b31d  gogs-0.9.13.tar.gz
23a9bfcf7d1fd7cb5b7bf13ab0b0f412c29c1ebdd62fc02c78dd885cbe5d703d  gogs.initd
a1c584dbc2d44694ffcf87ecafdf6a43ae81370175ca9cc6e6ff7623b8b05254  gogs.confd
ead0082c56e8e8f9e9ba7f4c206c2a18bb732726137b71e05d83347638562530  gogs.ini"
sha512sums="88a6889ada2e42cc5b6e362a868230f3ce9f814cc6914cfe59abd5a320b0cb908e20d7f274c2f61f17b9a6d5e385633ffeb9697274ea5406fad3c0522dab9b49  gogs-0.9.13.tar.gz
be5a9ef2cae1ee2e8106feb6a997ae06519af91fe57f746d20996e79c332c93bb43fc53f79ff4e8ce13222afc6f3dc7bc5cbb758ef201b03e49d809c87c8c4c7  gogs.initd
52ce41c05c263b790221a04d13d2eb9bba689e4bd72daf5b6af31416e80a485a46bae19e18581d7bde879307283847e6486686a2fe4140fe38ebb6f315e11a86  gogs.confd
4c2b398cf93ebb8b743b9e7ec1b075706427081036effb53fa90729e70fbc3eb92f2f853278b887ca79dc35cd55a64e1bff4d18e1ad246beab2a723aa9cd71ba  gogs.ini"