1 |
|
# Copyright 1999-2020 Gentoo Authors
|
|
1 |
# Copyright 2016-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
5 |
|
inherit fcaps go-module tmpfiles systemd
|
6 |
|
MY_PV="${PV/_rc/-rc}"
|
|
4 |
EAPI=8
|
|
5 |
|
|
6 |
inherit fcaps go-module tmpfiles systemd flag-o-matic
|
7 |
7 |
|
8 |
8 |
DESCRIPTION="A painless self-hosted Git service"
|
9 |
|
HOMEPAGE="https://gitea.io"
|
|
9 |
HOMEPAGE="https://gitea.io https://github.com/go-gitea/gitea"
|
10 |
10 |
|
11 |
|
if [[ ${PV} != 9999* ]] ; then
|
12 |
|
SRC_URI="https://github.com/go-gitea/gitea/releases/download/v${MY_PV}/gitea-src-${MY_PV}.tar.gz -> ${P}.tar.gz"
|
13 |
|
KEYWORDS="~amd64 ~arm ~arm64"
|
14 |
|
S="${WORKDIR}"
|
15 |
|
else
|
16 |
|
EGIT_REPO_URI="https://github.com/go-gitea/gitea"
|
|
11 |
if [[ ${PV} == *9999 ]]; then
|
17 |
12 |
inherit git-r3
|
18 |
|
S="${WORKDIR}/${P}"
|
|
13 |
EGIT_REPO_URI="https://github.com/go-gitea/gitea.git"
|
|
14 |
else
|
|
15 |
SRC_URI="https://github.com/go-gitea/gitea/releases/download/v${PV}/gitea-src-${PV}.tar.gz -> ${P}.tar.gz"
|
|
16 |
KEYWORDS="amd64 ~arm ~arm64 ~riscv ~x86"
|
19 |
17 |
fi
|
20 |
18 |
|
|
19 |
S="${WORKDIR}/${PN}-src-${PV}"
|
|
20 |
|
21 |
21 |
LICENSE="Apache-2.0 BSD BSD-2 ISC MIT MPL-2.0"
|
22 |
22 |
SLOT="0"
|
23 |
|
IUSE="+acct build-client pam sqlite"
|
|
23 |
IUSE="+acct pam sqlite pie"
|
24 |
24 |
|
25 |
|
BDEPEND="build-client? ( >=net-libs/nodejs-10[npm] )"
|
26 |
|
COMMON_DEPEND="
|
|
25 |
DEPEND="
|
27 |
26 |
acct? (
|
28 |
27 |
acct-group/git
|
29 |
28 |
acct-user/git[gitea] )
|
30 |
29 |
pam? ( sys-libs/pam )"
|
31 |
|
DEPEND="${COMMON_DEPEND}"
|
32 |
|
RDEPEND="${COMMON_DEPEND}
|
|
30 |
RDEPEND="${DEPEND}
|
33 |
31 |
dev-vcs/git"
|
34 |
32 |
|
35 |
33 |
DOCS=(
|
36 |
|
custom/conf/app.ini.sample CONTRIBUTING.md README.md
|
|
34 |
custom/conf/app.example.ini CONTRIBUTING.md README.md
|
37 |
35 |
)
|
38 |
36 |
FILECAPS=(
|
39 |
|
cap_net_bind_service+ep usr/bin/gitea
|
40 |
|
)
|
41 |
|
PATCHES=(
|
42 |
|
"${FILESDIR}/1.12-fix-vendoring.patch"
|
|
37 |
-m 711 cap_net_bind_service+ep usr/bin/gitea
|
43 |
38 |
)
|
44 |
39 |
|
|
40 |
RESTRICT="test"
|
|
41 |
|
45 |
42 |
src_prepare() {
|
46 |
43 |
default
|
47 |
44 |
|
48 |
45 |
local sedcmds=(
|
49 |
|
-e "s#^RUN_MODE = dev#RUN_MODE = prod#"
|
50 |
46 |
-e "s#^ROOT =#ROOT = ${EPREFIX}/var/lib/gitea/gitea-repositories#"
|
51 |
47 |
-e "s#^ROOT_PATH =#ROOT_PATH = ${EPREFIX}/var/log/gitea#"
|
52 |
48 |
-e "s#^APP_DATA_PATH = data#APP_DATA_PATH = ${EPREFIX}/var/lib/gitea/data#"
|
... | ... | |
55 |
51 |
-e "s#^LEVEL = Trace#LEVEL = Info#"
|
56 |
52 |
-e "s#^LOG_SQL = true#LOG_SQL = false#"
|
57 |
53 |
-e "s#^DISABLE_ROUTER_LOG = false#DISABLE_ROUTER_LOG = true#"
|
58 |
|
-e "s#^APP_ID =#;APP_ID =#"
|
59 |
|
-e "s#^TRUSTED_FACETS =#;TRUSTED_FACETS =#"
|
60 |
54 |
)
|
61 |
55 |
|
62 |
|
sed -i "${sedcmds[@]}" custom/conf/app.ini.sample || die
|
|
56 |
sed -i "${sedcmds[@]}" custom/conf/app.example.ini || die
|
63 |
57 |
if use sqlite ; then
|
64 |
|
sed -i -e "s#^DB_TYPE = .*#DB_TYPE = sqlite3#" custom/conf/app.ini.sample || die
|
|
58 |
sed -i -e "s#^DB_TYPE = .*#DB_TYPE = sqlite3#" custom/conf/app.example.ini || die
|
65 |
59 |
fi
|
|
60 |
}
|
66 |
61 |
|
67 |
|
einfo "Remove tests which are known to fail with network-sandbox enabled."
|
68 |
|
rm ./modules/migrations/github_test.go || die
|
69 |
|
|
70 |
|
einfo "Remove tests which depend on gitea git-repo."
|
71 |
|
rm ./modules/git/blob_test.go || die
|
72 |
|
rm ./modules/git/repo_test.go || die
|
73 |
|
|
74 |
|
# Remove already build assets (like frontend part)
|
75 |
|
use build-client && emake clean-all
|
|
62 |
src_configure() {
|
|
63 |
# bug 832756 - PIE build issues
|
|
64 |
filter-flags -fPIE
|
|
65 |
filter-ldflags -fPIE -pie
|
76 |
66 |
}
|
77 |
67 |
|
78 |
68 |
src_compile() {
|
... | ... | |
87 |
77 |
"-X code.gitea.io/gitea/modules/setting.AppWorkPath=${EPREFIX}/var/lib/gitea"
|
88 |
78 |
)
|
89 |
79 |
local makeenv=(
|
90 |
|
TAGS="${gitea_tags[@]}"
|
91 |
|
LDFLAGS="-extldflags \"${LDFLAGS}\" ${gitea_settings[@]}"
|
|
80 |
DRONE_TAG="${PV}"
|
|
81 |
LDFLAGS="-extldflags \"${LDFLAGS}\" ${gitea_settings[*]}"
|
|
82 |
TAGS="${gitea_tags[*]}"
|
92 |
83 |
)
|
93 |
|
[[ ${PV} != 9999* ]] && makeenv+=("DRONE_TAG=${MY_PV}")
|
94 |
84 |
|
95 |
|
if use build-client; then
|
96 |
|
# -j1 as Makefile doesn't handle dependancy correctly, and is not
|
97 |
|
# useful as golang compiler don't use this info.
|
98 |
|
env "${makeenv[@]}" emake -j1 build
|
99 |
|
else
|
100 |
|
env "${makeenv[@]}" emake backend
|
|
85 |
GOFLAGS=""
|
|
86 |
if use pie ; then
|
|
87 |
GOFLAGS+="-buildmode=pie"
|
101 |
88 |
fi
|
|
89 |
|
|
90 |
env "${makeenv[@]}" emake EXTRA_GOFLAGS="${GOFLAGS}" backend
|
102 |
91 |
}
|
103 |
92 |
|
104 |
93 |
src_install() {
|
... | ... | |
111 |
100 |
newtmpfiles - gitea.conf <<-EOF
|
112 |
101 |
d /run/gitea 0755 git git
|
113 |
102 |
EOF
|
114 |
|
systemd_newunit "${FILESDIR}"/gitea.service-r2 gitea.service
|
|
103 |
systemd_newunit "${FILESDIR}"/gitea.service-r3 gitea.service
|
115 |
104 |
|
116 |
105 |
insinto /etc/gitea
|
117 |
|
newins custom/conf/app.ini.sample app.ini
|
118 |
|
if use acct ; then
|
|
106 |
newins custom/conf/app.example.ini app.ini
|
|
107 |
if use acct; then
|
119 |
108 |
fowners root:git /etc/gitea/{,app.ini}
|
120 |
109 |
fperms g+w,o-rwx /etc/gitea/{,app.ini}
|
121 |
110 |
|
... | ... | |
124 |
113 |
keepdir /var/log/gitea
|
125 |
114 |
fi
|
126 |
115 |
}
|
|
116 |
|
|
117 |
pkg_postinst() {
|
|
118 |
fcaps_pkg_postinst
|
|
119 |
tmpfiles_process gitea.conf
|
|
120 |
|
|
121 |
ewarn "The default JWT signing algorithm changed in 1.15.0 from HS256 (symmetric) to"
|
|
122 |
ewarn "RS256 (asymmetric). Gitea OAuth2 tokens (and potentially client secrets) will"
|
|
123 |
ewarn "need to be regenerated unless you change your JWT_SIGNING_ALGORITHM back to HS256."
|
|
124 |
ewarn "For other breaking changes, see <https://github.com/go-gitea/gitea/releases/tag/v1.15.0>."
|
|
125 |
}
|