SHA256
3
0
forked from pool/rpm

capsule-api.diff

OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=199
This commit is contained in:
Michael Schröder 2012-04-23 09:17:47 +00:00 committed by Git OBS Bridge
parent 0204532bd5
commit 9ceab79a2c
5 changed files with 59 additions and 1 deletions

43
python-capsule-api.diff Normal file
View File

@ -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);

View File

@ -15,6 +15,7 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
Name: python3-rpm Name: python3-rpm
Version: 4.9.1.2 Version: 4.9.1.2
Release: 0 Release: 0

View File

@ -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 Tue Jan 17 10:28:42 UTC 2012 - saschpe@suse.de

View File

@ -15,6 +15,7 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
Name: rpm-python Name: rpm-python
Version: 4.9.1.2 Version: 4.9.1.2
Release: 0 Release: 0

View File

@ -15,6 +15,7 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
Name: rpm Name: rpm
BuildRequires: binutils BuildRequires: binutils
BuildRequires: bzip2 BuildRequires: bzip2
@ -142,6 +143,7 @@ Patch87: pythonhardlink.diff
Patch88: helperenv.diff Patch88: helperenv.diff
Patch89: instobscheck.diff Patch89: instobscheck.diff
Patch90: tilde.diff Patch90: tilde.diff
Patch91: python-capsule-api.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
# #
# avoid bootstrapping problem # 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 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 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 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-supplements{,.ksyms}
#chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms #chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms
#chmod 755 scripts/firmware.prov #chmod 755 scripts/firmware.prov