diff options
Diffstat (limited to 'www-apps/gitea')
-rw-r--r-- | www-apps/gitea/Manifest | 7 | ||||
-rw-r--r-- | www-apps/gitea/files/gitea-logflags.patch | 128 | ||||
-rw-r--r-- | www-apps/gitea/gitea-1.10.1.ebuild | 134 | ||||
-rw-r--r-- | www-apps/gitea/gitea-1.8.3.ebuild | 104 | ||||
-rw-r--r-- | www-apps/gitea/gitea-9999.ebuild | 132 |
5 files changed, 397 insertions, 108 deletions
diff --git a/www-apps/gitea/Manifest b/www-apps/gitea/Manifest index d31f55272081..794e74798015 100644 --- a/www-apps/gitea/Manifest +++ b/www-apps/gitea/Manifest @@ -1,11 +1,12 @@ AUX app.ini 67 BLAKE2B 4ec7b8217486047b419202b3a8a7172ac21ae0e5ad9224cd4f010be730ac5cda9d05bf06dcba2d06f8809900094b3b007ef98dd4ea20a125fb7d3db279f53e4a SHA512 93f6f7cf49dd1ece56f7da711adbb58cc38a503527aeea140837d74456ee6f550a089e897d9cb94382e1eb3f5a5cbe4a61362534463eada08a91f314da0f2108 -AUX gitea-logflags.patch 424 BLAKE2B af7c4d5b75a68d96eb3a4b352bd446ad25016093c9acedb1a035e2aa10baf3e451a89f685b9891d6941262523283946539c83e49b432ff7b6040b02a23c10c76 SHA512 df180aba171ef5f12228fa9c420f32a9f2da9125e4ec9517d068bed6c4bd64f4c196da1feb557c40764566fa6238d86c933ea505b8cbbd106102866d720149ca +AUX gitea-logflags.patch 4568 BLAKE2B 280697f7ca87c3c985aef0462f63f431860411ad7c39e462e5a63607ef076b116c27d2090f894095193dad33918f1fad1767489d45ae80f9699dddf65141ceb9 SHA512 aa09b233402ecb450cab13ed08786c1b8dc72a944efe69792bcf95d6109dd41b73abae95c3048bf339c8bb7849b3a20edb473388c052d32e00f7fb8b9381138d AUX gitea-mod-vendor.patch 1273 BLAKE2B 3067b17a972b92d0c402af4336ee41daa2f09d389a6e8bf218d33b103230bf8bb4b7003977447cc00293f8941f5002676398d4d755548e114e59cbb3840af8cc SHA512 12d8e0d2cb0998d31f8077f1498205bfee07e0df74926251f1ca38b9824c11246c07e413fc20beaed9ae49cac3d329468432f3fd2d5b25292c5bd656a88c7cc8 AUX gitea.confd-r1 243 BLAKE2B 87caa8371f53f52b0a85f720342f9f358dedec9240ab78998655a03df6bf3f301fe077afabdca1b1895dbcab2fa05748735d6f38f9b3ad53534fe8ae6e72db49 SHA512 485dc9d0b86d0a7b3ba958aac9de1129aa0ffbb47219419d38811f2accca2539e49dd93cc4a24b21f1c3802b024aa8449f54e320e8a16197f201532edeca6836 AUX gitea.initd-r3 802 BLAKE2B 2e33e95f7d2762986184d45b0bbb250cc5e04fffc4e4b006233b28e5b57be69eef1d83441adebe2b94681585edaf77f9da4eb97930f91e75c1b1a5cd8d137633 SHA512 5ff2e653180a0601734fcd055dfffdfdc12363736ed2e56c8576c802398b90f4025b44002cbb9a3fd1e0c2d4c169f62d460381c6c549746d3390e55fc1c677d1 AUX gitea.service-r2 734 BLAKE2B 84825b8198e9495e2803ca3702e6a631fb269c5c8fb4ff4246465a5bd7f7d796b0c3eaea72d0a25cef4f5d38d27a6c99a1b6d41f489749bef322a4ac93cfdd12 SHA512 287670f196bf6353dbdeb6ac37b4ac73693e16a6a3a83f57e7179ccb64364d1d85950a2ddd0a77238a3d218afdaacc8ba849c2810a7ba1238c7277074d1ebe39 -DIST gitea-1.8.3.tar.gz 24320679 BLAKE2B 9ef901ef7e1cb6ffa9a2aa082798b7a18ac2a6fdb4379082df3f942d767a27fd3915c7a4d2cb1af6f502a8cde3c1c98557c42d4c0ef60be7bdad78d8931035e0 SHA512 f6019fbfc056e4c7176222ccaca1cf638bd1f52323de54fcddc618129aeb778674f6e305de60e7d17b69505ad65439445ee6b5e368afdf0a6fbace7407acb495 +DIST gitea-1.10.1.tar.gz 30146802 BLAKE2B d566e58bc8031c6ff2741861c93deb1cc0bbe2236cfa8d1f054e1453d39b294ae55bd3bae46373efa39cd0b5bc9dfc248ecc0c64642eb4df68fb01042ef1c692 SHA512 d7baea6ac9aca3a3226d36325000c71c886d560eeecb2fdbed924b4924db34882cdd82d07120e3c7175a6d87140a1f63cc575c3be44513e08f8e557856b39acd DIST gitea-1.9.5.tar.gz 25355286 BLAKE2B 8b733651de64fcafa7b41a6fc812fcad8ac7311a7e7acc679ec7dab759175ec13a096902aece209a3fef31eefd3a99493e13f7c9792e1e41b5a1c3376680d3ca SHA512 f7a04d3bb37a33da15290355f3f02ff4c1b737e8458cf65f731c870ac9e452243b1fdacc5f74accf963fb00cdd200dd31191058eb1d6dda8b1033846a961c7d3 -EBUILD gitea-1.8.3.ebuild 3179 BLAKE2B 43582669d2e25936f7384f63834baa477ed276b21a0ec3564912ad8badd38cd916c847201855c4b78cf7961fdde9dad55278e1c3d684635b735525182d3a62fd SHA512 1c71d2564ee38ae631e98911cd548f0b72a9ab779a88d7609c48c2683ec19429ce909c224c1d4cea50798bb708eb8bfc4fbaa24cc5f0fb57a8999f2e69d60df9 +EBUILD gitea-1.10.1.ebuild 3427 BLAKE2B 8fbe625027b261ae19c50b1d51eae847530dbf2c9e973d95718083f7799fc71e16f7d7ce13b6b2f421d2dc47a1dfb171da434ea39f16df8ede6ae1ea086288c5 SHA512 548c4e072a0797ae6920050f6105d015bb6670d5f1fccce0fcf4c7561a12cfb4de5e1208826add8fdb13083532406c0c2ab7a11f6b181daae39588959e477356 EBUILD gitea-1.9.5.ebuild 3107 BLAKE2B 35944719b504c0a9acba5c7c73eef3af11bea31cea72a4910a1b0176ba77031a52b0c03514de849d564e93a78154cf973dfe4f4e9802819e3e8df72de0d41932 SHA512 2985dd8aa4ae893cb1f98becc612f2738d39bb166ac29e8b9bfbe3cdb354c858523780db299e4fe5936ea07d1689e32ab8775072d517d05688cfa60b10bc6781 +EBUILD gitea-9999.ebuild 3379 BLAKE2B 02f80718715f55e172ac372e3d15aea4112c7043ace30d8441bdc9822f8c617e1a3d0109ed640904b9baf8d80a085c390ec2d008aaca03cd14b6d62b1a72bddf SHA512 d3c7b02a3000c23ce3ed491e63737e3bdd59b5008019b7459927b042a926a72f2a4756714d8347d15cce6b5a26d0c91839166a54bd1440a00cd33f3061f80eb1 MISC metadata.xml 546 BLAKE2B 7b28ca7beb4fec57e6d4fc942b30afe505dc3b1f7c9034509bb9980d15429565220421d5edfcab76608386fb8cfbc086486beffcf53c814cfb0c09bf29e753ee SHA512 aaaca41cb5e43f8d382087760352e09e7fe0c18c6474399c4d6cd228ea0e2982b876f2f3d9c1c1bd11de1495679d3458bfb2a092c1f35df7ab8d5950bdfeadb2 diff --git a/www-apps/gitea/files/gitea-logflags.patch b/www-apps/gitea/files/gitea-logflags.patch index 331bd3d046b1..bbe6e5501c81 100644 --- a/www-apps/gitea/files/gitea-logflags.patch +++ b/www-apps/gitea/files/gitea-logflags.patch @@ -1,5 +1,8 @@ + +#Patch to make gitea logging less verbose. + diff --git a/modules/log/flags.go b/modules/log/flags.go -index 992fc62..5578a1b 100644 +index 992fc62dd..5578a1b6b 100644 --- a/modules/log/flags.go +++ b/modules/log/flags.go @@ -31,7 +31,7 @@ const ( @@ -11,3 +14,126 @@ index 992fc62..5578a1b 100644 ) var flagFromString = map[string]int{ + + +#Just patching the tests to keep working with the patch above (avoid using LstdFlags) + +diff --git a/modules/log/conn_test.go b/modules/log/conn_test.go +index cc3d758fa..295bee37f 100644 +--- a/modules/log/conn_test.go ++++ b/modules/log/conn_test.go +@@ -40,7 +40,7 @@ func TestConnLogger(t *testing.T) { + + prefix := "TestPrefix " + level := INFO +- flags := LstdFlags | LUTC | Lfuncname ++ flags := Ldate | Ltime | Lmedfile | Lshortfuncname | Llevelinitial | LUTC | Lfuncname + + logger := NewConn() + connLogger := logger.(*ConnLogger) +@@ -112,7 +112,7 @@ func TestConnLoggerCloseBeforeSend(t *testing.T) { + + prefix := "TestPrefix " + level := INFO +- flags := LstdFlags | LUTC | Lfuncname ++ flags := Ldate | Ltime | Lmedfile | Lshortfuncname | Llevelinitial | LUTC | Lfuncname + + logger := NewConn() + +@@ -126,7 +126,7 @@ func TestConnLoggerFailConnect(t *testing.T) { + + prefix := "TestPrefix " + level := INFO +- flags := LstdFlags | LUTC | Lfuncname ++ flags := Ldate | Ltime | Lmedfile | Lshortfuncname | Llevelinitial | LUTC | Lfuncname + + logger := NewConn() + +@@ -169,7 +169,7 @@ func TestConnLoggerClose(t *testing.T) { + + prefix := "TestPrefix " + level := INFO +- flags := LstdFlags | LUTC | Lfuncname ++ flags := Ldate | Ltime | Lmedfile | Lshortfuncname | Llevelinitial | LUTC | Lfuncname + + logger := NewConn() + connLogger := logger.(*ConnLogger) +diff --git a/modules/log/console_test.go b/modules/log/console_test.go +index a028b5b87..e4fec760a 100644 +--- a/modules/log/console_test.go ++++ b/modules/log/console_test.go +@@ -33,7 +33,7 @@ func TestConsoleLoggerMinimalConfig(t *testing.T) { + }, + } + prefix := "" +- flags := LstdFlags ++ flags := LstdFlags + + cw := NewConsoleLogger() + realCW := cw.(*ConsoleLogger) +@@ -64,7 +64,7 @@ func TestConsoleLogger(t *testing.T) { + } + prefix := "TestPrefix " + level := INFO +- flags := LstdFlags | LUTC | Lfuncname ++ flags := Ldate | Ltime | Lmedfile | Lshortfuncname | Llevelinitial | LUTC | Lfuncname + + cw := NewConsoleLogger() + realCW := cw.(*ConsoleLogger) +diff --git a/modules/log/file_test.go b/modules/log/file_test.go +index 38279315a..dc8d291ed 100644 +--- a/modules/log/file_test.go ++++ b/modules/log/file_test.go +@@ -24,7 +24,7 @@ func TestFileLoggerFails(t *testing.T) { + + prefix := "TestPrefix " + level := INFO +- flags := LstdFlags | LUTC | Lfuncname ++ flags := Ldate | Ltime | Lmedfile | Lshortfuncname | Llevelinitial | LUTC | Lfuncname + //filename := filepath.Join(tmpDir, "test.log") + + fileLogger := NewFileLogger() +@@ -52,7 +52,7 @@ func TestFileLogger(t *testing.T) { + + prefix := "TestPrefix " + level := INFO +- flags := LstdFlags | LUTC | Lfuncname ++ flags := Ldate | Ltime | Lmedfile | Lshortfuncname | Llevelinitial | LUTC | Lfuncname + filename := filepath.Join(tmpDir, "test.log") + + fileLogger := NewFileLogger() +@@ -155,7 +155,7 @@ func TestCompressFileLogger(t *testing.T) { + + prefix := "TestPrefix " + level := INFO +- flags := LstdFlags | LUTC | Lfuncname ++ flags := Ldate | Ltime | Lmedfile | Lshortfuncname | Llevelinitial | LUTC | Lfuncname + filename := filepath.Join(tmpDir, "test.log") + + fileLogger := NewFileLogger() +diff --git a/modules/log/smtp_test.go b/modules/log/smtp_test.go +index 216d55521..15075dd41 100644 +--- a/modules/log/smtp_test.go ++++ b/modules/log/smtp_test.go +@@ -17,7 +17,7 @@ import ( + func TestSMTPLogger(t *testing.T) { + prefix := "TestPrefix " + level := INFO +- flags := LstdFlags | LUTC | Lfuncname ++ flags := Ldate | Ltime | Lmedfile | Lshortfuncname | Llevelinitial | LUTC | Lfuncname + username := "testuser" + password := "testpassword" + host := "testhost" +diff --git a/modules/log/writer_test.go b/modules/log/writer_test.go +index 886dd58fb..df2f6e698 100644 +--- a/modules/log/writer_test.go ++++ b/modules/log/writer_test.go +@@ -41,7 +41,7 @@ func TestBaseLogger(t *testing.T) { + b := WriterLogger{ + out: c, + Level: INFO, +- Flags: LstdFlags | LUTC, ++ Flags: Ldate | Ltime | Lmedfile | Lshortfuncname | Llevelinitial | LUTC, + Prefix: prefix, + } + location, _ := time.LoadLocation("EST") diff --git a/www-apps/gitea/gitea-1.10.1.ebuild b/www-apps/gitea/gitea-1.10.1.ebuild new file mode 100644 index 000000000000..ebc72d5057b0 --- /dev/null +++ b/www-apps/gitea/gitea-1.10.1.ebuild @@ -0,0 +1,134 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +if [[ ${PV} != 9999* ]] ; then + SCM="golang-vcs-snapshot" +else + SCM="git-r3" +fi + +inherit golang-base tmpfiles systemd ${SCM} +unset SCM + +EGO_PN="code.gitea.io/gitea" + +DESCRIPTION="A painless self-hosted Git service" +HOMEPAGE="https://gitea.io" + +if [[ ${PV} != 9999* ]] ; then + SRC_URI="https://github.com/go-gitea/gitea/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~arm ~arm64" +else + EGIT_REPO_URI="https://github.com/go-gitea/gitea" + EGIT_CHECKOUT_DIR="${WORKDIR}/${P}/src/${EGO_PN}" + has test ${FEATURES} && EGIT_MIN_CLONE_TYPE="mirror" +fi + +LICENSE="Apache-2.0 BSD BSD-2 ISC MIT MPL-2.0" +SLOT="0" +IUSE="+acct pam sqlite" + +BDEPEND="dev-lang/go" +DEPEND="pam? ( sys-libs/pam )" +RDEPEND="${DEPEND} + acct? ( + acct-group/git + acct-user/git[gitea] + ) + dev-vcs/git" + +DOCS=( custom/conf/app.ini.sample CONTRIBUTING.md README.md ) +S="${WORKDIR}/${P}/src/${EGO_PN}" + +PATCHES=( "${FILESDIR}/gitea-logflags.patch" ) + +gitea_make() { + local gitea_tags=( + bindata + $(usev pam) + $(usex sqlite 'sqlite sqlite_unlock_notify' '') + ) + local gitea_settings=( + "-X code.gitea.io/gitea/modules/setting.CustomConf=${EPREFIX}/etc/gitea/app.ini" + "-X code.gitea.io/gitea/modules/setting.CustomPath=${EPREFIX}/var/lib/gitea/custom" + "-X code.gitea.io/gitea/modules/setting.AppWorkPath=${EPREFIX}/var/lib/gitea" + ) + local makeenv=( + TAGS="${gitea_tags[@]}" + LDFLAGS="-extldflags \"${LDFLAGS}\" ${gitea_settings[@]}" + GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" + ) + [[ ${PV} != 9999* ]] && makeenv+=("DRONE_TAG=${PV}") + + env "${makeenv[@]}" emake "$@" +} + +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_test() { + if has network-sandbox ${FEATURES}; then + einfo "Remove tests which are known to fail with network-sandbox enabled." + rm ./modules/migrations/github_test.go || die + fi + + if [[ ${PV} != 9999* ]] ; then + einfo "Remove tests which depend on gitea git-repo." + rm ./modules/git/blob_test.go || die + rm ./modules/git/repo_test.go || die + fi + + default +} + +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 +} diff --git a/www-apps/gitea/gitea-1.8.3.ebuild b/www-apps/gitea/gitea-1.8.3.ebuild deleted file mode 100644 index bdefa9b63520..000000000000 --- a/www-apps/gitea/gitea-1.8.3.ebuild +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright 1999-2019 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 -inherit golang-vcs-snapshot systemd user - -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" -SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64" -IUSE="pam sqlite" - -COMMON_DEPEND="pam? ( sys-libs/pam )" -DEPEND="${COMMON_DEPEND} - dev-go/go-bindata" -RDEPEND="${COMMON_DEPEND} - dev-vcs/git" - -DOCS=( custom/conf/app.ini.sample CONTRIBUTING.md README.md ) -S="${WORKDIR}/${P}/src/${EGO_PN}" - -pkg_setup() { - enewgroup git - enewuser git -1 /bin/bash /var/lib/gitea git -} - -gitea_make() { - local my_tags=( - bindata - $(usev pam) - $(usex sqlite 'sqlite sqlite_unlock_notify' '') - ) - local my_makeopt=( - DRONE_TAG=${PV} - TAGS="${my_tags[@]}" - ) - GOPATH=${WORKDIR}/${P}:$(get_golibdir_gopath) emake "${my_makeopt[@]}" "$@" -} - -src_prepare() { - default - sed -i \ - -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 =#" \ - 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_test() { - gitea_make test -} - -src_install() { - dobin gitea - - einstalldocs - - newconfd "${FILESDIR}"/gitea.confd-r1 gitea - newinitd "${FILESDIR}"/gitea.initd-r3 gitea - systemd_newunit "${FILESDIR}"/gitea.service-r2 gitea.service - - insinto /etc/gitea - newins custom/conf/app.ini.sample app.ini - 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 -} - -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 -} diff --git a/www-apps/gitea/gitea-9999.ebuild b/www-apps/gitea/gitea-9999.ebuild new file mode 100644 index 000000000000..9e8bcf9c6054 --- /dev/null +++ b/www-apps/gitea/gitea-9999.ebuild @@ -0,0 +1,132 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +if [[ ${PV} != 9999* ]] ; then + SCM="golang-vcs-snapshot" +else + SCM="git-r3" +fi + +inherit golang-base tmpfiles systemd ${SCM} +unset SCM + +EGO_PN="code.gitea.io/gitea" + +DESCRIPTION="A painless self-hosted Git service" +HOMEPAGE="https://gitea.io" + +if [[ ${PV} != 9999* ]] ; then + SRC_URI="https://github.com/go-gitea/gitea/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~arm ~arm64" +else + EGIT_REPO_URI="https://github.com/go-gitea/gitea" + EGIT_CHECKOUT_DIR="${WORKDIR}/${P}/src/${EGO_PN}" + has test ${FEATURES} && EGIT_MIN_CLONE_TYPE="mirror" +fi + +LICENSE="Apache-2.0 BSD BSD-2 ISC MIT MPL-2.0" +SLOT="0" +IUSE="+acct pam sqlite" + +BDEPEND="dev-lang/go" +DEPEND="pam? ( sys-libs/pam )" +RDEPEND="${DEPEND} + acct? ( + acct-group/git + acct-user/git[gitea] + ) + dev-vcs/git" + +DOCS=( custom/conf/app.ini.sample CONTRIBUTING.md README.md ) +S="${WORKDIR}/${P}/src/${EGO_PN}" + +gitea_make() { + local gitea_tags=( + bindata + $(usev pam) + $(usex sqlite 'sqlite sqlite_unlock_notify' '') + ) + local gitea_settings=( + "-X code.gitea.io/gitea/modules/setting.CustomConf=${EPREFIX}/etc/gitea/app.ini" + "-X code.gitea.io/gitea/modules/setting.CustomPath=${EPREFIX}/var/lib/gitea/custom" + "-X code.gitea.io/gitea/modules/setting.AppWorkPath=${EPREFIX}/var/lib/gitea" + ) + local makeenv=( + TAGS="${gitea_tags[@]}" + LDFLAGS="-extldflags \"${LDFLAGS}\" ${gitea_settings[@]}" + GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" + ) + [[ ${PV} != 9999* ]] && makeenv+=("DRONE_TAG=${PV}") + + env "${makeenv[@]}" emake "$@" +} + +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_test() { + if has network-sandbox ${FEATURES}; then + einfo "Remove tests which are known to fail with network-sandbox enabled." + rm ./modules/migrations/github_test.go || die + fi + + if [[ ${PV} != 9999* ]] ; then + einfo "Remove tests which depend on gitea git-repo." + rm ./modules/git/blob_test.go || die + rm ./modules/git/repo_test.go || die + fi + + default +} + +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 +} |