add gitea

This commit is contained in:
Daniel 2022-08-01 21:11:09 -04:00
parent f4362f04c5
commit fc86b25587
11 changed files with 419 additions and 0 deletions

75
www/gitea/Makefile Normal file
View file

@ -0,0 +1,75 @@
PORTNAME= gitea
DISTVERSIONPREFIX= v
DISTVERSION= 1.17.0
CATEGORIES= www
MASTER_SITES= https://github.com/go-gitea/gitea/releases/download/${DISTVERSIONPREFIX}${DISTVERSION}/
DISTNAME= gitea-src-${DISTVERSION}
EXTRACT_AFTER_ARGS= --strip-components 1 # since 1.17.0, archive includes gitea-src-VERSION directory
MAINTAINER= stb@lassitu.de
COMMENT= Compact self-hosted Git service
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
RUN_DEPENDS= git:devel/git
USES= cpe gmake go:no_targets
USE_RC_SUBR= gitea
SUB_FILES+= app.ini.sample
SUB_LIST+= GITUSER=${USERS}
NO_WRKSUBDIR= yes
USERS= git
GROUPS= git
PORTDATA= *
OPTIONS_DEFINE= BINDATA GIT_LFS PAM SQLITE
OPTIONS_DEFAULT= GIT_LFS PAM SQLITE
OPTIONS_SUB= yes
BINDATA_DESC= Build a single monolithic binary, with all assets included
GIT_LFS_DESC= Support for Git Large File Storage (LFS)
PAM_DESC= Enable support for PAM
BINDATA_VARS= GO_TAGS+=bindata
GIT_LFS_RUN_DEPENDS= git-lfs:devel/git-lfs
PAM_VARS= GO_TAGS+=pam
SQLITE_VARS= GO_TAGS+="sqlite sqlite_unlock_notify"
.include <bsd.port.options.mk>
.if ${OPSYS} == FreeBSD
DAEMONARGS= -S -l \$${gitea_facility} -s \$${gitea_priority} -T \$${name}
.else
DAEMONARGS= -f
.endif
SUB_LIST+= DAEMONARGS="${DAEMONARGS}"
SSP_UNSAFE= true
# Default LDFLAGS are incompatible with build
MAKE_ENV= LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}"
MAKE_ARGS= GOPATH=${WRKDIR} TAGS="${GO_TAGS}"
ALL_TARGET= backend
MAKE_JOBS_UNSAFE= yes
post-patch:
${ECHO_CMD} ${DISTVERSION} >${WRKSRC}/VERSION
# Too lazy to figure out why go install won't work.
do-install:
# Go binary is statically linked and cannot be stripped, so use
# INSTALL_SCRIPT.
${INSTALL_SCRIPT} ${WRKSRC}/gitea ${STAGEDIR}${PREFIX}/sbin
@${MKDIR} ${STAGEDIR}${ETCDIR}/conf
${INSTALL_DATA} ${WRKDIR}/app.ini.sample ${STAGEDIR}${ETCDIR}/conf/app.ini.sample
${INSTALL_DATA} ${WRKSRC}/custom/conf/app.example.ini ${STAGEDIR}${ETCDIR}/conf/app.ini.defaults
do-install-BINDATA-off:
cd ${WRKSRC} && ${COPYTREE_SHARE} "options public templates" ${STAGEDIR}${DATADIR}
.include <bsd.port.mk>

75
www/gitea/Makefile.orig Normal file
View file

