git: 8bb719ffa3c9 - main - net/seaweedfs: update to 3.26, pet port

From: Dave Cottlehuber <dch_at_FreeBSD.org>
Date: Sun, 13 Nov 2022 12:02:41 UTC
The branch main has been updated by dch:

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

commit 8bb719ffa3c9e643c5048b046a1e0843195c8e49
Author:     Dave Cottlehuber <dch@FreeBSD.org>
AuthorDate: 2022-11-13 12:02:38 +0000
Commit:     Dave Cottlehuber <dch@FreeBSD.org>
CommitDate: 2022-11-13 12:02:38 +0000

    net/seaweedfs: update to 3.26, pet port
    
    PR:             259527
    Sponsored by:   SkunkWerks, GmbH
---
 net/seaweedfs/Makefile             |  29 ++++++++--
 net/seaweedfs/distinfo             |  10 ++--
 net/seaweedfs/files/pkg-message.in |  21 +++++++
 net/seaweedfs/files/seaweedfs.in   | 113 ++++++++++++++++++-------------------
 net/seaweedfs/pkg-plist            |   2 -
 5 files changed, 105 insertions(+), 70 deletions(-)

diff --git a/net/seaweedfs/Makefile b/net/seaweedfs/Makefile
index f19b166fe7a5..fd0c6284f444 100644
--- a/net/seaweedfs/Makefile
+++ b/net/seaweedfs/Makefile
@@ -33,19 +33,38 @@ SUB_LIST=	GROUP=${SEAWEEDFS_GROUP} \
 USERS=		${SEAWEEDFS_USER}
 GROUPS=		${SEAWEEDFS_GROUP}
 
+OPTIONS_DEFINE=		GOCDK
+OPTIONS_DEFAULT=	ELASTIC GOCDK SQLITE
+OPTIONS_GROUP=		FILERS
+OPTIONS_GROUP_FILERS=	ELASTIC SQLITE TIKV YDB
+
+ELASTIC_DESC=	Elasticsearch support
+FILERS_DESC=	Filer store engines
+GOCDK_DESC=	Go CDK PubSub API support
+TIKV_DESC=	TiKV database support
+YDB_DESC=	YDB support
+
+ELASTIC_VARS=	GO_TAGS+=elastic
+GOCDK_VARS=	GO_TAGS+=gocdk
+SQLITE_VARS=	GO_TAGS+=sqlite
+TIKV_VARS=	GO_TAGS+=tikv
+YDB_VARS=	GO_TAGS+=ydb
+
+.include <bsd.port.pre.mk>
+.if !empty (GO_TAGS)
+GO_BUILDFLAGS+=	-tags "${GO_TAGS}"
+.endif
+
 post-build:
 .for cfg in master filer security replication notification
 	${WRKDIR}/bin/weed scaffold -config ${cfg} -output ${WRKDIR}/
 .endfor
 
 post-install:
-	${MKDIR} \
-		${STAGEDIR}/var/db/${PORTNAME} \
-		${STAGEDIR}/var/log/${PORTNAME} \
-		${STAGEDIR}${ETCDIR}
+	${MKDIR} ${STAGEDIR}${ETCDIR}
 .for cfg in filer master notification replication security
 	${INSTALL_DATA} ${WRKDIR}/${cfg}.toml \
 	    ${STAGEDIR}${ETCDIR}/${cfg}.toml.sample
 .endfor
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/net/seaweedfs/distinfo b/net/seaweedfs/distinfo
index 18adbc339ea8..61e515117a65 100644
--- a/net/seaweedfs/distinfo
+++ b/net/seaweedfs/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1659960872
-SHA256 (go/net_seaweedfs/seaweedfs-seaweedfs-3.20_GH0/go.mod) = 29ab0345461593560ee5712730c89c63f63637b136aa2d63dbc57a3b351c9e4d
-SIZE (go/net_seaweedfs/seaweedfs-seaweedfs-3.20_GH0/go.mod) = 11375
-SHA256 (go/net_seaweedfs/seaweedfs-seaweedfs-3.20_GH0/seaweedfs-seaweedfs-3.20_GH0.tar.gz) = ed5f3eb0abe4216504192646bcda1ed7e5d21c1478f9b23ca26597b04044963e
-SIZE (go/net_seaweedfs/seaweedfs-seaweedfs-3.20_GH0/seaweedfs-seaweedfs-3.20_GH0.tar.gz) = 28872299
+TIMESTAMP = 1662714159
+SHA256 (go/net_seaweedfs/seaweedfs-seaweedfs-3.26_GH0/go.mod) = bda5d80fad3ccd26c08bdd1fee554be2501e09b087bc079bd54bea4dab01feea
+SIZE (go/net_seaweedfs/seaweedfs-seaweedfs-3.26_GH0/go.mod) = 11431
+SHA256 (go/net_seaweedfs/seaweedfs-seaweedfs-3.26_GH0/seaweedfs-seaweedfs-3.26_GH0.tar.gz) = a2798c587aa4193923e0ee9eae6c008b43f4b17dea3136f1c67e4acee45468c7
+SIZE (go/net_seaweedfs/seaweedfs-seaweedfs-3.26_GH0/seaweedfs-seaweedfs-3.26_GH0.tar.gz) = 28883805
diff --git a/net/seaweedfs/files/pkg-message.in b/net/seaweedfs/files/pkg-message.in
index a54e166d0a70..a6c2683314a9 100644
--- a/net/seaweedfs/files/pkg-message.in
+++ b/net/seaweedfs/files/pkg-message.in
@@ -19,6 +19,27 @@ Please read the documentation carefully, particularly around data
 replication, and running redundant masters. Prime numbers of servers are
 your friend, choose them wisely.
 
