git: 0d961a157fb0 - main - sysutils/rubygem-choria-mcorpc-support: Provide execution_wrapper(1) with choria, deprecate broken ports

From: Romain Tartière <romain_at_FreeBSD.org>
Date: Sun, 09 Mar 2025 02:44:18 UTC
The branch main has been updated by romain:

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

commit 0d961a157fb0e77225d9dc2157e2d933433f953c
Author:     Romain Tartière <romain@FreeBSD.org>
AuthorDate: 2025-03-09 02:35:55 +0000
Commit:     Romain Tartière <romain@FreeBSD.org>
CommitDate: 2025-03-09 02:43:52 +0000

    sysutils/rubygem-choria-mcorpc-support: Provide execution_wrapper(1) with choria, deprecate broken ports
    
    The latest boost update broke some components used to run bolt tasks
    through choria.  Since these components are legacy ones and have been
    archived by their owner, we provide a compatible wrapper directly with
    choria, and as these ports are only soft-dependencies for choria and are
    broken, we deprecate and set an expiration date on the.
    
    With hat:       puppet
---
 net/cpp-pcp-client/Makefile                            |  2 ++
 sysutils/pxp-agent/Makefile                            |  3 +++
 sysutils/rubygem-choria-mcorpc-support/Makefile        |  7 ++++++-
 .../files/execution_wrapper.rb                         | 18 ++++++++++++++++++
 .../files/patch-lib_mcollective_util_tasks__support.rb | 10 ++++++++++
 5 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/net/cpp-pcp-client/Makefile b/net/cpp-pcp-client/Makefile
index 9f3be8e9c934..68f697b14bd3 100644
--- a/net/cpp-pcp-client/Makefile
+++ b/net/cpp-pcp-client/Makefile
@@ -11,6 +11,8 @@ LICENSE=	APACHE20
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
 BROKEN=		fails to build with Boost>=1.87
+DEPRECATED=	Project got archived, broken
+EXPIRATION_DATE=2025-05-08
 
 LIB_DEPENDS=	libboost_filesystem.so:devel/boost-libs \
 		libleatherman_json_container.so:devel/leatherman
diff --git a/sysutils/pxp-agent/Makefile b/sysutils/pxp-agent/Makefile
index 73db142ddbbd..5bc6f61f9cd1 100644
--- a/sysutils/pxp-agent/Makefile
+++ b/sysutils/pxp-agent/Makefile
@@ -10,6 +10,9 @@ WWW=		https://github.com/puppetlabs/pxp-agent
 LICENSE=	APACHE20
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
+DEPRECATED=	Project got archived, dependencies are broken
+EXPIRATION_DATE=2025-05-08
+
 LIB_DEPENDS=	liblibcpp-pcp-client.so:net/cpp-pcp-client \
 		libboost_thread.so:devel/boost-libs \
 		liblibcpp-hocon.so:devel/cpp-hocon \
diff --git a/sysutils/rubygem-choria-mcorpc-support/Makefile b/sysutils/rubygem-choria-mcorpc-support/Makefile
index 0ad288af8e11..452942a477ac 100644
--- a/sysutils/rubygem-choria-mcorpc-support/Makefile
+++ b/sysutils/rubygem-choria-mcorpc-support/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	choria-mcorpc-support
 DISTVERSION=	2.26.4
+PORTREVISION=	1
 CATEGORIES=	sysutils rubygems
 MASTER_SITES=	RG
 
@@ -17,6 +18,10 @@ RUN_DEPENDS=	choria>=0.20.1:sysutils/choria \
 
 NO_ARCH=	yes
 
-PLIST_FILES=	bin/mco
+PLIST_FILES=	bin/mco \
+		bin/execution_wrapper
+
+post-install:
+	${INSTALL_SCRIPT} ${FILESDIR}/execution_wrapper.rb ${STAGEDIR}${PRFIX}/bin
 
 .include <bsd.port.mk>
diff --git a/sysutils/rubygem-choria-mcorpc-support/files/execution_wrapper.rb b/sysutils/rubygem-choria-mcorpc-support/files/execution_wrapper.rb
new file mode 100755
index 000000000000..a4328577ec69
--- /dev/null
+++ b/sysutils/rubygem-choria-mcorpc-support/files/execution_wrapper.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+
+require 'json'
+
+data = JSON.parse(STDIN.read)
+
+in_r, in_w = IO.pipe
+in_w.sync = true
+
+pid = Process.spawn({}, data['executable'], *data['arguments'], { in: in_r, out: data['stdout'], err: data['stderr'] })
+in_w.write(data['input'])
+in_w.close
+
+Process.wait(pid)
+exit_code = $?.exitstatus
+
+File.write(data['exitcode'], exit_code)
+exit(exit_code)
diff --git a/sysutils/rubygem-choria-mcorpc-support/files/patch-lib_mcollective_util_tasks__support.rb b/sysutils/rubygem-choria-mcorpc-support/files/patch-lib_mcollective_util_tasks__support.rb
new file mode 100644
index 000000000000..222ae7516309
--- /dev/null
+++ b/sysutils/rubygem-choria-mcorpc-support/files/patch-lib_mcollective_util_tasks__support.rb
@@ -0,0 +1,10 @@
+--- lib/mcollective/util/tasks_support.rb.orig	2025-03-09 01:41:22 UTC
++++ lib/mcollective/util/tasks_support.rb
+@@ -294,6 +294,7 @@ module MCollective
+ 
+           pid = Process.fork
+           if pid.nil?
++            Process.initgroups(run_as, u.gid)
+             Process.gid = Process.egid = u.gid
+             Process.uid = Process.euid = u.uid
+             ENV.delete_if { |name| name !~ /^LC_/ }