git: c721369988fc - main - sysutils/orch: add a new port for program orchestration

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Thu, 18 Jan 2024 02:34:58 UTC
The branch main has been updated by kevans:

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

commit c721369988fc8a9c959a7dc64fa5060812ee5ebe
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-01-18 02:33:24 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-01-18 02:33:41 +0000

    sysutils/orch: add a new port for program orchestration
    
    Inspired by expect(1) but with its own syntax, orch allows program
    orchestration via a pts(4) pseudo-terminal driven by similar write/match
    patterns as with it source of inspiration.
    
    This is still in relatively early development, but already it has a fair
    amount of useful features.  Feedback is welcome, examples can be found
    both in the manpage as well as /usr/local/share/orch/examples.  Other
    practical examples can be found at:
    
    https://git.kevans.dev/kevans/tty-tests
---
 sysutils/Makefile       |  1 +
 sysutils/orch/Makefile  | 37 +++++++++++++++++++++++++++++++++++++
 sysutils/orch/distinfo  |  3 +++
 sysutils/orch/pkg-descr |  5 +++++
 sysutils/orch/pkg-plist |  5 +++++
 5 files changed, 51 insertions(+)

diff --git a/sysutils/Makefile b/sysutils/Makefile
index 7c014e8bc4fc..0ce06a27edca 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -860,6 +860,7 @@
     SUBDIR += openupsd
     SUBDIR += openzfs
     SUBDIR += openzfs-kmod
+    SUBDIR += orch
     SUBDIR += osinfo-db-tools
     SUBDIR += p5-App-Regather
     SUBDIR += p5-App-RunCron
diff --git a/sysutils/orch/Makefile b/sysutils/orch/Makefile
new file mode 100644
index 000000000000..34e68d19500b
--- /dev/null
+++ b/sysutils/orch/Makefile
@@ -0,0 +1,37 @@
+PORTNAME=	orch
+PORTVERSION=	0.1
+CATEGORIES=	sysutils
+MASTER_SITES=	https://git.kevans.dev/kevans/${PORTNAME}/archive/${PORTVERSION}.tar.gz?dummy=/
+
+MAINTAINER=	kevans@FreeBSD.org
+COMMENT=	Program orchestration tool scripted with lua
+WWW=		https://git.kevans.dev/kevans/orch
+
+LICENSE=	BSD2CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		lua:52-54 uidfix
+
+WRKSRC=		${WRKDIR}/${PORTNAME}
+
+ORCHLUA_PATH=	${PREFIX}/share/${PORTNAME}
+
+MAKE_ENV+=	BINDIR="${PREFIX}/bin" \
+		EXAMPLESDIR="${ORCHLUA_PATH}/examples" \
+		MANDIR="${PREFIX}/share/man/man" \
+		LUA_INCDIR="${LUA_INCDIR}" \
+		LUA_LIB="-L${LUA_LIBDIR} -llua-${LUA_VER}" \
+		ORCHLUA_PATH="${ORCHLUA_PATH}"
+
+.include <bsd.port.pre.mk>
+
+# uidfix won't cover custom directories like this, so we'll hit it ourselves.
+.if ${UID} != 0
+MAKE_ENV+=	FILESDIR_OWN=${UID} FILESDIR_GRP=${GID}
+MAKE_ENV+=	EXAMPLESDIR_OWN=${UID} EXAMPLESDIR_GRP=${GID}
+.endif
+
+pre-install:
+	${MKDIR} ${STAGEDIR}${PREFIX}/bin ${STAGEDIR}${PREFIX}/share/man/man1
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/orch/distinfo b/sysutils/orch/distinfo
new file mode 100644
index 000000000000..52af1438de94
--- /dev/null
+++ b/sysutils/orch/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1705544817
+SHA256 (orch-0.1.tar.gz) = c4c058f73324f883c9b823639664a97380bd041dbc4dfd646be325a99305aa64
+SIZE (orch-0.1.tar.gz) = 20134
diff --git a/sysutils/orch/pkg-descr b/sysutils/orch/pkg-descr
new file mode 100644
index 000000000000..19b23204df2e
--- /dev/null
+++ b/sysutils/orch/pkg-descr
@@ -0,0 +1,5 @@
+Orch is a program orchestration tool, inspired by expect(1) but scripted with
+lua.  This utility allows scripted manipulation of programs for, e.g., testing
+or automation purposes.  Orch drives spawn processes over a pts(4)
+pseudo-terminal, which allows for a broader range of interactions with a program
+under orchestration.
diff --git a/sysutils/orch/pkg-plist b/sysutils/orch/pkg-plist
new file mode 100644
index 000000000000..6fda20d6d435
--- /dev/null
+++ b/sysutils/orch/pkg-plist
@@ -0,0 +1,5 @@
+bin/orch
+share/orch/examples/cat.orch
+share/orch/examples/nc.orch
+share/orch/orch.lua
+share/man/man1/orch.1.gz