git: f02bc3be7180 - main - net/rsync: Fix stealth dependency on Python

From: Rodrigo Osorio <rodrigo_at_FreeBSD.org>
Date: Sun, 28 Dec 2025 17:46:07 UTC
The branch main has been updated by rodrigo:

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

commit f02bc3be718072b75bd291f81f66b7f15865f535
Author:     Rodrigo Osorio <rodrigo@FreeBSD.org>
AuthorDate: 2025-12-28 16:23:04 +0000
Commit:     Rodrigo Osorio <rodrigo@FreeBSD.org>
CommitDate: 2025-12-28 17:36:56 +0000

    net/rsync: Fix stealth dependency on Python
    
    net/rsync includes a Python script installed as sbin/rrsync
    without declaring a dependency on Python.
    
    Adds a port option, PYTHON, that controls whether rrsync is
    installed and adds the necessary dependency and remove the
    pkg-message who advises that Python might be needed.
    
    By default this option is off (updating the package will remove rrsync).
    
    PR:             286073
    Reported by:    Christian Ullrich <chris@chrullrich.net>
---
 UPDATING              |  9 +++++++++
 net/rsync/Makefile    | 20 ++++++++++++++------
 net/rsync/pkg-message |  8 --------
 net/rsync/pkg-plist   |  4 ++--
 4 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/UPDATING b/UPDATING
index 3c546d361b48..7fbb34cac574 100644
--- a/UPDATING
+++ b/UPDATING
@@ -5,6 +5,15 @@ they are unavoidable.
 You should get into the habit of checking this file for changes each time
 you update your ports collection, before attempting any port upgrades.
 
+20251228:
+  AFFECTS: users of net/rsync
+  AUTHOR: rodrigo@FreeBSD.org
+
+  Add a new option PYTHON that controls when the Python script
+  sbin/rrsync is installed and adds the necessary dependencies.
+  By default this option is off; updating the package will remove
+  the rrsync script.
+
 20251208:
   AFFECTS: users of net-mgmt/unifi{9,10}
   AUTHOR: otis@FreeBSD.org
diff --git a/net/rsync/Makefile b/net/rsync/Makefile
index 71f9075fbba8..30f17eba03dd 100644
--- a/net/rsync/Makefile
+++ b/net/rsync/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	rsync
 DISTVERSION=	3.4.1
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	net
 MASTER_SITES=	https://www.mirrorservice.org/sites/rsync.samba.org/src/ \
 		http://rsync.mirror.garr.it/src/ \
@@ -19,8 +19,7 @@ LIB_DEPENDS=	liblz4.so:archivers/liblz4 \
 		libxxhash.so:devel/xxhash \
 		libzstd.so:archivers/zstd
 
-USES=		autoreconf:build cpe python shebangfix ssl
-PYTHON_NO_DEPENDS=	yes
+USES=		autoreconf:build cpe ssl
 CPE_VENDOR=	samba
 CPE_PRODUCT=	rsync
 USE_RC_SUBR=	rsyncd
@@ -28,7 +27,7 @@ USE_RC_SUBR=	rsyncd
 SHEBANG_FILES=	support/rrsync
 
 GNU_CONFIGURE=	yes
-GNU_CONFIGURE_MANPREFIX=${PREFIX}/share
+GNU_CONFIGURE_MANPREFIX=	${PREFIX}/share
 CONFIGURE_ARGS=	--disable-debug \
 		--enable-ipv6 \
 		--with-rsyncd-conf=${ETCDIR}/rsyncd.conf
@@ -45,14 +44,16 @@ SUB_LIST=	NAME=rsyncd
 PORTDOCS=	NEWS.md README.md csprotocol.txt tech_report.tex
 
 # define options
-OPTIONS_DEFINE=		DOCS ICONV POPT_PORT SSH ZLIB_BASE
+OPTIONS_DEFINE=		DOCS ICONV POPT_PORT PYTHON SSH ZLIB_BASE
 OPTIONS_DEFAULT=	FLAGS ICONV SSH ZLIB_BASE
 OPTIONS_RADIO=		PTS
 OPTIONS_RADIO_PTS=	FLAGS RENAMED
