Skip to content

Commit

Permalink
www-apps/gitea: bump to 1.10 + add live ebuild
Browse files Browse the repository at this point in the history
Package-Manager: Portage-2.3.76, Repoman-2.3.18
Signed-off-by: Felix Neumärker <xdch47@posteo.de>
  • Loading branch information
xdch47 committed Nov 21, 2019
1 parent 9438abd commit c454af5
Show file tree
Hide file tree
Showing 4 changed files with 386 additions and 1 deletion.
1 change: 1 addition & 0 deletions www-apps/gitea/Manifest
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
DIST gitea-1.10.0.tar.gz 28905929 BLAKE2B ddf45483784ebf2d300d7f957e355f20c56e0e31825b3a290935ef9d8b7a2b0b154769b44eb270c9bb3165b8297cc1d8b51e9e660828eb95ab019b4857f8c37a SHA512 3bd99ee7289b6a0035d0a6da868562692fa9941a4f14d7555044c06efc7165615dc95547713e352d5cfcd7817596a9f4b24c5fa28c90066f4586ccb44a637d08
DIST gitea-1.8.3.tar.gz 24320679 BLAKE2B 9ef901ef7e1cb6ffa9a2aa082798b7a18ac2a6fdb4379082df3f942d767a27fd3915c7a4d2cb1af6f502a8cde3c1c98557c42d4c0ef60be7bdad78d8931035e0 SHA512 f6019fbfc056e4c7176222ccaca1cf638bd1f52323de54fcddc618129aeb778674f6e305de60e7d17b69505ad65439445ee6b5e368afdf0a6fbace7407acb495
DIST gitea-1.9.5.tar.gz 25355286 BLAKE2B 8b733651de64fcafa7b41a6fc812fcad8ac7311a7e7acc679ec7dab759175ec13a096902aece209a3fef31eefd3a99493e13f7c9792e1e41b5a1c3376680d3ca SHA512 f7a04d3bb37a33da15290355f3f02ff4c1b737e8458cf65f731c870ac9e452243b1fdacc5f74accf963fb00cdd200dd31191058eb1d6dda8b1033846a961c7d3
128 changes: 127 additions & 1 deletion www-apps/gitea/files/gitea-logflags.patch
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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")
129 changes: 129 additions & 0 deletions www-apps/gitea/gitea-1.10.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# 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"
COMMON_DEPEND="
acct? (
acct-group/git
acct-user/git[gitea]
)
pam? ( sys-libs/pam )"
DEPEND="${COMMON_DEPEND}"
RDEPEND="${COMMON_DEPEND}
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 my_tags=(
bindata
$(usev pam)
$(usex sqlite 'sqlite sqlite_unlock_notify' '')
)
local my_makeopt=(
TAGS="${my_tags[@]}"
LDFLAGS="-extldflags \"${LDFLAGS}\""
)
[[ ${PV} != 9999* ]] && my_makeopt+=("DRONE_TAG=${PV}")
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_test() {
if has network-sandbox ${FEATURES}; then
einfo "Remove tests which are known to fail with network-sandbox enabled."
rm -rf ./modules/migrations/github_test.go
fi

if [[ ${PV} != 9999* ]] ; then
einfo "Remove tests which depend on gitea git-repo."
rm -rf ./modules/git/blob_test.go
rm -rf ./modules/git/repo_test.go
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
}

0 comments on commit c454af5

Please sign in to comment.