From nobody Tue Aug 4 12:17:38 2026 X-Original-To: dev-commits-ports-main@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 4hDsxZ3StVz6n8Gx for ; Tue, 04 Aug 2026 12:17:38 +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 4hDsxZ2xXJz3xhS for ; Tue, 04 Aug 2026 12:17:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785845858; 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=OIxZpKTjO7z6Vnm+gPzM3k0qPJZoN5dXy8B1znozR3vRa13PqyLl1tcYBGFfh7JGk6/oJV qvb05OIEJ3cnknwBvkGOD7nf3CUgtIrv1PSC7+6Zh5Kv2y0fBOqGjt/guANJ29qVGo+9KU QWZwxK9P89bJ/FA02QsvA2lboXlrvxXjhVfzeg3Ysz91RdFXJzjPfhfOr7Gu7aEOMOMRJv T4xnOdsVBR1iHbjtxXxkxHJJw2mSewTc+4IbgEqHE0OOA/1selsT0nQDelvVDItHREjuum HY4BeMJJV5ZjPuRd5V+mPwQ6MGBl1pX9NrL+0aSynPonq7Jg2yHWO4cTVvduMQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785845858; a=rsa-sha256; cv=none; b=PeQVxr7XnEkIILJT+n3YMN3CuBzozNJQ3hlJwJmqMeLw+3ged0H4a9ObDWf3eGMwaZ2Yqm m9KyOGsmPuvNjWKoN8LyYeyu2tjaLKaZFtzWA5kcQtqJ8muCYoQz4yfpFVg/wZAg1KYzfW eJ6JqxCVd/o/NRuWYs43CBICHiIQWr26R17NajoXyRi87UdAGQZlV/QLttmhH6/Rc6IJOQ 8R5bnDuR+cKvTM8onYiMUAzAGHw/RxhrEwrsnEbbzGYztj5LgkChhMpl9pWeubylFuAcx0 XjAF4xOl82kML4NypEm5ZicMWW+ZC0P2tjIC5Vc1KyziMDRBmbwyWndJnIvD7Q== 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=1785845858; 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=dtApZ8jOBj/AWL/A31wt1bDsoS0qbS7A3MfGwv/+ibhf6zbMWAWnDp6zFjqopg3zl0giaM VMKO+bB2SUH8jaJMvsEb65552i438RlzxFdTSz34b5ZJEMsnIbS+D5tIha/L25yOsZk7xY ItufXfLsSmuxcEn/Tzm6mR98o65kArI+6StM0a8xtLJHnsn8ExuSkGAE8bDgziLo92x+H/ 4BK6zGpMunOlMbDgG9N8rSitSkOm23VPbA6QQRukuCGj3rAd37liM+PSf7hj9NiVNEj2Te QomGDyeVz9C/9PISBmCpnS34ObbP8AFzC8UWy/OonU6iFiDNqqI7VYoGMJ+S+w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hDsxZ1rbYzmwl for ; Tue, 04 Aug 2026 12:17:38 +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: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@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))