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 v2 3/5] www-apps/gitea: Use acct-{group,user}/git
Date: Sat, 17 Aug 2019 20:49:46
Message-Id: 20190817204826.406692-3-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH v2 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 | 104 +++++++++++++++++++++++++++
4 1 file changed, 104 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..1ea27d61e47f
10 --- /dev/null
11 +++ b/www-apps/gitea/gitea-1.8.3-r1.ebuild
12 @@ -0,0 +1,104 @@
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 + !dev-vcs/gitolite
39 + !dev-vcs/gitolite-gentoo"
40 +
41 +DOCS=( custom/conf/app.ini.sample CONTRIBUTING.md README.md )
42 +S="${WORKDIR}/${P}/src/${EGO_PN}"
43 +
44 +gitea_make() {
45 + local my_tags=(
46 + bindata
47 + $(usev pam)
48 + $(usex sqlite 'sqlite sqlite_unlock_notify' '')
49 + )
50 + local my_makeopt=(
51 + DRONE_TAG=${PV}
52 + TAGS="${my_tags[@]}"
53 + )
54 + GOPATH=${WORKDIR}/${P}:$(get_golibdir_gopath) emake "${my_makeopt[@]}" "$@"
55 +}
56 +
57 +src_prepare() {
58 + default
59 + sed -i \
60 + -e "s#^RUN_MODE = dev#RUN_MODE = prod#" \
61 + -e "s#^ROOT =#ROOT = ${EPREFIX}/var/lib/gitea/gitea-repositories#" \
62 + -e "s#^ROOT_PATH =#ROOT_PATH = ${EPREFIX}/var/log/gitea#" \
63 + -e "s#^APP_DATA_PATH = data#APP_DATA_PATH = ${EPREFIX}/var/lib/gitea/data#" \
64 + -e "s#^HTTP_ADDR = 0.0.0.0#HTTP_ADDR = 127.0.0.1#" \
65 + -e "s#^MODE = console#MODE = file#" \
66 + -e "s#^LEVEL = Trace#LEVEL = Info#" \
67 + -e "s#^LOG_SQL = true#LOG_SQL = false#" \
68 + -e "s#^DISABLE_ROUTER_LOG = false#DISABLE_ROUTER_LOG = true#" \
69 + -e "s#^APP_ID =#;APP_ID =#" \
70 + -e "s#^TRUSTED_FACETS =#;TRUSTED_FACETS =#" \
71 + custom/conf/app.ini.sample || die
72 + if use sqlite ; then
73 + sed -i -e "s#^DB_TYPE = .*#DB_TYPE = sqlite3#" custom/conf/app.ini.sample || die
74 + fi
75 +
76 + gitea_make generate
77 +}
78 +
79 +src_compile() {
80 + gitea_make build
81 +}
82 +
83 +src_test() {
84 + gitea_make test
85 +}
86 +
87 +src_install() {
88 + dobin gitea
89 +
90 + einstalldocs
91 +
92 + newconfd "${FILESDIR}"/gitea.confd-r1 gitea
93 + newinitd "${FILESDIR}"/gitea.initd-r3 gitea
94 + systemd_newunit "${FILESDIR}"/gitea.service-r2 gitea.service
95 +
96 + insinto /etc/gitea
97 + newins custom/conf/app.ini.sample app.ini
98 + fowners root:git /etc/gitea/{,app.ini}
99 + fperms g+w,o-rwx /etc/gitea/{,app.ini}
100 +
101 + diropts -m0750 -o git -g git
102 + keepdir /var/lib/gitea/custom /var/lib/gitea/data
103 + keepdir /var/log/gitea
104 +}
105 +
106 +pkg_postinst() {
107 + if [[ -e "${EROOT}/var/lib/gitea/conf/app.ini" ]]; then
108 + ewarn "The configuration path has been changed to ${EROOT}/etc/gitea/app.ini."
109 + ewarn "Please move your configuration from ${EROOT}/var/lib/gitea/conf/app.ini"
110 + ewarn "and adapt the gitea-repositories hooks and ssh authorized_keys."
111 + ewarn "Depending on your configuration you should run something like:"
112 + ewarn "sed -i -e 's#${EROOT}/var/lib/gitea/conf/app.ini#${EROOT}/etc/gitea/app.ini#' \\"
113 + ewarn " /var/lib/gitea/gitea-repositories/*/*/hooks/*/* \\"
114 + ewarn " /var/lib/gitea/.ssh/authorized_keys"
115 + fi
116 +}
117 --
118 2.23.0.rc2