aboutsummaryrefslogtreecommitdiffstats
path: root/community/gitea/APKBUILD
blob: 47c347ba4f3e6fd32fa9fad91befdd5d5b77f8b0 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Contributor: 6543 <6543@obermui.de>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=gitea
pkgver=1.11.2
pkgrel=0
pkgdesc="A self-hosted Git service written in Go"
url="https://gitea.io"
arch="all"
license="MIT"
options="chmod-clean"
depends="git git-lfs gnupg"
makedepends="go libcap nodejs npm"
checkdepends="bash git git-lfs gnupg openssh openssh-keygen sqlite"
install="$pkgname.pre-install"
pkgusers="gitea"
pkggroups="www-data"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/go-gitea/gitea/archive/v$pkgver.tar.gz
	$pkgname.initd
	$pkgname.ini
	"
builddir="$srcdir/src/code.gitea.io/$pkgname"

case "$CARCH" in
s390x|x86) options="!check" ;;
esac

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

build() {
	export GOPATH="$srcdir"
	export TAGS="tidb sqlite sqlite_unlock_notify"
	export GITEA_VERSION="$pkgver"
	unset LDFLAGS
	make build
}

check() {
	## "make test" - modified (exclude broken tests)
	## 'code.gitea.io/gitea/modules/migrations': github hase rate limits! 403 API
	PACKAGES=$(go list ./... | grep -v /vendor/ | \
		grep -v 'code.gitea.io/gitea/modules/migrations' | \
		grep -v 'code.gitea.io/gitea/modules/charset' | \
		grep -v 'code.gitea.io/gitea/integrations' | \
		grep -v 'code.gitea.io/gitea/modules/git')
	GO111MODULE=on go test -mod=vendor -tags='sqlite sqlite_unlock_notify' $PACKAGES

	timeout -s ABRT 20m make test-sqlite
}

package() {
	for dir in $pkgname $pkgname/git $pkgname/data $pkgname/db $pkgname/custom; do
		install -d -m 750 -o gitea -g www-data \
			"$pkgdir"/var/lib/$dir
	done

	install -d -m 755 -o gitea -g www-data "$pkgdir"/var/log/$pkgname

	install -D -m 755 $pkgname "$pkgdir"/usr/bin/$pkgname

	# Allow non root to bind to port 80.
	setcap cap_net_bind_service=+ep \
		"$pkgdir"/usr/bin/$pkgname

	install -D -m 644 -o gitea -g www-data "$srcdir"/gitea.ini \
		"$pkgdir"/etc/$pkgname/app.ini
	chown gitea:www-data "$pkgdir"/etc/$pkgname

	install -d -m 755 "$pkgdir"/usr/share/webapps/$pkgname
	mv options public templates "$pkgdir"/usr/share/webapps/$pkgname/

	install -D -m 755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
}

sha512sums="01419848e0fcb7283706271c06c8bf8d77d29e496e79adfa4ee83c5e448c2c8f33775fe39559b31f289c29dfa81f4bd2df566c4d2acef70015a4ff7e90790715  gitea-1.11.2.tar.gz
2497e6f2a18e3ceb65352cd220eab2c1c0893d0e731600462a60397de2b70d7c1de7db2af2769b25fe708b0822c811bb20dc797b59b9dd93efb376bea1c35796  gitea.initd
0fd40db2ec9150b354448f1fa6c8cd2515911619935afb55f070a1a9f594badce2cd46b436b930464495f6561f97c999de2489710761e3f829832b8e4da5eb23  gitea.ini"