+EOM
+}
+{ type: upgrade
+  maximum_version: "3.26"
+  message: <<EOM
+When upgrading from before 3.26 these variables, if used, should be replaced:
+* seaweedfs_syslog_output_enable replaces seaweedfs_syslog_enable
+  (seaweedfs_syslog_enable, seaweedfs_syslog_output_priority
+  and seaweedfs_syslog_output_facility still work),
+* seaweedfs_syslog_output_priority replaces seaweedfs_syslog_priority
+  (seaweedfs_syslog_priority still works only when seaweedfs_syslog_enable
+  is set),
+* seaweedfs_syslog_output_facility replaces seaweedfs_syslog_facility
+  (seaweedfs_syslog_facility still works only when seaweedfs_syslog_enable
+  is set).
+
+Also default directory to store data files ("${seaweedfs_dir}/data"), if need,
+should be moved to "${seaweedfs_dir}" (ex, %%SEAWEEDFS_DIR%%/data
+to %%SEAWEEDFS_DIR%%).
+
+And weed executable has been moved from %%PREFIX%%/sbin to %%PREFIX%%/bin.
 EOM
 }
 ]
diff --git a/net/seaweedfs/files/seaweedfs.in b/net/seaweedfs/files/seaweedfs.in
index e2a179e06dd7..fb34a3690092 100644
--- a/net/seaweedfs/files/seaweedfs.in
+++ b/net/seaweedfs/files/seaweedfs.in
@@ -7,22 +7,24 @@
 # Add the following lines to /etc/rc.conf.local or /etc/rc.conf
 # to enable this service:
 #
-# seaweedfs_enable (bool):		Set it to YES to enable seaweedfs.
-#					Default is "NO".
-# seaweedfs_user (user):		Set user to run seaweedfs.
-#					Default is "seaweedfs".
-# seaweedfs_group (group):		Set group to run seaweedfs.
-#					Default is "seaweedfs".
-# seaweedfs_dir (directory):		Set directory to store database files.
-#					Default is "/var/db/seaweedfs".
-# seaweedfs_options (string):		Set default parameters.
-#					Default is "server -dir=/var/db/seaweedfs".
-# seaweedfs_syslog_enable (bool):	Set to enable syslog output.
-#					Default is "NO". See daemon(8).
-# seaweedfs_syslog_priority (str):	Set syslog priority if syslog enabled.
-#					Default is "info". See daemon(8).
-# seaweedfs_syslog_facility (str):	Set syslog facility if syslog enabled.
-#					Default is "daemon". See daemon(8).
+# seaweedfs_enable (bool):			Set it to YES to enable seaweedfs.
+#						Default is "NO".
+# seaweedfs_user (user):			Set user to run seaweedfs.
+#						Default is "seaweedfs".
+# seaweedfs_group (group):			Set group to run seaweedfs.
+#						Default is "seaweedfs".
+# seaweedfs_dir (directory):			Set directory to store database files.
+#						Default is "/var/db/seaweedfs".
+# seaweedfs_options (string):			Set default parameters.
+#						Default is "server -dir=/var/db/seaweedfs".
+# seaweedfs_syslog_output_enable (bool):	Set to enable syslog output.
+#						Default is "NO". See daemon(8).
+# seaweedfs_syslog_output_tag (str):		Set syslog tag if syslog enabled.
+#						Default: "seaweedfs".
+# seaweedfs_syslog_output_priority (str):	Set syslog priority if syslog enabled.
+#						Default is "notice". See daemon(8).
+# seaweedfs_syslog_output_facility (str):	Set syslog facility if syslog enabled.
+#						Default is "daemon". See daemon(8).
 
 . /etc/rc.subr
 
@@ -32,61 +34,56 @@ rcvar=seaweedfs_enable
 load_rc_config $name
 
 : ${seaweedfs_enable:="NO"}
-: ${seaweedfs_user:="seaweedfs"}
-: ${seaweedfs_group:="seaweedfs"}
-: ${seaweedfs_dir:="/var/db/seaweedfs"}
-: ${seaweedfs_options:="server -dir=${seaweedfs_dir}/data"}
+: ${seaweedfs_user:="%%USER%%"}
+: ${seaweedfs_group:="%%GROUP%%"}
+: ${seaweedfs_dir:="%%SEAWEEDFS_DIR%%"}
+: ${seaweedfs_options:="server -dir=${seaweedfs_dir}"}
+: ${seaweedfs_pidfile:=/var/run/seaweedfs.pid}
+: ${seaweedfs_syslog_output_enable:="NO"}
 
