git: a6edc54ae691 - main - sysutils/ansible: Do not replace shebangs within modules

From: Mateusz Piotrowski <0mp_at_FreeBSD.org>
Date: Thu, 21 Jul 2022 23:46:10 UTC
The branch main has been updated by 0mp:

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

commit a6edc54ae6911d8d7621182c2c2ffa26777985ea
Author:     Mateusz Piotrowski <0mp@FreeBSD.org>
AuthorDate: 2022-07-21 23:38:56 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2022-07-21 23:45:15 +0000

    sysutils/ansible: Do not replace shebangs within modules
    
    It turns out that Ansible does not like when we replace the shebang
    lines with a path to a Python interpreter with a trailing number
    (like "python3.9").
    
    Stop replacing the shebang lines in modules directories. If it turns out
    to be problematic as well, we may consider introducing an indirect
    symlink to the versioned Python interpreter from a path like
    /usr/local/libexec/ansible/bin/python for example.
    
    PR:             265211
    Reported by:    vladimir-csp@yandex.ru
---
 sysutils/ansible/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sysutils/ansible/Makefile b/sysutils/ansible/Makefile
index 98d5968afc98..a3d819005cf1 100644
--- a/sysutils/ansible/Makefile
+++ b/sysutils/ansible/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	ansible
 DISTVERSION=	6.0.0
+PORTREVISION=	1
 CATEGORIES=	sysutils python
 MASTER_SITES=	CHEESESHOP
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -21,7 +22,12 @@ SHEBANG_FILES=	ansible_collections/community/zabbix/roles/zabbix_proxy/files/ins
 		ansible_collections/cyberark/conjur/ci/build_release \
 		ansible_collections/cyberark/conjur/ci/publish_to_galaxy \
 		ansible_collections/ovirt/ovirt/roles/disaster_recovery/files/ovirt-dr
-SHEBANG_GLOB=	*.py *.sh build.py.generic
+# It's probably best to leave shebangs in modules untouched as they must be
+# either unversioned or absent.
+# See [1] and [2].
+# [1]: https://github.com/ansible/ansible/issues/78243
+# [2]: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265211
+SHEBANG_REGEX=	(([^/])|(/[^m])|(/m[^o])|(/mo[^d])|(/mod[^u])|(/modu[^l])|(/modul[^e])|(/module[^s])|(/modules[^/]))*\.(py|sh|build.py.generic)
 python_OLD_CMD=	/Users/kbreit/Documents/Programming/ansible_collections/cisco/meraki/venv/bin/python
 
 CONFLICTS_INSTALL=	${_ANSIBLE_PACKAGES:N${PKGBASE}}