+OPTIONS_SUB=		yes
 
 # options provided upstream
 FLAGS_DESC=	File system flags support patch, adds --fileflags
 POPT_PORT_DESC=	Use popt from devel/popt instead of bundled one
+PYTHON_DESC=	Install Python scripts (rrsync)
 SSH_DESC=	Use SSH instead of RSH
 ZLIB_BASE_DESC=	Use zlib from base instead of bundled one
 
@@ -69,6 +70,8 @@ ICONV_CONFIGURE_ENABLE=	iconv iconv-open
 POPT_PORT_LIB_DEPENDS=		libpopt.so:devel/popt
 POPT_PORT_CONFIGURE_OFF=	--with-included-popt
 
+PYTHON_USES=	python:run shebangfix
+
 RENAMED_EXTRA_PATCHES=	${WRKSRC}/patches/detect-renamed.diff
 
 SSH_CONFIGURE_ON=	--with-rsh=ssh
@@ -88,7 +91,8 @@ DISTFILES+=	${PORTNAME}-patches-${DISTVERSION}${EXTRACT_SUFX}
 CONFIGURE_ARGS+=	ac_cv_search_libiconv_open=no
 .endif
 
-.if make(makesum) || ${PORT_OPTIONS:MRENAMED} || ${PORT_OPTIONS:MICONV} || ${PORT_OPTIONS:MFLAGS}
+.if make(makesum) || ${PORT_OPTIONS:MRENAMED} || ${PORT_OPTIONS:MICONV} || \
+	${PORT_OPTIONS:MFLAGS}
 pre-patch:
 	@${REINPLACE_CMD} 's:+int module_dirlen = 0;:+:' ${WRKSRC}/patches/fileflags.diff
 .endif
@@ -105,11 +109,15 @@ pre-configure:
 post-install:
 	@${MKDIR} ${STAGEDIR}${ETCDIR}
 	${INSTALL_DATA} ${FILESDIR}/rsyncd.conf.sample ${STAGEDIR}${ETCDIR}/
+.if ${PORT_OPTIONS:MPYTHON}
 	${INSTALL_SCRIPT} ${WRKSRC}/support/rrsync ${STAGEDIR}${PREFIX}/sbin
+.endif
 
 post-install-DOCS-on:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
 	${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}
+.if ${PORT_OPTIONS:MPYTHON}
 	${INSTALL_DATA} ${WRKSRC}/support/rrsync.1.md ${STAGEDIR}${DOCSDIR}
+.endif
 
 .include <bsd.port.post.mk>
diff --git a/net/rsync/pkg-message b/net/rsync/pkg-message
deleted file mode 100644
index 32f957ffaa35..000000000000
--- a/net/rsync/pkg-message
+++ /dev/null
@@ -1,8 +0,0 @@
-[
-{ type: install
-  message: <<EOM
-Some scripts provided by rsync, such as rrsync,
-require Python, which is not installed by default.
-EOM
-}
-]
diff --git a/net/rsync/pkg-plist b/net/rsync/pkg-plist
index 6614a2d1b5a3..06aadf721fda 100644
--- a/net/rsync/pkg-plist
+++ b/net/rsync/pkg-plist
@@ -1,8 +1,8 @@
 bin/rsync
 bin/rsync-ssl
-sbin/rrsync
+%%PYTHON%%sbin/rrsync
 share/man/man1/rsync.1.gz
 share/man/man1/rsync-ssl.1.gz
 share/man/man5/rsyncd.conf.5.gz
-%%PORTDOCS%%%%DOCSDIR%%/rrsync.1.md
+%%PYTHON%%%%PORTDOCS%%%%DOCSDIR%%/rrsync.1.md
 @sample %%ETCDIR%%/rsyncd.conf.sample