From 9ceab79a2c4dfd26552254ac8311867e76c6195a5a5585a4801a342f09e8af05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Mon, 23 Apr 2012 09:17:47 +0000 Subject: [PATCH] capsule-api.diff OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=199 --- python-capsule-api.diff | 43 +++++++++++++++++++++++++++++++++++++++++ python3-rpm.spec | 1 + rpm-python.changes | 11 +++++++++++ rpm-python.spec | 1 + rpm.spec | 4 +++- 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 python-capsule-api.diff diff --git a/python-capsule-api.diff b/python-capsule-api.diff new file mode 100644 index 0000000..dd568d3 --- /dev/null +++ b/python-capsule-api.diff @@ -0,0 +1,43 @@ +--- python/header-py.c.orig 2012-04-23 09:13:33.000000000 +0000 ++++ python/header-py.c 2012-04-23 09:14:25.000000000 +0000 +@@ -368,8 +368,8 @@ static PyObject *hdr_new(PyTypeObject *s + + if (obj == NULL) { + h = headerNew(); +- } else if (PyCObject_Check(obj)) { +- h = PyCObject_AsVoidPtr(obj); ++ } else if (CAPSULE_CHECK(obj)) { ++ h = CAPSULE_EXTRACT(obj, "rpm._C_Header"); + } else if (hdrObject_Check(obj)) { + h = headerCopy(((hdrObject*) obj)->h); + } else if (PyBytes_Check(obj)) { +--- python/rpmsystem-py.h.orig 2012-04-23 09:12:49.000000000 +0000 ++++ python/rpmsystem-py.h 2012-04-23 09:13:19.000000000 +0000 +@@ -33,6 +33,16 @@ typedef Py_ssize_t (*lenfunc)(PyObject * + #define PyBytes_AsString PyString_AsString + #endif + ++#if ((PY_MAJOR_VERSION << 8) | (PY_MINOR_VERSION << 0)) >= 0x0207 ++#define CAPSULE_BUILD(ptr,name) PyCapsule_New(ptr, name, NULL) ++#define CAPSULE_CHECK(obj) PyCapsule_CheckExact(obj) ++#define CAPSULE_EXTRACT(obj,name) PyCapsule_GetPointer(obj, name) ++#else ++#define CAPSULE_BUILD(ptr,name) PyCObject_FromVoidPtr(ptr, NULL) ++#define CAPSULE_CHECK(obj) PyCObject_Check(obj) ++#define CAPSULE_EXTRACT(obj,name) PyCObject_AsVoidPtr(obj) ++#endif ++ + /* For Python 3, use the PyLong type throughout in place of PyInt */ + #if PY_MAJOR_VERSION >= 3 + #define PyInt_Check PyLong_Check +--- python/spec-py.c.orig 2012-04-23 09:13:41.000000000 +0000 ++++ python/spec-py.c 2012-04-23 09:14:56.000000000 +0000 +@@ -34,7 +34,7 @@ static PyObject *makeHeader(Header h) + PyObject *rpmmod = PyImport_ImportModuleNoBlock("rpm"); + if (rpmmod == NULL) return NULL; + +- PyObject *ptr = PyCObject_FromVoidPtr(h, NULL); ++ PyObject *ptr = CAPSULE_BUILD(h, "rpm._C_Header"); + PyObject *hdr = PyObject_CallMethod(rpmmod, "hdr", "(O)", ptr); + Py_XDECREF(ptr); + Py_XDECREF(rpmmod); diff --git a/python3-rpm.spec b/python3-rpm.spec index 25367fd..5b826aa 100644 --- a/python3-rpm.spec +++ b/python3-rpm.spec @@ -15,6 +15,7 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + Name: python3-rpm Version: 4.9.1.2 Release: 0 diff --git a/rpm-python.changes b/rpm-python.changes index 14132e7..206e887 100644 --- a/rpm-python.changes +++ b/rpm-python.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Apr 23 11:16:26 CEST 2012 - mls@suse.de + +- modified capsule api diff to match rpm upstream + +------------------------------------------------------------------- +Wed Apr 11 16:54:02 UTC 2012 - klaussfreire@gmail.com + +- Fix usage of deprecated AsVoidPtr Python/C API, + replaced by Capsule API + ------------------------------------------------------------------- Tue Jan 17 10:28:42 UTC 2012 - saschpe@suse.de diff --git a/rpm-python.spec b/rpm-python.spec index 51eb559..5af67c9 100644 --- a/rpm-python.spec +++ b/rpm-python.spec @@ -15,6 +15,7 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + Name: rpm-python Version: 4.9.1.2 Release: 0 diff --git a/rpm.spec b/rpm.spec index 8c594f2..b97f8ed 100644 --- a/rpm.spec +++ b/rpm.spec @@ -15,6 +15,7 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + Name: rpm BuildRequires: binutils BuildRequires: bzip2 @@ -142,6 +143,7 @@ Patch87: pythonhardlink.diff Patch88: helperenv.diff Patch89: instobscheck.diff Patch90: tilde.diff +Patch91: python-capsule-api.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build # # avoid bootstrapping problem @@ -214,7 +216,7 @@ rm -f rpmdb/db.h %patch -P 60 -P 61 -P 62 -P 63 -P 64 -P 65 -P 66 -P 67 -P 68 -P 69 %patch -P 70 -P 71 -P 72 -P 73 -P 74 -P 75 -P 76 -P 77 -P 78 -P 79 %patch -P 80 -P 81 -P 82 -P 83 -P 84 -P 85 -P 86 -P 87 -P 88 -P 89 -%patch -P 90 +%patch -P 90 -P 91 #chmod 755 scripts/find-supplements{,.ksyms} #chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms #chmod 755 scripts/firmware.prov