ahtiports/forgejo/APKBUILD

109 lines
3.5 KiB
Text

# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Contributor: 6543 <6543@obermui.de>
# Contributor: techknowlogick <techknowlogick@gitea.io>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=forgejo
pkgver=10.0.3
pkgrel=0
pkgdesc="Self-hosted Git service written in Go"
url="https://forgejo.org"
arch="all"
license="GPL-3.0-or-later"
depends="git git-lfs gnupg"
makedepends="go nodejs npm"
checkdepends="bash openssh openssh-keygen sqlite tzdata"
install="$pkgname.pre-install"
pkgusers="forgejo"
pkggroups="www-data"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://codeberg.org/forgejo/forgejo/archive/v$pkgver.tar.gz
$pkgname.initd
$pkgname.ini
"
builddir="$srcdir/forgejo"
options="!check net chmod-clean" # broken with GIT_CEILING
# secfixes:
# 7.0.4-r0:
# - CVE-2024-24789
# 7.0.3-r0:
# - CVE-2024-24788
# 1.21.10.0-r0:
# - CVE-2023-45288
# 1.21.3.0-r0:
# - CVE-2023-48795
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
# Skip tests for archs that fail unrelated in CI
case "$CARCH" in
s390x|x86|armhf|armv7) options="$options !check" ;;
esac
prepare() {
default_prepare
npm ci
}
build() {
# XXX: LARGEFILE64
export CGO_CFLAGS="$CFLAGS -O2 -D_LARGEFILE64_SOURCE"
export TAGS="bindata sqlite sqlite_unlock_notify pam"
export GITEA_VERSION="$pkgver"
export EXTRA_GOFLAGS="$GOFLAGS"
export CGO_LDFLAGS="$LDFLAGS"
unset LDFLAGS
## make FHS compliant
local setting="code.gitea.io/gitea/modules/setting"
export LDFLAGS="$LDFLAGS -X $setting.CustomConf=/etc/forgejo/app.ini"
export LDFLAGS="$LDFLAGS -X $setting.AppWorkPath=/var/lib/forgejo/"
make -j1 build
}
check() {
local home="$srcdir"/home
mkdir -p "$home"
install -d -m700 "$home"/.ssh
touch "$home"/.gitconfig
env GITEA_ROOT="$home" HOME="$home" GITEA_WORK_DIR="$(pwd)" timeout -s ABRT 20m make -j1 test-sqlite
## "make test" - modified (exclude broken tests)
## 'code.gitea.io/gitea/modules/migrations': github hase rate limits! 403 API
local tests=$(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/models/migrations' |
grep -v 'code.gitea.io/gitea/services/migrations' |
grep -v 'code.gitea.io/gitea/integrations')
env GITEA_CONF="$PWD/tests/sqlite.ini" GITEA_ROOT="$home" HOME="$home" GO111MODULE=on go test -mod=vendor -tags='sqlite sqlite_unlock_notify pam' $tests
}
package() {
for dir in forgejo forgejo/git forgejo/data forgejo/db forgejo/custom; do
install -dm750 -o forgejo -g www-data \
"$pkgdir"/var/lib/$dir
done
install -dm755 -o forgejo -g www-data "$pkgdir"/var/log/forgejo
# TODO: rename when upstream does: https://codeberg.org/forgejo/forgejo/issues/5174
install -Dm755 -g www-data gitea "$pkgdir"/usr/bin/forgejo
install -Dm644 -o forgejo -g www-data "$srcdir"/forgejo.ini \
"$pkgdir"/etc/forgejo/app.ini
chown forgejo:www-data "$pkgdir"/etc/forgejo
install -Dm755 "$srcdir"/forgejo.initd \
"$pkgdir"/etc/init.d/forgejo
}
sha512sums="
372a7e79c5f6c134a737a479313a3f811eb34c4073c4a0dbe67db8c553a6dae11eb5a5f430c32848003a83f99e17a5365651650da799ec91dc436a330ae52581 forgejo-10.0.3.tar.gz
497d8575f2eb5ac43baf82452e76007ef85e22cca2cc769f1cf55ffd03d7ce4d50ac4dc2b013e23086b7a5577fc6de5a4c7e5ec7c287f0e3528e908aaa2982aa forgejo.initd
b537b41b6b3a945274a6028800f39787b48c318425a37cf5d40ace0d1b305444fd07f17b4acafcd31a629bedd7d008b0bb3e30f82ffeb3d7e7e947bdbe0ff4f3 forgejo.ini
"