diff --git a/www-apps/gitea/Manifest b/www-apps/gitea/Manifest index 650e64c..5cda178 100644 --- a/www-apps/gitea/Manifest +++ b/www-apps/gitea/Manifest @@ -1,6 +1,13 @@ AUX app.ini 67 BLAKE2B 4ec7b8217486047b419202b3a8a7172ac21ae0e5ad9224cd4f010be730ac5cda9d05bf06dcba2d06f8809900094b3b007ef98dd4ea20a125fb7d3db279f53e4a SHA512 93f6f7cf49dd1ece56f7da711adbb58cc38a503527aeea140837d74456ee6f550a089e897d9cb94382e1eb3f5a5cbe4a61362534463eada08a91f314da0f2108 +AUX gitea-logflags.patch 424 BLAKE2B af7c4d5b75a68d96eb3a4b352bd446ad25016093c9acedb1a035e2aa10baf3e451a89f685b9891d6941262523283946539c83e49b432ff7b6040b02a23c10c76 SHA512 df180aba171ef5f12228fa9c420f32a9f2da9125e4ec9517d068bed6c4bd64f4c196da1feb557c40764566fa6238d86c933ea505b8cbbd106102866d720149ca +AUX gitea-mod-vendor.patch 1273 BLAKE2B 3067b17a972b92d0c402af4336ee41daa2f09d389a6e8bf218d33b103230bf8bb4b7003977447cc00293f8941f5002676398d4d755548e114e59cbb3840af8cc SHA512 12d8e0d2cb0998d31f8077f1498205bfee07e0df74926251f1ca38b9824c11246c07e413fc20beaed9ae49cac3d329468432f3fd2d5b25292c5bd656a88c7cc8 AUX gitea.confd 74 BLAKE2B 656800d35c8f0075005e7e9e5c804292f9884663f89f653426064a20cfbcb518f736bd94947a03bce5adad670fb6150d93026999d6d5395f37a85666b6663a2f SHA512 3e05bad19cd924c4375d9ca6fc57142ba4b5ec897a1c789c3fc9710dfcfee209a199c95040eece089ad93e0357486ab98fad0c448a61e318646b7a71845e9a25 +AUX gitea.confd-r1 243 BLAKE2B 87caa8371f53f52b0a85f720342f9f358dedec9240ab78998655a03df6bf3f301fe077afabdca1b1895dbcab2fa05748735d6f38f9b3ad53534fe8ae6e72db49 SHA512 485dc9d0b86d0a7b3ba958aac9de1129aa0ffbb47219419d38811f2accca2539e49dd93cc4a24b21f1c3802b024aa8449f54e320e8a16197f201532edeca6836 AUX gitea.initd-r1 688 BLAKE2B eb2341dee53f3fd92c49137855615d9ae7ca77efc396e2d2ed8b624ed2776c7522455a469c00172ecbbe2151ccab476baa0c779baf8a39f63348bdc7ebbd29c2 SHA512 4a6bba463c9abafcb6fc9f3854efd1a69fb3b213c2b34ff6a233f90db535c2ab0f375a0809e4c4be6651ed60d7696a54148a5ee9192567d70ca6a5203a8d3266 +AUX gitea.initd-r3 802 BLAKE2B 2e33e95f7d2762986184d45b0bbb250cc5e04fffc4e4b006233b28e5b57be69eef1d83441adebe2b94681585edaf77f9da4eb97930f91e75c1b1a5cd8d137633 SHA512 5ff2e653180a0601734fcd055dfffdfdc12363736ed2e56c8576c802398b90f4025b44002cbb9a3fd1e0c2d4c169f62d460381c6c549746d3390e55fc1c677d1 AUX gitea.service 472 BLAKE2B 4c728e2987d0c0a86e65d4b9c1a59f6193ff8a3f9b066991a06f495ad1c5586b3497c71fca1cce5b65f167af09343e7bf3215ee5e8fdefa539e384198d2d88d6 SHA512 6666fe3b4cdbb78a58db4a6bf47a15e6be9ab30b666c6eb77a9e8a002d8c0abd510fc75ef463a11ee6892ab12c98943774616072cb64fd9f2fa42ff8f676aa95 +AUX gitea.service-r2 734 BLAKE2B 84825b8198e9495e2803ca3702e6a631fb269c5c8fb4ff4246465a5bd7f7d796b0c3eaea72d0a25cef4f5d38d27a6c99a1b6d41f489749bef322a4ac93cfdd12 SHA512 287670f196bf6353dbdeb6ac37b4ac73693e16a6a3a83f57e7179ccb64364d1d85950a2ddd0a77238a3d218afdaacc8ba849c2810a7ba1238c7277074d1ebe39 DIST gitea-1.7.5.tar.gz 20855842 BLAKE2B 0455b1a467c9323ee0b5f2bb572cd3388bbf9462a28b6b8d1c87f2baab7da15b1be033d43a6c9cade34cb0c03b841fcb3f5fe42d16fb6bf3ce5c6bea72b0983f SHA512 baa917570bdfb4db86e3a2a666ba5e1e3d6fec245ece675f80a2949d15356534a8b82e29ade7c9f5add99d9a132ebf5dbf7405fec6cb07ca8ba83debb846233f +DIST gitea-1.9.4.tar.gz 25355645 BLAKE2B 69a7237f7bc2d6d90054e67faef110c2750cbca927c149f6c6b3394bef113494cda8f670809c4977c6c5e3c4ea7f609240952b262ea6c4a818c11d58945bc5d8 SHA512 a885567ffcc21ef821348be0b698b5f101bfc46b746603679441bee4c6abe34ea062bd0a2d5fb5c029ce26caa3b70a51c6d9088fdccebb44be74f1e523faf711 EBUILD gitea-1.7.5.ebuild 2012 BLAKE2B 362f2e876cb489cef8f30bd6587f194be57c985159f53df4ea9273f9e764377b35c1173089a1f1b26dcc2eea6931b1fadb594717eda1980d93b88d5c4a2835a6 SHA512 c7ec4ba8b929327a7503ec47f95a3ee6ab4a802e04d545e6dfcfe2f56d8bcfd82bb9dc50e4c121833a97dc98b9f141243f857227e3dba8a79d80a95fe4cc8615 +EBUILD gitea-1.9.4.ebuild 3149 BLAKE2B 17ffc73b72de3f124ab56595f77321b7e0288191a3e3124d0ed319f27e9fb3e23506e8b077ed419420387d83ddda8570e0e9e9aff5c6e49df646a3087dd611de SHA512 1429e89e51953d2012d1c0179e788bfa7762e6ce6ab73e1846eb1f5ac9e84bd07cc387e832208ca126bfb36b7a9cb0b60ecb28717b268d3898cd54ea397ad386 diff --git a/www-apps/gitea/files/gitea-logflags.patch b/www-apps/gitea/files/gitea-logflags.patch new file mode 100644 index 0000000..331bd3d --- /dev/null +++ b/www-apps/gitea/files/gitea-logflags.patch @@ -0,0 +1,13 @@ +diff --git a/modules/log/flags.go b/modules/log/flags.go +index 992fc62..5578a1b 100644 +--- a/modules/log/flags.go ++++ b/modules/log/flags.go +@@ -31,7 +31,7 @@ const ( + Lmedfile = Lshortfile | Llongfile + + // LstdFlags is the initial value for the standard logger +- LstdFlags = Ldate | Ltime | Lmedfile | Lshortfuncname | Llevelinitial ++ LstdFlags = Ldate | Ltime | Llevelinitial + ) + + var flagFromString = map[string]int{ diff --git a/www-apps/gitea/files/gitea-mod-vendor.patch b/www-apps/gitea/files/gitea-mod-vendor.patch new file mode 100644 index 0000000..c501e20 --- /dev/null +++ b/www-apps/gitea/files/gitea-mod-vendor.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile b/Makefile +index 796a0e3..2c6a6ef 100644 +--- a/Makefile ++++ b/Makefile +@@ -97,7 +97,7 @@ vet: + + .PHONY: generate + generate: +- GO111MODULE=on $(GO) generate $(PACKAGES) ++ GO111MODULE=on $(GO) generate -mod=vendor $(PACKAGES) + + .PHONY: generate-swagger + generate-swagger: +diff --git a/modules/options/options.go b/modules/options/options.go +index 723dd54..62e8c04 100644 +--- a/modules/options/options.go ++++ b/modules/options/options.go +@@ -5,7 +5,6 @@ + package options + + //go:generate go run -mod=vendor main.go +-//go:generate go fmt bindata.go + + type directorySet map[string][]string + +diff --git a/modules/public/public.go b/modules/public/public.go +index 8362b42..df70275 100644 +--- a/modules/public/public.go ++++ b/modules/public/public.go +@@ -18,7 +18,6 @@ import ( + ) + + //go:generate go run -mod=vendor main.go +-//go:generate go fmt bindata.go + + // Options represents the available options to configure the macaron handler. + type Options struct { +diff --git a/modules/templates/templates.go b/modules/templates/templates.go +index e7fe3b2..af6bf01 100644 +--- a/modules/templates/templates.go ++++ b/modules/templates/templates.go +@@ -5,4 +5,3 @@ + package templates + + //go:generate go run -mod=vendor main.go +-//go:generate go fmt bindata.go diff --git a/www-apps/gitea/files/gitea.confd-r1 b/www-apps/gitea/files/gitea.confd-r1 new file mode 100644 index 0000000..19018c1 --- /dev/null +++ b/www-apps/gitea/files/gitea.confd-r1 @@ -0,0 +1,14 @@ +# Gitea configuration +GITEA_CONF="/etc/gitea/app.ini" + +# Gitea user +GITEA_USER="git" + +# Gitea group +GITEA_GROUP="git" + +# Gitea working directory +GITEA_WORK_DIR="/var/lib/gitea" + +# Gitea custom directory +GITEA_CUSTOM="${GITEA_WORK_DIR}/custom" diff --git a/www-apps/gitea/files/gitea.initd-r3 b/www-apps/gitea/files/gitea.initd-r3 new file mode 100644 index 0000000..680ae83 --- /dev/null +++ b/www-apps/gitea/files/gitea.initd-r3 @@ -0,0 +1,22 @@ +#!/sbin/openrc-run +# Copyright 2016-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +description="Gitea, a self-hosted Git service" + +: ${GITEA_CONF:=/etc/gitea/app.ini} +: ${GITEA_USER:=git} +: ${GITEA_GROUP:=git} +: ${GITEA_WORK_DIR:=/var/lib/gitea} +: ${GITEA_CUSTOM:=${GITEA_WORK_DIR}/custom} + +command="/usr/bin/gitea web" +command_args="--config ${GITEA_CONF}" +command_background="true" +command_user="${GITEA_USER}:${GITEA_GROUP}" +error_log="/var/log/${RC_SVCNAME}/${RC_SVCNAME}.err" +pidfile="/run/${RC_SVCNAME}.pid" +required_files="${GITEA_CONF}" +start_stop_daemon_args="-d ${GITEA_WORK_DIR}" +start_stop_daemon_args="${start_stop_daemon_args} -e GITEA_WORK_DIR=${GITEA_WORK_DIR}" +start_stop_daemon_args="${start_stop_daemon_args} -e GITEA_CUSTOM=${GITEA_CUSTOM}" diff --git a/www-apps/gitea/files/gitea.service-r2 b/www-apps/gitea/files/gitea.service-r2 new file mode 100644 index 0000000..1931b46 --- /dev/null +++ b/www-apps/gitea/files/gitea.service-r2 @@ -0,0 +1,34 @@ +[Unit] +Description=Gitea service +Documentation=https://docs.gitea.io/ + +AssertPathIsDirectory=/var/lib/gitea +AssertPathIsReadWrite=/var/lib/gitea + +After=network.target +Requires=network.target +After=mysqld.service +After=postgresql-9.3.service +After=postgresql-9.4.service +After=postgresql-9.5.service +After=postgresql-9.6.service +After=postgresql-10.service +After=postgresql-11.service +After=postgresql-12.service +After=memcached.service +After=redis.service + +[Service] +User=git +Group=git + +Environment="GITEA_WORK_DIR=/var/lib/gitea" "GITEA_CUSTOM=/var/lib/gitea/custom" +WorkingDirectory=/var/lib/gitea +ExecStart=/usr/bin/gitea web --config /etc/gitea/app.ini + +Restart=always +PrivateTmp=true +Nice=5 + +[Install] +WantedBy=multi-user.target diff --git a/www-apps/gitea/gitea-1.9.4.ebuild b/www-apps/gitea/gitea-1.9.4.ebuild new file mode 100644 index 0000000..c8bcd29 --- /dev/null +++ b/www-apps/gitea/gitea-1.9.4.ebuild @@ -0,0 +1,116 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit golang-vcs-snapshot tmpfiles systemd + +EGO_PN="code.gitea.io/gitea" + +DESCRIPTION="A painless self-hosted Git service" +HOMEPAGE="https://gitea.io" +SRC_URI="https://github.com/go-gitea/gitea/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT Apache-2.0 BSD MPL-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64" +IUSE="+acct pam sqlite" + +COMMON_DEPEND=" + acct? ( + acct-group/git + acct-user/git[gitea] + ) + pam? ( sys-libs/pam )" +DEPEND="${COMMON_DEPEND} + dev-go/go-bindata" +RDEPEND="${COMMON_DEPEND} + dev-vcs/git + acct? ( + !dev-vcs/gitolite + !dev-vcs/gitolite-gentoo + ) + " + +DOCS=( custom/conf/app.ini.sample CONTRIBUTING.md README.md ) +S="${WORKDIR}/${P}/src/${EGO_PN}" + +PATCHES=( "${FILESDIR}/gitea-mod-vendor.patch" "${FILESDIR}/gitea-logflags.patch" ) + +gitea_make() { + local my_tags=( + bindata + $(usev pam) + $(usex sqlite 'sqlite sqlite_unlock_notify' '') + ) + local my_makeopt=( + DRONE_TAG=${PV} + TAGS="${my_tags[@]}" + LDFLAGS="-extldflags \"${LDFLAGS}\"" + ) + GOPATH=${WORKDIR}/${P}:$(get_golibdir_gopath) emake "${my_makeopt[@]}" "$@" +} + +src_prepare() { + default + + local sedcmds=( + -e "s#^RUN_MODE = dev#RUN_MODE = prod#" + -e "s#^ROOT =#ROOT = ${EPREFIX}/var/lib/gitea/gitea-repositories#" + -e "s#^ROOT_PATH =#ROOT_PATH = ${EPREFIX}/var/log/gitea#" + -e "s#^APP_DATA_PATH = data#APP_DATA_PATH = ${EPREFIX}/var/lib/gitea/data#" + -e "s#^HTTP_ADDR = 0.0.0.0#HTTP_ADDR = 127.0.0.1#" + -e "s#^MODE = console#MODE = file#" + -e "s#^LEVEL = Trace#LEVEL = Info#" + -e "s#^LOG_SQL = true#LOG_SQL = false#" + -e "s#^DISABLE_ROUTER_LOG = false#DISABLE_ROUTER_LOG = true#" + -e "s#^APP_ID =#;APP_ID =#" + -e "s#^TRUSTED_FACETS =#;TRUSTED_FACETS =#" + ) + + sed -i "${sedcmds[@]}" custom/conf/app.ini.sample || die + if use sqlite ; then + sed -i -e "s#^DB_TYPE = .*#DB_TYPE = sqlite3#" custom/conf/app.ini.sample || die + fi + + gitea_make generate +} + +src_compile() { + gitea_make build +} + +src_install() { + dobin gitea + + einstalldocs + + newconfd "${FILESDIR}/gitea.confd-r1" gitea + newinitd "${FILESDIR}/gitea.initd-r3" gitea + newtmpfiles - gitea.conf <<-EOF + d /run/gitea 0755 git git + EOF + systemd_newunit "${FILESDIR}"/gitea.service-r2 gitea.service + + insinto /etc/gitea + newins custom/conf/app.ini.sample app.ini + if use acct ; then + fowners root:git /etc/gitea/{,app.ini} + fperms g+w,o-rwx /etc/gitea/{,app.ini} + + diropts -m0750 -o git -g git + keepdir /var/lib/gitea /var/lib/gitea/custom /var/lib/gitea/data + keepdir /var/log/gitea + fi +} + +pkg_postinst() { + if [[ -e "${EROOT}/var/lib/gitea/conf/app.ini" ]]; then + ewarn "The configuration path has been changed to ${EROOT}/etc/gitea/app.ini." + ewarn "Please move your configuration from ${EROOT}/var/lib/gitea/conf/app.ini" + ewarn "and adapt the gitea-repositories hooks and ssh authorized_keys." + ewarn "Depending on your configuration you should run something like:" + ewarn "sed -i -e 's#${EROOT}/var/lib/gitea/conf/app.ini#${EROOT}/etc/gitea/app.ini#' \\" + ewarn " /var/lib/gitea/gitea-repositories/*/*/hooks/*/* \\" + ewarn " /var/lib/gitea/.ssh/authorized_keys" + fi +}