@ -0,0 +1,75 @@
PORTNAME= gitea
DISTVERSIONPREFIX= v
DISTVERSION= 1.16.8
PORTREVISION= 2
CATEGORIES= www
MASTER_SITES= https://github.com/go-gitea/gitea/releases/download/${DISTVERSIONPREFIX}${DISTVERSION}/
DISTNAME= gitea-src-${DISTVERSION}
MAINTAINER= stb@lassitu.de
COMMENT= Compact self-hosted Git service
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
RUN_DEPENDS= git:devel/git
USES= cpe gmake go:no_targets
USE_RC_SUBR= gitea
SUB_FILES+= app.ini.sample
SUB_LIST+= GITUSER=${USERS}
NO_WRKSUBDIR= yes
USERS= git
GROUPS= git
PORTDATA= *
OPTIONS_DEFINE= BINDATA GIT_LFS PAM SQLITE
OPTIONS_DEFAULT= GIT_LFS PAM SQLITE
OPTIONS_SUB= yes
BINDATA_DESC= Build a single monolithic binary, with all assets included
GIT_LFS_DESC= Support for Git Large File Storage (LFS)
PAM_DESC= Enable support for PAM
BINDATA_VARS= GO_TAGS+=bindata
GIT_LFS_RUN_DEPENDS= git-lfs:devel/git-lfs
PAM_VARS= GO_TAGS+=pam
SQLITE_VARS= GO_TAGS+="sqlite sqlite_unlock_notify"
.include <bsd.port.options.mk>
.if ${OPSYS} == FreeBSD
DAEMONARGS= -S -l \$${gitea_facility} -s \$${gitea_priority} -T \$${name}
.else
DAEMONARGS= -f
.endif
SUB_LIST+= DAEMONARGS="${DAEMONARGS}"
SSP_UNSAFE= true
# Default LDFLAGS are incompatible with build
MAKE_ENV= LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}"
MAKE_ARGS= GOPATH=${WRKDIR} TAGS="${GO_TAGS}"
ALL_TARGET= backend
MAKE_JOBS_UNSAFE= yes
post-patch:
${ECHO_CMD} ${DISTVERSION} >${WRKSRC}/VERSION
# Too lazy to figure out why go install won't work.
do-install:
# Go binary is statically linked and cannot be stripped, so use
# INSTALL_SCRIPT.
${INSTALL_SCRIPT} ${WRKSRC}/gitea ${STAGEDIR}${PREFIX}/sbin
@${MKDIR} ${STAGEDIR}${ETCDIR}/conf
${INSTALL_DATA} ${WRKDIR}/app.ini.sample ${STAGEDIR}${ETCDIR}/conf/app.ini.sample
${INSTALL_DATA} ${WRKSRC}/custom/conf/app.example.ini ${STAGEDIR}${ETCDIR}/conf/app.ini.defaults
do-install-BINDATA-off:
cd ${WRKSRC} && ${COPYTREE_SHARE} "options public templates" ${STAGEDIR}${DATADIR}
.include <bsd.port.mk>

13
www/gitea/Makefile.rej Normal file
View file

@ -0,0 +1,13 @@
@@ -1,10 +1,10 @@
PORTNAME= gitea
DISTVERSIONPREFIX= v
-DISTVERSION= 1.16.8
-PORTREVISION= 2
+DISTVERSION= 1.17.0
CATEGORIES= www
MASTER_SITES= https://github.com/go-gitea/gitea/releases/download/${DISTVERSIONPREFIX}${DISTVERSION}/
DISTNAME= gitea-src-${DISTVERSION}
+EXTRACT_AFTER_ARGS= --strip-components 1 # since 1.17.0, archive includes gitea-src-VERSION directory
MAINTAINER= stb@lassitu.de
COMMENT= Compact self-hosted Git service

View file

