git: 30f266aa4b9a - main - devel/py-python-velbus: add new port

From: Dries Michiels <driesm_at_FreeBSD.org>
Date: Tue, 18 Mar 2025 11:13:44 UTC
The branch main has been updated by driesm:

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

commit 30f266aa4b9a16f58883a7eeccd128c57e4bbc6d
Author:     Dries Michiels <driesm@FreeBSD.org>
AuthorDate: 2025-03-18 07:02:57 +0000
Commit:     Dries Michiels <driesm@FreeBSD.org>
CommitDate: 2025-03-18 11:13:32 +0000

    devel/py-python-velbus: add new port
    
    Python application that bridges a Velbus installation with TCP.
---
 GIDs                                               |  2 +-
 UIDs                                               |  2 +-
 devel/Makefile                                     |  1 +
 devel/py-python-velbustcp/Makefile                 | 39 +++++++++++++++++
 devel/py-python-velbustcp/distinfo                 |  3 ++
 .../py-python-velbustcp/files/velbustcpd-devd.conf | 11 +++++
 devel/py-python-velbustcp/files/velbustcpd.in      | 49 ++++++++++++++++++++++
 devel/py-python-velbustcp/pkg-descr                |  2 +
 8 files changed, 107 insertions(+), 2 deletions(-)

diff --git a/GIDs b/GIDs
index c3797e521400..124c911b94ac 100644
--- a/GIDs
+++ b/GIDs
@@ -307,7 +307,7 @@ victoria-logs:*:363:
 elog:*:364:
 gotify:*:365:
 opengist:*:366:
-# free: 367
+velbustcpd:*:367:
 # free: 368
 # free: 369
 _wsdd:*:370:
diff --git a/UIDs b/UIDs
index b2f2f4b4568f..a4dd1f676f71 100644
--- a/UIDs
+++ b/UIDs
@@ -313,7 +313,7 @@ victoria-logs:*:363:363::0:0:VictoriaLogs Daemon:/nonexistent:/usr/sbin/nologin
 elog:*:364:364::0:0:Elog server:/nonexistent:/usr/sbin/nologin
 gotify:*:365:365::0:0:Gotify User:/var/db/gotify:/usr/sbin/nologin
 opengist:*:366:366::0:0:OpenGist User:/var/db/opengist:/usr/sbin/nologin
-# free: 367
+velbustcpd:*:367:367::0:0:Velbustcp Deamon:/nonexistent:/usr/sbin/nologin
 # free: 368
 # free: 369
 _wsdd:*:370:370::0:0:Web Service Discovery Daemon:/nonexistent:/usr/sbin/nologin
diff --git a/devel/Makefile b/devel/Makefile
index 4d4b24ab54a2..0a0b6092a18a 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -5756,6 +5756,7 @@
     SUBDIR += py-python-socketio
     SUBDIR += py-python-statsd
     SUBDIR += py-python-subunit
+    SUBDIR += py-python-velbustcp
     SUBDIR += py-python-xcaplib
     SUBDIR += py-pythonbrew
     SUBDIR += py-pythondialog
