From nobody Tue Aug 4 12:17:38 2026 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hDsxh5npGz6n88V for ; Tue, 04 Aug 2026 12:17:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hDsxg48H9z3xj9 for ; Tue, 04 Aug 2026 12:17:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785845863; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D0hguwr9tPFMVgI5+FNnl5LkElg77OeLhbb0QyA71gc=; b=DJQbyXj1bTQDJpvUDvSbYefAk1c+3fkEUKdbFk2X7avm4YjwAL7LTf2JDU6ld8fPzq9CSc XiK14utteZQqOTAITLZKeU7Z8HyY7WkSUqLTxtcgevEVUu84ovbNUejdMldDCTHk+XDtc1 8vDluohDk2TRovUpayTvFNs2GZb650ovEYPE5oOppS/IV8pyw9cRL9nNqJeyWWP9CoTe2n VHPUYX1fyYHTAmwnirlxnVfj3W+7bpLy4qIB+FX6yBTkfmUQKca93XOZw+A38LcUhNSYkm YWmfRJE2v/RkuvWU+76yALcau4h79xln5JwDg9XaDwQfXighf52taitZHge4OA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785845863; a=rsa-sha256; cv=none; b=FlrV0TaLWnDccRjO65wPSyua3XbcldKt2+oNhJq44Mc3gbDhXKTxIpqOpUF3EOj9+bQmfN 8/Cb2WwYq231kR6vc3VK41uB1WjOxydiuKr35sOnQBMMvpXi5uJ4vSJm+ltuyCEeDAyYoR ZKE9jbvXW+o/XpJcRX/ZF+UrOvd+Uh1lRf83B4IMDgxVzqJKIGYHbvYCN2kxWjRM6aJXuC fhGwS0gBf3561F4LI27voSyMl3UlHAKL2FxM3UyvBU8BSt7379GjIiOdAj0O5bz+4QG+Xx SpVBI2+MDoK3++nhHcFZ00R7gsZAWh5GcIlnTbcpPKdv63vX+df6117oHtIEpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785845863; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D0hguwr9tPFMVgI5+FNnl5LkElg77OeLhbb0QyA71gc=; b=UcemS1x0fFkHGvim4Km1FMwtGVS0E0Q0cd3eabM90t/QMwIxGH3va/4bj3kA0agyPtDfpX 93HaX/PMkmHFHXPELTFjUl/SKqSXv0+zBw66xJgqrhsIcLhrLVNZw0EkFTrQ9TlqZ+twCy NJe5ViHMUjGLfUTfR2EweNoncQdn/qZTHkKhEM+tc8tUto+a94vEcpC55q/DLv83z4HmyU 6Rc1MMOeKFkCwhiFi5+Q7yYvHZFlysx+BY4zaL2pODiiNX+R8xmtjM1FhYEfy5b3xEyV+O zd4+LltSP/RJUqA4Sxbp55GDDa5Fz2SC+FnDVYMol/SosFM0I0j/DmFKvZqGag== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hDsxg2MzZzmwm for ; Tue, 04 Aug 2026 12:17:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 21fd0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 04 Aug 2026 12:17:38 +0000 To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Olivier Cochard Subject: git: bdc565d085e3 - main - devel/coccinelle: Fix python scripting List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-all@freebsd.org Sender: owner-dev-commits-ports-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olivier X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bdc565d085e3379eb5f5d6b005a2690878c68d6a Auto-Submitted: auto-generated Date: Tue, 04 Aug 2026 12:17:38 +0000 Message-Id: <6a71d862.21fd0.6545ceb8@gitrepo.freebsd.org> The branch main has been updated by olivier: URL: https://cgit.FreeBSD.org/ports/commit/?id=bdc565d085e3379eb5f5d6b005a2690878c68d6a commit bdc565d085e3379eb5f5d6b005a2690878c68d6a Author: Olivier Cochard AuthorDate: 2026-08-04 10:01:40 +0000 Commit: Olivier Cochard CommitDate: 2026-08-04 12:15:56 +0000 devel/coccinelle: Fix python scripting spatch could not load libpython, so all Python scripting failed silently. PR: 297217 Approved by: Benjamin Jacobs (maintainer) Sponsored by: Netflix --- devel/coccinelle/Makefile | 28 +++++++++++++++++++++- .../files/patch-bundles_pyml_pyml-current_py.ml | 16 +++++++++++++ devel/coccinelle/files/regress-python.c | 1 + devel/coccinelle/files/regress-python.cocci | 10 ++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/devel/coccinelle/Makefile b/devel/coccinelle/Makefile index 2fd3e5ae53e1..48d286d9895e 100644 --- a/devel/coccinelle/Makefile +++ b/devel/coccinelle/Makefile @@ -1,5 +1,6 @@ PORTNAME= coccinelle DISTVERSION= 1.3.1 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= https://coccinelle.gitlabpages.inria.fr/website/distrib/ DISTFILES= ${DISTNAME}${EXTRACT_SUFX} @@ -22,11 +23,36 @@ USES= autoreconf gmake ocaml:build,camlp4 perl5 pkgconfig:build python shebangf USE_PERL5= build SHEBANG_FILES= tools/pycocci scripts/cpptests.sh GNU_CONFIGURE= yes -CONFIGURE_ENV= PYTHON="${PYTHON_CMD}" PYVER="${PYTHON_VER}" +# --with-python bakes the interpreter path into cocciconfig.ml so spatch can +# derive the Python version and load libpython; configure ignores env PYTHON, +# and its "python" default does not exist on FreeBSD. +CONFIGURE_ARGS= --with-python=${PYTHON_CMD} +CONFIGURE_ENV= PYVER="${PYTHON_VER}" MAKE_ARGS= PYTHON_VERSION="${PYTHON_VER}" BINARY_ALIAS= make=${GMAKE} TEST_TARGET= check check-cpp +# Run the upstream suite, then exercise @script:python@ scripting: the +# upstream suite doesn't, and it regressed silently when the embedded +# interpreter failed to load libpython. The optimized build only produces +# spatch.opt, but check-cpp's cpptests.sh and the smoke test both invoke a +# plain ./spatch, so alias it first. +do-test: + @${LN} -sf spatch.opt ${TEST_WRKSRC}/spatch + @cd ${TEST_WRKSRC} && ${SETENVI} ${WRK_ENV} ${TEST_ENV} \ + ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} \ + ${TEST_ARGS:N${DESTDIRNAME}=*} ${TEST_TARGET} + @cd ${WRKSRC} && \ + out=$$(${SETENVI} ${WRK_ENV} ${TEST_ENV} ./spatch --very-quiet \ + --sp-file ${FILESDIR}/regress-python.cocci \ + ${FILESDIR}/regress-python.c) && \ + case "$$out" in \ + *"hit: ${FILESDIR}/regress-python.c:1"*) \ + ${ECHO_MSG} "===> @script:python@ smoke test PASSED" ;; \ + *) ${ECHO_MSG} "===> @script:python@ smoke test FAILED: $$out"; \ + exit 1 ;; \ + esac + OPTIONS_DEFINE= EMACS VIM OPTIONS_DEFAULT= EMACS VIM OPTIONS_SUB= yes diff --git a/devel/coccinelle/files/patch-bundles_pyml_pyml-current_py.ml b/devel/coccinelle/files/patch-bundles_pyml_pyml-current_py.ml new file mode 100644 index 000000000000..512bc9968c6a --- /dev/null +++ b/devel/coccinelle/files/patch-bundles_pyml_pyml-current_py.ml @@ -0,0 +1,16 @@ +Query the python-M.N-embed pkg-config module for libpython. The bare +python-M.N module ships an empty Libs: on FreeBSD (extension-building +metadata), so it lacks the -lpython needed to embed the interpreter and +find_library_path aborts with "unable to parse the output of pkg-config". + +--- bundles/pyml/pyml-current/py.ml.orig ++++ bundles/pyml/pyml-current/py.ml +@@ -376,7 +376,7 @@ + + let libpython_from_pkg_config version_major version_minor = + let command = +- Printf.sprintf "pkg-config --libs python-%d.%d" version_major ++ Printf.sprintf "pkg-config --libs python-%d.%d-embed" version_major + version_minor in + match run_command_opt command false with + Some (words :: _) -> diff --git a/devel/coccinelle/files/regress-python.c b/devel/coccinelle/files/regress-python.c new file mode 100644 index 000000000000..261e6289e0e8 --- /dev/null +++ b/devel/coccinelle/files/regress-python.c @@ -0,0 +1 @@ +void foo(void) { bar(1); } diff --git a/devel/coccinelle/files/regress-python.cocci b/devel/coccinelle/files/regress-python.cocci new file mode 100644 index 000000000000..c83d408803b8 --- /dev/null +++ b/devel/coccinelle/files/regress-python.cocci @@ -0,0 +1,10 @@ +@r@ +identifier f; +position p; +@@ +f@p(...) + +@script:python@ +p << r.p; +@@ +print("hit: %s:%s" % (p[0].file, p[0].line))