@ -0,0 +1,67 @@
diff --git a/security/vuxml/vuln-2022.xml b/security/vuxml/vuln-2022.xml
index c7e15af99..95eac5d3e 100644
--- a/security/vuxml/vuln-2022.xml
+++ b/security/vuxml/vuln-2022.xml
@@ -1,3 +1,34 @@
+ <vuln vid="8bec3994-104d-11ed-a7ac-0800273f11ea">
+ <topic>gitea -- multiple issues</topic>
+ <affects>
+ <package>
+ <name>gitea</name>
+ <range><lt>1.17.0</lt></range>
+ </package>
+ </affects>
+ <description>
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <p>The Gitea team reports:</p>
+ <blockquote cite="https://github.com/go-gitea/gitea/pull/20114">
+ <p>Use git.HOME_PATH for Git HOME directory</p>
+ </blockquote>
+ <blockquote cite="https://github.com/go-gitea/gitea/pull/20332">
+ <p>Add write check for creating Commit status</p>
+ </blockquote>
+ <blockquote cite="https://github.com/go-gitea/gitea/pull/18697">
+ <p>Remove deprecated SSH ciphers from default</p>
+ </blockquote>
+ </body>
+ </description>
+ <references>
+ <url>https://github.com/go-gitea/gitea/releases/tag/v1.16.9</url>
+ </references>
+ <dates>
+ <discovery>2022-07-12</discovery>
+ <entry>2022-07-30</entry>
+ </dates>
+ </vuln>
+
<vuln vid="4c26f668-0fd2-11ed-a83d-001b217b3468">
<topic>Gitlab -- multiple vulnerabilities</topic>
<affects>
diff --git a/www/gitea/Makefile b/www/gitea/Makefile
index f14bf2435..a97b896e5 100644
--- a/www/gitea/Makefile
+++ b/www/gitea/Makefile
@@ -1,10 +1,10 @@
PORTNAME= gitea
DISTVERSIONPREFIX= v
-DISTVERSION= 1.16.8
-PORTREVISION= 2
+DISTVERSION= 1.17.0
CATEGORIES= www
MASTER_SITES= https://github.com/go-gitea/gitea/releases/download/${DISTVERSIONPREFIX}${DISTVERSION}/
DISTNAME= gitea-src-${DISTVERSION}
+EXTRACT_AFTER_ARGS= --strip-components 1 # since 1.17.0, archive includes gitea-src-VERSION directory
MAINTAINER= stb@lassitu.de
COMMENT= Compact self-hosted Git service
diff --git a/www/gitea/distinfo b/www/gitea/distinfo
index 384d09b62..3880cbee1 100644
--- a/www/gitea/distinfo
+++ b/www/gitea/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1652939095
-SHA256 (gitea-src-1.16.8.tar.gz) = 5bf01b45f9c441f9d38d727cc1328414e4e5778ac5b01bc98979d82bc520a23d
-SIZE (gitea-src-1.16.8.tar.gz) = 53659731
+TIMESTAMP = 1659214174
+SHA256 (gitea-src-1.17.0.tar.gz) = a016c0836c50e7c74b0428e170a32851fdf6724a057e71501cbdf3de900a5b56
+SIZE (gitea-src-1.17.0.tar.gz) = 52642977

3
www/gitea/distinfo Normal file
View file

@ -0,0 +1,3 @@
TIMESTAMP = 1659214174
SHA256 (gitea-src-1.17.0.tar.gz) = a016c0836c50e7c74b0428e170a32851fdf6724a057e71501cbdf3de900a5b56
SIZE (gitea-src-1.17.0.tar.gz) = 52642977

3
www/gitea/distinfo.orig Normal file
View file

@ -0,0 +1,3 @@
TIMESTAMP = 1652939095
SHA256 (gitea-src-1.16.8.tar.gz) = 5bf01b45f9c441f9d38d727cc1328414e4e5778ac5b01bc98979d82bc520a23d
SIZE (gitea-src-1.16.8.tar.gz) = 53659731

View file