diff --git a/devel/py-python-velbustcp/Makefile b/devel/py-python-velbustcp/Makefile
new file mode 100644
index 000000000000..15e8b4842954
--- /dev/null
+++ b/devel/py-python-velbustcp/Makefile
@@ -0,0 +1,39 @@
+PORTNAME=		python-velbustcp
+DISTVERSION=		1.5.1-9
+DISTVERSIONSUFFIX=	-g01b75b7
+CATEGORIES=		devel python
+PKGNAMEPREFIX=		${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	driesm@FreeBSD.org
+COMMENT=	Python application that bridges a Velbus installation with TCP
+WWW=		https://github.com/velbus/python-velbustcp
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pyserial>=0:comms/py-pyserial@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}blinker>0:devel/py-blinker@${PY_FLAVOR}
+
+USES=		python
+USE_GITHUB=	yes
+GH_ACCOUNT=	velbus
+USE_PYTHON=	autoplist concurrent distutils
+
+USE_RC_SUBR=	velbustcpd
+
+NO_ARCH=	yes
+SUB_LIST=	PORTNAME=${PORTNAME} \
+		PYTHON_CMD=${PYTHON_CMD} \
+		USERS=${USERS}
+
+USERS=		velbustcpd
+GROUPS=		velbustcpd
+
+post-install:
+	${MKDIR} ${STAGEDIR}${PREFIX}/etc/${PORTNAME}
+	${INSTALL_DATA} ${WRKSRC}/settings.json.template ${STAGEDIR}${PREFIX}/etc/${PORTNAME}/settings.json.sample
+	${ECHO_CMD} "@sample etc/${PORTNAME}/settings.json.sample" >> ${TMPPLIST}
+	${INSTALL_DATA} files/velbustcpd-devd.conf ${STAGEDIR}${PREFIX}/etc/devd/velbustcpd-devd.conf.sample
+	${ECHO_CMD} "@sample etc/devd/velbustcpd-devd.conf.sample" >> ${TMPPLIST}
+
+.include <bsd.port.mk>
diff --git a/devel/py-python-velbustcp/distinfo b/devel/py-python-velbustcp/distinfo
new file mode 100644
index 000000000000..174e3e6e3b20
--- /dev/null
+++ b/devel/py-python-velbustcp/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1742281208
+SHA256 (velbus-python-velbustcp-1.5.1-9-g01b75b7_GH0.tar.gz) = b7b5d66103715a2f8ee77ada66fb5389eb13fd16a5a45bcc8d95a980fa5bdb9f
+SIZE (velbus-python-velbustcp-1.5.1-9-g01b75b7_GH0.tar.gz) = 19774
diff --git a/devel/py-python-velbustcp/files/velbustcpd-devd.conf b/devel/py-python-velbustcp/files/velbustcpd-devd.conf
new file mode 100644
index 000000000000..e7843b9c2a73
--- /dev/null
+++ b/devel/py-python-velbustcp/files/velbustcpd-devd.conf
@@ -0,0 +1,11 @@
+# Example devd configuration file for velbus usb interface
+# Uncomment the notify rule below to enable.
+# vendor/product id to be adjusted, probe with usbconfig for the correct ids
+#notify 100 {
+#       match "system"          "USB";
+#       match "subsystem"       "INTERFACE";
+#       match "type"            "ATTACH";
+#       match "vendor" "0x1209";
+#       match "product" "0xc0ca";
+#       action "chown velbustcpd:wheel /dev/$cdev";
+#};
diff --git a/devel/py-python-velbustcp/files/velbustcpd.in b/devel/py-python-velbustcp/files/velbustcpd.in
new file mode 100644
index 000000000000..03718c0f69e6
--- /dev/null
+++ b/devel/py-python-velbustcp/files/velbustcpd.in
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# PROVIDE: velbustcpd
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+# Add the following lines to /etc/rc.conf to enable velbustcpd:
+# velbustcpd_enable:	Set to NO by default. Set it to YES to enable it.
+# velbustcpd_log_dig:	The directory to store log files
+#			Default: /var/log/%%PORTNAME%%
+# velbustcpd_pid_dir:	The directory of the pid file
+#			Default: /var/run/%%PORTNAME%%
+# velbustcpd_user:	The user account velbustcpd daemon runs as what
+#			you want it to be.
+# velbustcpd_settings:	Location of the settings file
+#			Default: %%LOCALBASE%%/etc/%%PORTNAME%%/settings.json
+
+. /etc/rc.subr
+
+name=velbustcpd
+rcvar=velbustcpd_enable
+
+load_rc_config ${name}
+
+: ${velbustcpd_enable:=NO}
+: ${velbustcpd_log_dir:="/var/log/%%PORTNAME%%"}
+: ${velbustcpd_pid_dir:="/var/run/%%PORTNAME%%"}
+: ${velbustcpd_user:=%%USERS%%}
+: ${velbustcpd_settings:="%%LOCALBASE%%/etc/%%PORTNAME%%/settings.json"}
+
+pidfile="${velbustcpd_pid_dir}/velbustcpd.pid"
+logfile="${velbustcpd_log_dir}/velbustcpd.log"
+procname="%%PYTHON_CMD%%"
+command="/usr/sbin/daemon"
+command_args="-f -p ${pidfile} -o ${logfile} ${procname} \
+		%%LOCALBASE%%/bin/velbustcp --settings ${velbustcpd_settings}"
+start_precmd=velbustcpd_precmd
+
+velbustcpd_precmd()
+{
+	if [ ! -d ${velbustcpd_pid_dir} ]; then
+		install -d -g ${velbustcpd_user} -o ${velbustcpd_user} ${velbustcpd_pid_dir}
+	fi
+	if [ ! -d ${velbustcpd_log_dir} ]; then
+		install -d -g ${velbustcpd_user} -o ${velbustcpd_user} ${velbustcpd_log_dir}
+	fi
+}
+
+run_rc_command "$1"
diff --git a/devel/py-python-velbustcp/pkg-descr b/devel/py-python-velbustcp/pkg-descr
new file mode 100644
index 000000000000..47c1d9fefbd2
--- /dev/null
+++ b/devel/py-python-velbustcp/pkg-descr
@@ -0,0 +1,2 @@
+Python application that bridges a Velbus installation with TCP.
+Can be used to broadcast a velbus USB interface as TCP socket.