Skip to content

Commit

Permalink
www/forgejo: Update to 7.0.2
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stblassitude authored and lwhsu committed May 16, 2024
1 parent fa16f0c commit bfcf765
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 25 deletions.
16 changes: 8 additions & 8 deletions www/forgejo/Makefile
Original file line number Diff line number Diff line change
@@ -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}
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions www/forgejo/distinfo
Original file line number Diff line number Diff line change
@@ -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
16 changes: 15 additions & 1 deletion www/forgejo/files/forgejo.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}"}

Expand All @@ -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
Expand All @@ -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"
27 changes: 27 additions & 0 deletions www/forgejo/files/pkg-message.in
Original file line number Diff line number Diff line change
@@ -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
}
]
13 changes: 0 additions & 13 deletions www/forgejo/pkg-message

This file was deleted.

0 comments on commit bfcf765

Please sign in to comment.