@ -0,0 +1,93 @@
#
# Sample Configuration for Gitea using SQLite
#
# For information on the available settings, consult the online
# documentation, or see the accompanying file app.ini.defaults, which
# contains the settings incorporated into the gitea binary.
#
# This sample configuration runs Gitea with a local database. Before
# running this configuration, make sure to change the INTERNAL_TOKEN,
# JWT_SECRET, and SECRET_KEY variables. SECRET_KEY is a password of your
# choosing, INTERNAL_TOKEN is a 64-byte random number in BASE64 encoding,
# JWT_SECRET is a 32-byte random number in BASE64 encoding.
#
# You can generate the token using for example:
# openssl rand -base64 64
#
# You can let Gitea add these to the config for you; you need to make
# app.ini writeable by the git user.
#
# There are no pre-configured users; the first user to register becomes an
# admin. In this sample configuration, the HTTP server only listens on
# localhost.
#
# If you'd rather use the web-based installer, remove this conf/app.ini file
# and make %%PREFIX%%/etc/gitea/conf writeable to the git user.
APP_NAME = Gitea: Git with a cup of tea
RUN_USER = %%GITUSER%%
RUN_MODE = prod
[database]
DB_TYPE = sqlite3
HOST = 127.0.0.1:3306
NAME = gitea
PASSWD =
PATH = /var/db/gitea/gitea.db
SSL_MODE = disable
USER = root
[indexer]
ISSUE_INDEXER_PATH = /var/db/gitea/indexers/issues.bleve
[log]
ROOT_PATH = /var/log/gitea
MODE = file
LEVEL = Info
[mailer]
ENABLED = false
[oauth2]
JWT_SECRET = D56bmu6xCtEKs9vKKgMKnsa4X9FDwo64HVyaS4fQ4mY
[picture]
AVATAR_UPLOAD_PATH = /var/db/gitea/data/avatars
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = false
[repository]
ROOT = /var/db/gitea/gitea-repositories
# Gitea's default is 'bash', so if you have bash installed, you can comment
# this out.
SCRIPT_TYPE = sh
[repository.upload]
TEMP_PATH = /var/db/gitea/data/tmp/uploads
[security]
INSTALL_LOCK = true
INTERNAL_TOKEN = 1FFhAklka01JhgJTRUrFujWYiv4ijqcTIfXJ9o4n1fWxz+XVQdXhrqDTlsnD7fvz7gugdhgkx0FY2Lx6IBdPQw==
SECRET_KEY = ChangeMeBeforeRunning
[session]
PROVIDER = file
PROVIDER_CONFIG = /var/db/gitea/data/sessions
[server]
DOMAIN = localhost
HTTP_ADDR = 127.0.0.1
HTTP_PORT = 3000
ROOT_URL = http://localhost:3000/
DISABLE_SSH = false
SSH_DOMAIN = %(DOMAIN)s
SSH_PORT = 22
OFFLINE_MODE = false
APP_DATA_PATH = /var/db/gitea/data
[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = false
ENABLE_CAPTCHA = true
REQUIRE_SIGNIN_VIEW = false

51
www/gitea/files/gitea.in Normal file
View file

@ -0,0 +1,51 @@
#!/bin/sh
# PROVIDE: gitea
# REQUIRE: NETWORKING SYSLOG
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable gitea:
#
#gitea_enable="YES"
. /etc/rc.subr
name="gitea"
rcvar="gitea_enable"
load_rc_config $name
: ${gitea_user:="%%GITUSER%%"}
: ${gitea_enable:="NO"}
: ${gitea_facility:="daemon"}
: ${gitea_priority:="debug"}
: ${gitea_shared:="%%PREFIX%%/share/${name}"}
: ${gitea_custom:="%%PREFIX%%/etc/${name}"}
command="%%PREFIX%%/sbin/${name} web"
procname="%%PREFIX%%/sbin/${name}"
githome="$(eval echo ~${gitea_user})"
pidfile="/var/run/${name}.pid"
start_cmd="${name}_start"
gitea_start() {
for d in /var/db/gitea /var/log/gitea; do
if [ ! -e "$d" ]; then
mkdir "$d"
chown ${gitea_user} "$d"
fi
done
/usr/sbin/daemon %%DAEMONARGS%% \
-u ${gitea_user} -p ${pidfile} \
/usr/bin/env -i \
"GITEA_WORK_DIR=${gitea_shared}" \
"GITEA_CUSTOM=${gitea_custom}" \
"HOME=${githome}" \
"PATH=%%PREFIX%%/bin:${PATH}" \
"USER=${gitea_user}" \
$command
}
run_rc_command "$1"

6
www/gitea/pkg-descr Normal file
View file

@ -0,0 +1,6 @@
A self-hosted Git service.
Gitea is a community managed fork of Gogs, lightweight code hosting solution
written in Go and published under the MIT license.
WWW: https://gitea.io/en-US/

30
www/gitea/pkg-message Normal file
View file

@ -0,0 +1,30 @@
[
{ type: upgrade
maximum_version: 1.7.6
message: <<EOM
When upgrading from Gitea 1.7 or earlier, Gitea requires the addition of
another secret to the config file in order to start up. Either manually add
JWT_SECRET to the ${PREFIX}/etc/gitea/conf/app.ini config file (see
app.ini.sample), or allow Gitea to make the change for you by making the
config file writable to the git user.
EOM
}
{ type: upgrade
maximum_version: 1.15.0
message: <<EOM
Some config file options have been changed in Gitea 1.15. Please refer to
the documentation at https://docs.gitea.io/en-us/customizing-gitea/ and
the release notes.
EOM
}
{ type: upgrade
maximum_version: 1.15.1
message: <<EOM
We remind users that a bug was discovered with gitea dump in 1.14.31.14.6
and 1.15.0. Database dumps from these versions cause broken fields in the
repo_unit and login_source tables causing the issue identified in #16961.
Users on 1.14.x must upgrade to 1.14.7 before running gitea dump. See the
release notes for more information.
EOM
}
]

3
www/gitea/pkg-plist Normal file
View file

@ -0,0 +1,3 @@
@sample %%ETCDIR%%/conf/app.ini.sample
%%ETCDIR%%/conf/app.ini.defaults
sbin/gitea