2025-11-18 16:58:46 +01:00
|
|
|
# Copyright 2024-2026 Gentoo Authors
|
|
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
|
|
|
|
|
|
EAPI=8
|
|
|
|
|
inherit go-module systemd
|
|
|
|
|
|
|
|
|
|
DESCRIPTION="A daemon that connects to a Forgejo instance and runs jobs for CI"
|
|
|
|
|
HOMEPAGE="https://code.forgejo.org/forgejo/runner https://forgejo.org/docs/next/admin/actions/"
|
|
|
|
|
|
|
|
|
|
if [[ "${PV}" == *9999* ]]; then
|
|
|
|
|
inherit git-r3
|
|
|
|
|
EGIT_REPO_URI="https://code.forgejo.org/forgejo/runner.git"
|
|
|
|
|
else
|
|
|
|
|
SRC_URI="
|
|
|
|
|
https://code.forgejo.org/forgejo/runner/archive/v${PV}.tar.gz -> ${P}.tar.gz
|
|
|
|
|
https://github.com/gentoo-golang-dist/${PN}/releases/download/v${PV}/${P}-deps.tar.xz
|
|
|
|
|
"
|
|
|
|
|
S="${WORKDIR}/runner"
|
|
|
|
|
|
|
|
|
|
KEYWORDS="~amd64 ~arm64"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
LICENSE="MIT"
|
|
|
|
|
SLOT="0"
|
2026-03-27 15:21:15 +01:00
|
|
|
IUSE="+docker examples podman lxc"
|
2025-11-18 16:58:46 +01:00
|
|
|
RESTRICT="test"
|
2026-03-17 17:07:47 +00:00
|
|
|
REQUIRED_USE="|| ( docker podman lxc )"
|
2025-11-18 16:58:46 +01:00
|
|
|
|
|
|
|
|
DEPEND="
|
2026-03-16 15:51:26 +00:00
|
|
|
>=dev-lang/go-1.25.8
|
2025-11-18 16:58:46 +01:00
|
|
|
"
|
|
|
|
|
|
2026-03-17 17:07:47 +00:00
|
|
|
RDEPEND="
|
2026-03-27 15:14:35 +01:00
|
|
|
acct-user/${PN}[docker=,podman=,lxc=]
|
2026-03-17 17:07:47 +00:00
|
|
|
"
|
|
|
|
|
|
2025-11-18 16:58:46 +01:00
|
|
|
src_unpack() {
|
|
|
|
|
if [[ "${PV}" == *9999* ]]; then
|
|
|
|
|
git-r3_src_unpack
|
|
|
|
|
go-module_live_vendor
|
|
|
|
|
else
|
|
|
|
|
go-module_src_unpack
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-27 15:14:35 +01:00
|
|
|
src_prepare() {
|
|
|
|
|
default
|
|
|
|
|
|
|
|
|
|
sed \
|
|
|
|
|
-e "/ExecStart=/s#=.*#=${EPREFIX}/usr/bin/forgejo-runner daemon -c %h/runner-config.yml#g" \
|
|
|
|
|
-e "/ExecReload=/s#=#=${EPREFIX}#g" \
|
|
|
|
|
-e "/User=/s#=.*#=${PN}#g" \
|
|
|
|
|
-e '/WorkingDirectory=/s#=.*#/=~#g' \
|
|
|
|
|
-i contrib/forgejo-runner.service || die
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 16:58:46 +01:00
|
|
|
src_compile() {
|
|
|
|
|
# export version information
|
|
|
|
|
# https://github.com/gentoo/guru/pull/205
|
|
|
|
|
# https://forums.gentoo.org/viewtopic-p-8831646.html
|
|
|
|
|
local VERSION
|
|
|
|
|
if [[ "${PV}" == *9999* ]]; then
|
|
|
|
|
VERSION="$(
|
|
|
|
|
git describe --tags --first-parent --abbrev=7 --long --dirty --always \
|
|
|
|
|
| sed -e "s/^v//g"
|
|
|
|
|
)"
|
|
|
|
|
else
|
|
|
|
|
VERSION="${PVR}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
local EXTRA_GOFLAGS_LD=(
|
|
|
|
|
# "-w" # disable DWARF generation
|
|
|
|
|
# "-s" # disable symbol table
|
|
|
|
|
"-X=code.forgejo.org/forgejo/runner/v11/internal/pkg/ver.version=v${VERSION}"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
GOFLAGS+=" '-ldflags=${EXTRA_GOFLAGS_LD[*]}'"
|
|
|
|
|
|
|
|
|
|
ego build -tags 'netgo osusergo' -o forgejo-runner
|
|
|
|
|
|
|
|
|
|
# Makefile does this
|
|
|
|
|
# emake forgejo-runner
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
src_install() {
|
|
|
|
|
dobin forgejo-runner
|
|
|
|
|
|
|
|
|
|
systemd_dounit "contrib/forgejo-runner.service"
|
|
|
|
|
|
|
|
|
|
dodoc "README.md"
|
|
|
|
|
if use examples; then
|
|
|
|
|
dodoc -r "examples"
|
|
|
|
|
docompress -x "/usr/share/doc/${PF}/examples"
|
|
|
|
|
fi
|
|
|
|
|
}
|