Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

www-apps/gitea: bump to 1.10.0 #13696

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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")
127 changes: 127 additions & 0 deletions www-apps/gitea/gitea-1.10.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# 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 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=(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make this huge list into a patch? Can some of these be upstreamed, I see some are Gentoo-specific?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the removal of the non-needed seds (APP_ID and TRUSTED_FACETS (since 1.8.0) i don't think there is much to upstream, the path stuff is gentoo specific (does EPREFIX expansion even work in a patch?) and so is the logging, HTTP_ADDR used to be localhost via LOCAL_ROOT_URL (i think?) and that was pre-1.0 so i don't think that's what upstream wants either. RUN_MODE will be set to prod when the webinstaller ran successfully so no reason to upstream that either

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(does EPREFIX expansion even work in a patch?)

There's a syntax for it that works in a patch, I don't remember it now. $(EPREFIX) or @EPREFIX@ I suppose.

-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
}
125 changes: 125 additions & 0 deletions www-apps/gitea/gitea-9999.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# 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 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
}