From 55a9cbafd2c59b24543be69aee10933b7422118d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sun, 29 Dec 2024 15:53:13 +0700 Subject: [PATCH] coccinelle: update to 1.3. --- srcpkgs/coccinelle/patches/python-3.13.patch | 70 ++++++++++++++++++++ srcpkgs/coccinelle/template | 18 +++-- srcpkgs/python3/template | 2 + 3 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/coccinelle/patches/python-3.13.patch diff --git a/srcpkgs/coccinelle/patches/python-3.13.patch b/srcpkgs/coccinelle/patches/python-3.13.patch new file mode 100644 index 00000000000..bf5fc5af426 --- /dev/null +++ b/srcpkgs/coccinelle/patches/python-3.13.patch @@ -0,0 +1,70 @@ +--- a/bundles/pyml/pyml-current/pyml_stubs.c ++++ b/bundles/pyml/pyml-current/pyml_stubs.c +@@ -136,8 +136,6 @@ file_of_file_descr(value file_descr, con + } + #endif + +-static void *Python27__PyObject_NextNotImplemented; +- + /* Global variables for the library */ + + /* version_major != 0 iff the library is initialized */ +@@ -743,15 +741,18 @@ guess_debug_build() + PyObject *debug_build_py; + char *py_debug_str = "Py_DEBUG"; + if (version_major >= 3) { +- py_debug = Python3_PyUnicode_FromStringAndSize(py_debug_str, 8); ++ py_debug = Python3_PyUnicode_FromStringAndSize(py_debug_str, strlen(py_debug_str)); + } + else { +- py_debug = Python2_PyString_FromStringAndSize(py_debug_str, 8); ++ py_debug = Python2_PyString_FromStringAndSize(py_debug_str, strlen(py_debug_str)); + } + assert(py_debug); + args = singleton(py_debug); + debug_build_py = Python_PyObject_Call(get_config_var, args, NULL); +- assert(debug_build_py); ++ if (!debug_build_py) { ++ Python_PyErr_Print(); ++ caml_failwith("Cannot check for debug build"); ++ } + if (debug_build_py == Python__Py_NoneStruct) { + debug_build = 0; + } +@@ -797,8 +798,6 @@ py_load_library(value filename_ocaml, va + Python27_PyCapsule_New = resolve("PyCapsule_New"); + Python27_PyCapsule_GetPointer = resolve("PyCapsule_GetPointer"); + Python27_PyCapsule_IsValid = resolve("PyCapsule_IsValid"); +- Python27__PyObject_NextNotImplemented = +- resolve("_PyObject_NextNotImplemented"); + } + Python_PyObject_CallFunctionObjArgs = + resolve("PyObject_CallFunctionObjArgs"); +@@ -970,6 +969,17 @@ enum pytype_labels { + Set + }; + ++static bool is_iterable(PyObject *obj) { ++ PyObject *iter = Python_PyObject_GetIter(obj); ++ if (iter) { ++ Py_DECREF(iter); ++ return true; ++ } else { ++ Python_PyErr_Clear(); ++ return false; ++ } ++} ++ + CAMLprim value + pytype(value object_ocaml) + { +@@ -1035,8 +1045,7 @@ pytype(value object_ocaml) + else if (ob_type == Python_PySet_Type) { + result = Set; + } +- else if (typeobj->tp_iternext != NULL && +- typeobj->tp_iternext != &Python27__PyObject_NextNotImplemented) { ++ else if (is_iterable(object)) { + result = Iter; + } + else { diff --git a/srcpkgs/coccinelle/template b/srcpkgs/coccinelle/template index c63fa20be18..b7460aa93f2 100644 --- a/srcpkgs/coccinelle/template +++ b/srcpkgs/coccinelle/template @@ -1,29 +1,39 @@ # Template file for 'coccinelle' pkgname=coccinelle -version=1.1.1p20240218 +version=1.3 revision=1 -_gitrev=68c580f1f1abf9979d591371e5b2e474f97dac90 build_style=gnu-configure configure_args="--without-pdflatex --enable-release --with-python=/usr/bin/python3" hostmakedepends="python3 automake libtool ocaml" makedepends="ocaml ocaml-findlib ocaml-num ocaml-stdcompat pcre-devel python3-devel" +checkdepends="python3" short_desc="Program matching and transformation engine" maintainer="Đoàn Trần Công Danh " license="GPL-2.0-only" homepage="https://coccinelle.gitlabpages.inria.fr/website/" -distfiles="https://github.com/coccinelle/coccinelle/archive/${_gitrev}.tar.gz" -checksum=bdda73a6827d1c2e5f85bafa25a0d03810298c0653ebd40a1eceaf6ca2cd72c0 +# distfiles="https://github.com/coccinelle/coccinelle/archive/${_gitrev}.tar.gz" +_stdcompat=13aef7a2221d32493fc141e68ed6ba4a35288699 +distfiles="https://coccinelle.gitlabpages.inria.fr/website/distrib/coccinelle-${version}.tar.gz + https://github.com/thierry-martinez/stdcompat/archive/${_stdcompat}.tar.gz" +checksum="d214410c502951bb30b86f46ecd51c02ba5cfbcb2c1eee7268428a162b18f985 + 6cb788ec6f274fd8ac060801557123018cb6695855e8fd27117c5cc681d40ed7" disable_parallel_build=yes nocross=yes make_check=ci-skip # broken out of the box +skip_extraction="${_stdcompat}.tar.gz" case "$XBPS_TARGET_MACHINE" in x86_64*|aarch64*|riscv64*) ;; *) broken="bundled mehir wants ocamlopt";; esac +post_extract() { + rm -rf bundles/stdcompat/stdcompat-current + vsrcextract -C bundles/stdcompat/stdcompat-current "${_stdcompat}.tar.gz" +} + pre_configure() { autoreconf -fi } diff --git a/srcpkgs/python3/template b/srcpkgs/python3/template index be4added325..b4f2829f001 100644 --- a/srcpkgs/python3/template +++ b/srcpkgs/python3/template @@ -1,6 +1,8 @@ # Template file for 'python3' # # THIS PACKAGE MUST BE SYNCHRONIZED WITH "srcpkgs/python3-tkinter". +# Also rebuild those packages on minor version update: +# - coccinelle # pkgname=python3 version=3.13.1