Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2024 17:26:50 GMT
From:      Li-Wen Hsu <lwhsu@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: bfcf765a321b - main - www/forgejo: Update to 7.0.2
Message-ID:  <202405161726.44GHQoqY053674@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by lwhsu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=bfcf765a321bcf7ed02348a07b6cbcc32987c0b9

commit bfcf765a321bcf7ed02348a07b6cbcc32987c0b9
Author:     Stefan Bethke <stb@lassitu.de>
AuthorDate: 2024-05-16 16:23:54 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2024-05-16 17:26:36 +0000

    www/forgejo: Update to 7.0.2
    
    Also improve diagnostics prior to starting the service, add information
    to pkg-message, and enable running the forgejo binary on the command
    line more easily.
    
    Release notes:
      https://codeberg.org/forgejo/forgejo/src/branch/forgejo/RELEASE-NOTES.md#7-0-2
    
    PR:             278876
---
 www/forgejo/Makefile             | 16 ++++++++--------
 www/forgejo/distinfo             |  6 +++---
 www/forgejo/files/forgejo.in     | 16 +++++++++++++++-
 www/forgejo/files/pkg-message.in | 27 +++++++++++++++++++++++++++
 www/forgejo/pkg-message          | 13 -------------
 5 files changed, 53 insertions(+), 25 deletions(-)

diff --git a/www/forgejo/Makefile b/www/forgejo/Makefile
index 52027faa5c83..b9e69c542c3d 100644
--- a/www/forgejo/Makefile
+++ b/www/forgejo/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	forgejo
 DISTVERSIONPREFIX=	v
-DISTVERSION=	1.21.10-0
-PORTREVISION=	2
+DISTVERSION=	7.0.2
 CATEGORIES=	www
 MASTER_SITES=	https://codeberg.org/forgejo/forgejo/releases/download/${DISTVERSIONPREFIX}${DISTVERSION}/
 DISTNAME=	forgejo-src-${DISTVERSION}
@@ -15,12 +14,12 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 
 RUN_DEPENDS=	git:devel/git
 
-USES=			cpe gmake go:1.21,no_targets
+USES=			cpe gmake go:1.22,no_targets
 USE_RC_SUBR=	forgejo
 
 EXTRACT_AFTER_ARGS=	--strip-components 1
-SUB_FILES+=	app.ini.sample
-SUB_LIST+=	GITUSER=${USERS}
+SUB_FILES=	app.ini.sample pkg-message
+SUB_LIST=	GITUSER=${USERS}
 
 NO_WRKSUBDIR=	yes
 
@@ -54,10 +53,11 @@ DAEMONARGS=	-f
 SUB_LIST+=	DAEMONARGS="${DAEMONARGS}"
 
 SSP_UNSAFE=	true
-# Default LDFLAGS are incompatible with build
-MAKE_ENV=	LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}"
+LDFLAGS+=	"'-X "code.gitea.io/gitea/modules/setting.CustomPath=${PREFIX}/etc/forgejo"'"
+LDFLAGS+=	"'-X "code.gitea.io/gitea/modules/setting.AppWorkPath=${PREFIX}/share/forgejo"'"
 MAKE_ARGS=	GOPATH=${WRKDIR} \
-		TAGS="${GO_TAGS}"
+		TAGS="${GO_TAGS}" \
+		GOFLAGS="-buildvcs=false"
 ALL_TARGET=	backend
 MAKE_JOBS_UNSAFE=	yes
 
