createrepo-c: Fix createrepo-c-native build on GCC14 hosts (e.g. Fedora 41)

This version of createrepo-c does a wrong pointer assignment, and on GCC14[0]
hosts (e.g. Fedora 41), this fails to build with:
  FAILED: src/python/CMakeFiles/_createrepo_c.dir/createrepo_cmodule.c.o
  build/tmp-glibc/hosttools/gcc [...] python/createrepo_cmodule.c
  python/createrepo_cmodule.c:82:41: error: initialization of ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} from incompatible pointer type ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} [-Wincompatible-pointer-types]
     82 |     {"xml_parse_main_metadata_together",(PyCFunctionWithKeywords)py_xml_parse_main_metadata_together,
        |                                         ^
  src/python/createrepo_cmodule.c:82:41: note: (near initialization for ‘createrepo_c_methods[15].ml_meth’)

Add a patch to fix the pointer assignment. The patched code has since
been removed by upstream.

[0]: https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types

(From OE-Core rev: 17b1a1cd097c2bd6d690a3cd44561c2d40844088)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Paul Barker <paul@pbarker.dev>
This commit is contained in:
Yoann Congal 2026-03-15 23:46:32 +01:00 committed by Paul Barker
parent 3a4d4d66ba
commit 1aee6e9648
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,41 @@
From d2dd32bcdcc717a0da48d5e983c4396ccc79fc9c Mon Sep 17 00:00:00 2001
From: Yoann Congal <yoann.congal@smile.fr>
Date: Sun, 15 Mar 2026 23:25:16 +0100
Subject: [PATCH] Use proper cast for PyMethodDef.ml_meth
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
PyMethodDef.ml_meth is of PyCFunction type. Using a
PyCFunctionWithKeywords cast for its initializer trigger build failure
with GCC >=14 [0]:
| FAILED: src/python/CMakeFiles/_createrepo_c.dir/createrepo_cmodule.c.o
| build/tmp-glibc/hosttools/gcc [...] python/createrepo_cmodule.c
| python/createrepo_cmodule.c:82:41: error: initialization of PyObject * (*)(PyObject *, PyObject *) {aka struct _object * (*)(struct _object *, struct _object *)} from incompatible pointer type PyObject * (*)(PyObject *, PyObject *, PyObject *) {aka struct _object * (*)(struct _object *, struct _object *, struct _object *)} [-Wincompatible-pointer-types]
| 82 | {"xml_parse_main_metadata_together",(PyCFunctionWithKeywords)py_xml_parse_main_metadata_together,
| | ^
| src/python/createrepo_cmodule.c:82:41: note: (near initialization for createrepo_c_methods[15].ml_meth)
Fix this by using the proper (PyCFunction) cast.
[0]: https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
Upstream-Status: Inappropriate [Upstream removed the patched code in 7092ab2 (Remove python bindings for xml_parse_main_metadata_together, 2022-03-17)]
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
src/python/createrepo_cmodule.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/python/createrepo_cmodule.c b/src/python/createrepo_cmodule.c
index c0b9200..94a206d 100644
--- a/src/python/createrepo_cmodule.c
+++ b/src/python/createrepo_cmodule.c
@@ -79,7 +79,7 @@ static struct PyMethodDef createrepo_c_methods[] = {
METH_VARARGS, xml_parse_repomd__doc__},
{"xml_parse_updateinfo", (PyCFunction)py_xml_parse_updateinfo,
METH_VARARGS, xml_parse_updateinfo__doc__},
- {"xml_parse_main_metadata_together",(PyCFunctionWithKeywords)py_xml_parse_main_metadata_together,
+ {"xml_parse_main_metadata_together",(PyCFunction)py_xml_parse_main_metadata_together,
METH_VARARGS | METH_KEYWORDS, xml_parse_main_metadata_together__doc__},
{"checksum_name_str", (PyCFunction)py_checksum_name_str,
METH_VARARGS, checksum_name_str__doc__},

View File

@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRC_URI = "git://github.com/rpm-software-management/createrepo_c;branch=master;protocol=https \
file://0001-Do-not-set-PYTHON_INSTALL_DIR-by-running-python.patch \
file://0001-Use-proper-cast-for-PyMethodDef.ml_meth.patch \
"
SRCREV = "a531ee881a8f1d9273b4383fb9fa604c56fff138"