Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: xdch47@××××××.de, nemunaire@×××××××.re, idl0r@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 3/5] www-apps/gitea: Use acct-{group,user}/git
Date: Sat, 17 Aug 2019 07:07:38
Message-Id: 20190817070648.185374-3-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/5] acct-group/git: Add git group, GID 196 by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 www-apps/gitea/gitea-1.8.3-r1.ebuild | 102 +++++++++++++++++++++++++++
4 1 file changed, 102 insertions(+)
5 create mode 100644 www-apps/gitea/gitea-1.8.3-r1.ebuild
6
7 diff --git a/www-apps/gitea/gitea-1.8.3-r1.ebuild b/www-apps/gitea/gitea-1.8.3-r1.ebuild
8 new file mode 100644
9 index 000000000000..e78e0438b47a
10 --- /dev/null
11 +++ b/www-apps/gitea/gitea-1.8.3-r1.ebuild
12 @@ -0,0 +1,102 @@
13 +# Copyright 1999-2019 Gentoo Authors
14 +# Distributed under the terms of the GNU General Public License v2
15 +
16 +EAPI=7
17 +inherit golang-vcs-snapshot systemd user
18 +
19 +EGO_PN="code.gitea.io/gitea"
20 +
21 +DESCRIPTION="A painless self-hosted Git service"
22 +HOMEPAGE="https://gitea.io"
23 +SRC_URI="https://github.com/go-gitea/gitea/archive/v${PV}.tar.gz -> ${P}.tar.gz"
24 +
25 +LICENSE="MIT"
26 +SLOT="0"
27 +KEYWORDS="~amd64 ~arm ~arm64"
28 +IUSE="pam sqlite"
29 +
30 +COMMON_DEPEND="
31 + acct-group/git
32 + acct-user/git[gitea]
33 + pam? ( sys-libs/pam )"
34 +DEPEND="${COMMON_DEPEND}
35 + dev-go/go-bindata"
36 +RDEPEND="${COMMON_DEPEND}
37 + dev-vcs/git"
38 +
39 +DOCS=( custom/conf/app.ini.sample CONTRIBUTING.md README.md )
40 +S="${WORKDIR}/${P}/src/${EGO_PN}"
41 +
42 +gitea_make() {
43 + local my_tags=(
44 + bindata
45 + $(usev pam)
46 + $(usex sqlite 'sqlite sqlite_unlock_notify' '')
47 + )
48 + local my_makeopt=(
49 + DRONE_TAG=${PV}
50 + TAGS="${my_tags[@]}"
51 + )
52 + GOPATH=${WORKDIR}/${P}:$(get_golibdir_gopath) emake "${my_makeopt[@]}" "$@"
53 +}
54 +
55 +src_prepare() {
56 + default
57 + sed -i \
58 + -e "s#^RUN_MODE = dev#RUN_MODE = prod#" \
59 + -e "s#^ROOT =#ROOT = ${EPREFIX}/var/lib/gitea/gitea-repositories#" \
60 + -e "s#^ROOT_PATH =#ROOT_PATH = ${EPREFIX}/var/log/gitea#" \
61 + -e "s#^APP_DATA_PATH = data#APP_DATA_PATH = ${EPREFIX}/var/lib/gitea/data#" \
62 + -e "s#^HTTP_ADDR = 0.0.0.0#HTTP_ADDR = 127.0.0.1#" \
63 + -e "s#^MODE = console#MODE = file#" \
64 + -e "s#^LEVEL = Trace#LEVEL = Info#" \
65 + -e "s#^LOG_SQL = true#LOG_SQL = false#" \
66 + -e "s#^DISABLE_ROUTER_LOG = false#DISABLE_ROUTER_LOG = true#" \
67 + -e "s#^APP_ID =#;APP_ID =#" \
68 + -e "s#^TRUSTED_FACETS =#;TRUSTED_FACETS =#" \
69 + custom/conf/app.ini.sample || die
70 + if use sqlite ; then
71 + sed -i -e "s#^DB_TYPE = .*#DB_TYPE = sqlite3#" custom/conf/app.ini.sample || die
72 + fi
73 +
74 + gitea_make generate
75 +}
76 +
77 +src_compile() {
78 + gitea_make build
79 +}
80 +
81 +src_test() {
82 + gitea_make test
83 +}
84 +
85 +src_install() {
86 + dobin gitea
87 +
88 + einstalldocs
89 +
90 + newconfd "${FILESDIR}"/gitea.confd-r1 gitea
91 + newinitd "${FILESDIR}"/gitea.initd-r3 gitea
92 + systemd_newunit "${FILESDIR}"/gitea.service-r2 gitea.service
93 +
94 + insinto /etc/gitea
95 + newins custom/conf/app.ini.sample app.ini
96 + fowners root:git /etc/gitea/{,app.ini}
97 + fperms g+w,o-rwx /etc/gitea/{,app.ini}
98 +
99 + diropts -m0750 -o git -g git
100 + keepdir /var/lib/gitea/custom /var/lib/gitea/data
101 + keepdir /var/log/gitea
102 +}
103 +
104 +pkg_postinst() {
105 + if [[ -e "${EROOT}/var/lib/gitea/conf/app.ini" ]]; then
106 + ewarn "The configuration path has been changed to ${EROOT}/etc/gitea/app.ini."
107 + ewarn "Please move your configuration from ${EROOT}/var/lib/gitea/conf/app.ini"
108 + ewarn "and adapt the gitea-repositories hooks and ssh authorized_keys."
109 + ewarn "Depending on your configuration you should run something like:"
110 + ewarn "sed -i -e 's#${EROOT}/var/lib/gitea/conf/app.ini#${EROOT}/etc/gitea/app.ini#' \\"
111 + ewarn " /var/lib/gitea/gitea-repositories/*/*/hooks/*/* \\"
112 + ewarn " /var/lib/gitea/.ssh/authorized_keys"
113 + fi
114 +}
115 --
116 2.23.0.rc2

Replies