diff --git a/www/forgejo/distinfo b/www/forgejo/distinfo
index 35e0c2d393a7..74fb0a430f7e 100644
--- a/www/forgejo/distinfo
+++ b/www/forgejo/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1712360403
-SHA256 (forgejo-src-1.21.10-0.tar.gz) = 0cc21835404e40355cf7125b479efebb1fecf2cc17d018d4d54521d75943caf5
-SIZE (forgejo-src-1.21.10-0.tar.gz) = 58820868
+TIMESTAMP = 1715265831
+SHA256 (forgejo-src-7.0.2.tar.gz) = 39b2079be7671f2248dcc36377ae20be65f20695d7f968ae227c0fc55dacca06
+SIZE (forgejo-src-7.0.2.tar.gz) = 54862292
diff --git a/www/forgejo/files/forgejo.in b/www/forgejo/files/forgejo.in
index ad5aee48f95d..c635f3a9a9b1 100644
--- a/www/forgejo/files/forgejo.in
+++ b/www/forgejo/files/forgejo.in
@@ -17,8 +17,9 @@ load_rc_config $name
 
 : ${forgejo_user:="%%GITUSER%%"}
 : ${forgejo_enable:="NO"}
+: ${forgejo_configcheck_enable:="YES"}
 : ${forgejo_facility:="daemon"}
-: ${forgejo_priority:="debug"}
+: ${forgejo_priority:="info"}
 : ${forgejo_shared:="%%PREFIX%%/share/${name}"}
 : ${forgejo_custom:="%%PREFIX%%/etc/${name}"}
 
@@ -29,6 +30,7 @@ githome="$(eval echo ~${forgejo_user})"
 pidfile="/var/run/${name}.pid"
 
 start_cmd="${name}_start"
+start_precmd="${name}_prestart"
 
 forgejo_start() {
 	for d in /var/db/forgejo /var/log/forgejo; do
@@ -48,4 +50,16 @@ forgejo_start() {
 		$command
 }
 
+forgejo_prestart() {
+	if checkyesno forgejo_configcheck_enable; then
+		if su -m ${forgejo_user} -c "%%PREFIX%%/sbin/${name} doctor check >/dev/null"; then
+		else
+			echo "cannot start ${name} because of configuration errors. Run" >&2
+			echo "    su -m git -c '${name} doctor check'" >&2
+			echo "for further details"
+			return 1
+		fi
+	fi
+}
+
 run_rc_command "$1"
diff --git a/www/forgejo/files/pkg-message.in b/www/forgejo/files/pkg-message.in
new file mode 100644
index 000000000000..03164efe7264
--- /dev/null
+++ b/www/forgejo/files/pkg-message.in
@@ -0,0 +1,27 @@
+[
+{ type: install
+  message: <<EOM
+Before starting forgejo for the first time, you must set a number of
+secrets in the configuration file. For your convenience, a sample file
+has been copied to %%PREFIX%%/etc/forgejo/conf/app.ini.
+
+You need to replace every occurence of CHANGE_ME in the file with
+sensible values. Please refer to the official documentation at
+https://forgejo.org for details.
+
+You will also likely need to create directories for persistent storage.
+Run
+    su -m git -c 'forgejo doctor check'
+to check if all prerequisites have been met.
+EOM
+}
+{ type: upgrade
+  maximum_version: "1.21"
+  message: <<EOM
+Since forgejo version 7, the startup script will run forgejo doctor check
+to verify that forgejo can be started successfully. If you are sure that
+forgejo will start even if doctor has identified an issue, you can disable
+the check by setting forgejo_configcheck_enabled=NO in rc.conf.
+EOM
+}
+]
diff --git a/www/forgejo/pkg-message b/www/forgejo/pkg-message
deleted file mode 100644
index 5c8f0b5d39b4..000000000000
--- a/www/forgejo/pkg-message
+++ /dev/null
@@ -1,13 +0,0 @@
-[
-{ type: install
-  message: <<EOM
-Before starting forgejo you must create the main configuration file.
-
-    cp /usr/local/etc/forgejo/conf/app.ini.sample /usr/local/etc/forgejo/conf/app.ini
-    ${EDITOR} /usr/local/etc/forgejo/conf/app.ini
-
-You need to replace every occurence of CHANGE_ME in the file with sensitive
-values. Please refer to the official documentation for details.
-EOM
-}
-]



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405161726.44GHQoqY053674>