-DAEMON=$(/usr/sbin/daemon 2>&1 | grep -q syslog ; echo $?)
-if [ ${DAEMON} -eq 0 ]; then
-        : ${seaweedfs_syslog_enable:="NO"}
-        : ${seaweedfs_syslog_priority:="info"}
-        : ${seaweedfs_syslog_facility:="daemon"}
-        if checkyesno seaweedfs_syslog_enable; then
-                seaweedfs_syslog_flags="-T ${name}"
+# backwards compatibility
+if [ -d "${seaweedfs_dir}/data" -a \( "${seaweedfs_options}" = "server -dir=${seaweedfs_dir}" \) ]; then
+	seaweedfs_dir="${seaweedfs_dir}/data"
+	seaweedfs_options="server -dir=${seaweedfs_dir}"
+fi
+if [ -n "${seaweedfs_syslog_enable}" ]; then
+	seaweedfs_syslog_output_enable="YES"
+	seaweedfs_syslog_output_priority="${seaweedfs_syslog_priority}"
+	seaweedfs_syslog_output_facility="${seaweedfs_syslog_facility}"
+fi
+
+if checkyesno seaweedfs_syslog_output_enable; then
+	if [ -n "${seaweedfs_syslog_output_tag}" ]; then
+		seaweedfs_syslog_output_flags="-T ${seaweedfs_syslog_output_tag}"
+	else
+		seaweedfs_syslog_output_flags="-T ${name}"
+	fi
 
-                if [ -n "${seaweedfs_syslog_priority}" ]; then
-                        seaweedfs_syslog_flags="${seaweedfs_syslog_flags} -s ${seaweedfs_syslog_priority}"
-                fi
+	if [ -n "${seaweedfs_syslog_output_priority}" ]; then
+		seaweedfs_syslog_output_flags="${seaweedfs_syslog_output_flags} -s ${seaweedfs_syslog_output_priority}"
+	fi
 
-                if [ -n "${seaweedfs_syslog_facility}" ]; then
-                        seaweedfs_syslog_flags="${seaweedfs_syslog_flags} -l ${seaweedfs_syslog_facility}"
-                fi
-        fi
-else
-        seaweedfs_syslog_enable="NO"
-        seaweedfs_syslog_flags=""
+	if [ -n "${seaweedfs_syslog_output_facility}" ]; then
+		seaweedfs_syslog_output_flags="${seaweedfs_syslog_output_flags} -l ${seaweedfs_syslog_output_facility}"
+	fi
 fi
 
-pidfile=/var/run/seaweedfs.pid
+pidfile=${seaweedfs_pidfile}
 procname="%%PREFIX%%/bin/weed"
 command="/usr/sbin/daemon"
-command_args="-f -t ${name} ${seaweedfs_syslog_flags} -p ${pidfile} ${procname} ${seaweedfs_options}"
+command_args="-f -t ${name} ${seaweedfs_syslog_output_flags} -p ${pidfile} ${procname} ${seaweedfs_options}"
 
-extra_commands="reload monitor"
-monitor_cmd=seaweedfs_monitor
 start_precmd=seaweedfs_startprecmd
-required_files="${seaweedfs_dir}"
-
-seaweedfs_monitor()
-{
-	sig_reload=USR1
-	run_rc_command "reload"
-}
 
 seaweedfs_startprecmd()
 {
-        if [ ! -e ${pidfile} ]; then
-                install -o ${seaweedfs_user} -g ${seaweedfs_group} /dev/null ${pidfile};
-        fi
+	if [ ! -e "${pidfile}" ]; then
+		install -m 0600 -o "${seaweedfs_user}" -g "${seaweedfs_group}" /dev/null "${pidfile}";
+	fi
 
-        if [ ! -d ${seaweedfs_dir}/data ]; then
-                install -d -m 0750 -o ${seaweedfs_user} -g ${seaweedfs_group} ${seaweedfs_dir}/data
-        fi
-        if [ ! -d ${seaweedfs_dir}/metadata ]; then
-                install -d -m 0750 -o ${seaweedfs_user} -g ${seaweedfs_group} ${seaweedfs_dir}/metadata
-        fi
-        chdir ${seaweedfs_dir}
+	if [ ! -d "${seaweedfs_dir}" ]; then
+		install -d -m 0750 -o "${seaweedfs_user}" -g "${seaweedfs_group}" "${seaweedfs_dir}"
+	fi
 }
 
 run_rc_command "$1"
diff --git a/net/seaweedfs/pkg-plist b/net/seaweedfs/pkg-plist
index 815b7c1e006e..034ae7900cf5 100644
--- a/net/seaweedfs/pkg-plist
+++ b/net/seaweedfs/pkg-plist
@@ -1,5 +1,3 @@
-@dir(seaweedfs,seaweedfs,750) /var/db/seaweedfs
-@dir(seaweedfs,seaweedfs,750) /var/log/seaweedfs
 @comment normally these would auto-populate your etc dir but these generated
 @comment files contain conflicting options; users must read the wiki first!
 %%ETCDIR%%/filer.toml.sample