[python26-m2crypto/el5/master: 74/78] Update to m2crypto-0.21.1

gholms gholms at fedoraproject.org
Wed Feb 23 00:31:41 UTC 2011


commit a1fdfc49550133d3277961b567ea3f018b2b5d33
Author: Miloslav Trmač <mitr at redhat.com>
Date:   Wed Jan 19 21:08:05 2011 +0100

    Update to m2crypto-0.21.1
    
    * Tue Jan 18 2011 Miloslav Trmač <mitr at redhat.com> - 0.21.1-1
    - Update to m2crypto-0.21.1
    - Make the test suite pass with Python 2.7

 .gitignore                                         |    1 +
 m2crypto-0.20-gcc_macros.patch                     |   11 -
 m2crypto-0.20.1-openssl1.patch                     |  531 --------------------
 m2crypto-0.20.2-testsuite.patch                    |   56 --
 m2crypto-0.20.2-threads.patch                      |  255 ----------
 m2crypto-0.21.1-gcc_macros.patch                   |   11 +
 m2crypto-0.21.1-memoryview.patch                   |  156 ++++++
 ...imeouts.patch => m2crypto-0.21.1-timeouts.patch |    2 +-
 m2crypto.spec                                      |   32 +-
 sources                                            |    2 +-
 10 files changed, 185 insertions(+), 872 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9c26e9b..f0208b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 M2Crypto-0.20.2.tar.gz
+/M2Crypto-0.21.1.tar.gz
diff --git a/m2crypto-0.21.1-gcc_macros.patch b/m2crypto-0.21.1-gcc_macros.patch
new file mode 100644
index 0000000..61dbbe6
--- /dev/null
+++ b/m2crypto-0.21.1-gcc_macros.patch
@@ -0,0 +1,11 @@
+diff -urN M2Crypto/SWIG/_m2crypto.i M2Crypto-0.21.1/SWIG/_m2crypto.i
+--- M2Crypto/SWIG/_m2crypto.i	2011-01-15 20:10:06.000000000 +0100
++++ M2Crypto-0.21.1/SWIG/_m2crypto.i	2011-01-18 15:37:33.948994579 +0100
+@@ -7,6 +7,7 @@
+  * Copyright (c) 2009-2010 Heikki Toivonen. All rights reserved.
+  *
+  */
++%import "gcc_macros.h"
+ 
+ %module(threads=1) _m2crypto
+ /* We really don't need threadblock (PyGILState_Ensure() etc.) anywhere.
diff --git a/m2crypto-0.21.1-memoryview.patch b/m2crypto-0.21.1-memoryview.patch
new file mode 100644
index 0000000..7d29e8e
--- /dev/null
+++ b/m2crypto-0.21.1-memoryview.patch
@@ -0,0 +1,156 @@
+diff -ur M2Crypto-0.21.1/SWIG/_lib.h M2Crypto/SWIG/_lib.h
+--- M2Crypto-0.21.1/SWIG/_lib.h	2011-01-15 20:10:06.000000000 +0100
++++ M2Crypto/SWIG/_lib.h	2011-01-19 19:56:37.622364336 +0100
+@@ -7,6 +7,18 @@
+ #define PY_SSIZE_T_MIN INT_MIN
+ #endif
+ 
++#if PY_VERSION_HEX < 0x02060000
++struct Py_buffer /* Only a subset */
++{
++  void *buf;
++  Py_ssize_t len;
++};
++
++#define PyBUF_CONTIG_RO 0
++static int PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
++static void PyBuffer_Release(Py_buffer *view);
++#endif /* PY_VERSION_HEX < 0x02060000 */
++
+ typedef struct _blob {
+ 	unsigned char *data;
+ 	int len;
+@@ -18,6 +30,7 @@
+ 
+ static int m2_PyObject_AsReadBufferInt(PyObject *obj, const void **buffer,
+                                        int *buffer_len);
++static int m2_PyObject_GetBufferInt(PyObject *obj, Py_buffer *view, int flags);
+ static int m2_PyString_AsStringAndSizeInt(PyObject *obj, char **s, int *len);
+ 
+ void gen_callback(int p, int n, void *arg);
+diff -ur M2Crypto-0.21.1/SWIG/_lib.i M2Crypto/SWIG/_lib.i
+--- M2Crypto-0.21.1/SWIG/_lib.i	2011-01-15 20:10:06.000000000 +0100
++++ M2Crypto/SWIG/_lib.i	2011-01-19 19:49:21.537145465 +0100
+@@ -47,9 +47,34 @@
+ /* Python helpers. */
+ 
+ %}
++%ignore PyObject_GetBuffer;
++%ignore PyBuffer_Release;
+ %ignore m2_PyObject_AsReadBufferInt;
++%ignore m2_PyObject_GetBufferInt;
+ %ignore m2_PyString_AsStringAndSizeInt;
+ %{
++
++#if PY_VERSION_HEX < 0x02060000
++static int
++PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags)
++{
++    const void *buf;
++    int ret;
++
++    (void)flags;
++
++    ret = PyObject_AsReadBuffer(obj, &buf, &view->len);
++    if (ret == 0)
++	view->buf = (void *)buf;
++    return ret;
++}
++
++static void PyBuffer_Release(Py_buffer *view)
++{
++    (void)view;
++}
++#endif /* PY_VERSION_HEX < 0x02060000 */
++
+ static int
+ m2_PyObject_AsReadBufferInt(PyObject *obj, const void **buffer,
+                 int *buffer_len)
+@@ -69,6 +94,22 @@
+ }
+ 
+ static int
++m2_PyObject_GetBufferInt(PyObject *obj, Py_buffer *view, int flags)
++{
++    int ret;
++
++    ret = PyObject_GetBuffer(obj, view, flags);
++    if (ret)
++	return ret;
++    if (view->len > INT_MAX) {
++        PyErr_SetString(PyExc_ValueError, "object too large");
++	PyBuffer_Release(view);
++        return -1;
++    }
++    return 0;
++}
++
++static int
+ m2_PyString_AsStringAndSizeInt(PyObject *obj, char **s, int *len)
+ {
+     int ret;
+diff -ur M2Crypto-0.21.1/SWIG/_ssl.i M2Crypto/SWIG/_ssl.i
+--- M2Crypto-0.21.1/SWIG/_ssl.i	2011-01-19 19:06:57.940560864 +0100
++++ M2Crypto/SWIG/_ssl.i	2011-01-19 19:56:51.957338576 +0100
+@@ -700,12 +700,12 @@
+ }
+ 
+ int ssl_write(SSL *ssl, PyObject *blob, double timeout) {
+-    const void *buf;
+-    int len, r, ssl_err, ret;
++    Py_buffer buf;
++    int r, ssl_err, ret;
+     struct timeval tv;
+ 
+ 
+-    if (m2_PyObject_AsReadBufferInt(blob, &buf, &len) == -1) {
++    if (m2_PyObject_GetBufferInt(blob, &buf, PyBUF_CONTIG_RO) == -1) {
+         return -1;
+     }
+ 
+@@ -713,7 +713,7 @@
+         gettimeofday(&tv, NULL);
+  again:
+     Py_BEGIN_ALLOW_THREADS
+-    r = SSL_write(ssl, buf, len);
++    r = SSL_write(ssl, buf.buf, buf.len);
+     ssl_err = SSL_get_error(ssl, r);
+     Py_END_ALLOW_THREADS
+ 
+@@ -741,22 +741,22 @@
+             ret = -1;
+     }
+     
+-    
++    PyBuffer_Release(&buf);
+     return ret;
+ }
+ 
+ int ssl_write_nbio(SSL *ssl, PyObject *blob) {
+-    const void *buf;
+-    int len, r, err, ret;
++    Py_buffer buf;
++    int r, err, ret;
+ 
+ 
+-    if (m2_PyObject_AsReadBufferInt(blob, &buf, &len) == -1) {
++    if (m2_PyObject_GetBufferInt(blob, &buf, PyBUF_CONTIG_RO) == -1) {
+         return -1;
+     }
+ 
+     
+     Py_BEGIN_ALLOW_THREADS
+-    r = SSL_write(ssl, buf, len);
++    r = SSL_write(ssl, buf.buf, buf.len);
+     Py_END_ALLOW_THREADS
+     
+     
+@@ -785,7 +785,7 @@
+             ret = -1;
+     }
+     
+-    
++    PyBuffer_Release(&buf);
+     return ret;
+ }
+ 
diff --git a/m2crypto-0.18-timeouts.patch b/m2crypto-0.21.1-timeouts.patch
similarity index 99%
rename from m2crypto-0.18-timeouts.patch
rename to m2crypto-0.21.1-timeouts.patch
index f42a8c9..374e76c 100644
--- a/m2crypto-0.18-timeouts.patch
+++ b/m2crypto-0.21.1-timeouts.patch
@@ -267,7 +267,7 @@ diff -ur m2crypto-0.18/SWIG/_ssl.i m2crypto/SWIG/_ssl.i
 +    return 0;
 +
 + timeout:
-+    PyErr_SetNone(_ssl_timeout_err);
++    PyErr_SetString(_ssl_timeout_err, "timed out");
 +    return -1;
 +}
 +
diff --git a/m2crypto.spec b/m2crypto.spec
index e71045b..97dce46 100644
--- a/m2crypto.spec
+++ b/m2crypto.spec
@@ -5,23 +5,19 @@
 
 Summary: Support for using OpenSSL in python scripts
 Name: m2crypto
-Version: 0.20.2
-Release: 9%{?dist}
+Version: 0.21.1
+Release: 1%{?dist}
 Source0: http://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-%{version}.tar.gz
 # https://bugzilla.osafoundation.org/show_bug.cgi?id=2341
-Patch0: m2crypto-0.18-timeouts.patch
+Patch0: m2crypto-0.21.1-timeouts.patch
 # This is only precautionary, it does fix anything - not sent upstream
-Patch1: m2crypto-0.20-gcc_macros.patch
-# https://bugzilla.osafoundation.org/show_bug.cgi?id=12855
-Patch2: m2crypto-0.20.1-openssl1.patch
-# https://bugzilla.osafoundation.org/show_bug.cgi?id=12935
-Patch3: m2crypto-0.20.2-threads.patch
-# https://bugzilla.osafoundation.org/show_bug.cgi?id=12936
-Patch4: m2crypto-0.20.2-testsuite.patch
+Patch1: m2crypto-0.21.1-gcc_macros.patch
 # https://bugzilla.osafoundation.org/show_bug.cgi?id=12972
-Patch5: m2crypto-0.20.2-fips.patch
+Patch2: m2crypto-0.20.2-fips.patch
 # https://bugzilla.osafoundation.org/show_bug.cgi?id=12973
-Patch6: m2crypto-0.20.2-check.patch
+Patch3: m2crypto-0.20.2-check.patch
+# https://bugzilla.osafoundation.org/show_bug.cgi?id=13005
+Patch4: m2crypto-0.21.1-memoryview.patch
 License: MIT
 Group: System Environment/Libraries
 URL: http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto
@@ -38,11 +34,9 @@ This package allows you to call OpenSSL functions from python scripts.
 %setup -q -n M2Crypto-%{version}
 %patch0 -p1 -b .timeouts
 %patch1 -p1 -b .gcc_macros
-%patch2 -p0 -b .openssl1
-%patch3 -p1 -b .threads
-%patch4 -p0 -b .testsuite
-%patch5 -p1 -b .fips
-%patch6 -p1 -b .check
+%patch2 -p1 -b .fips
+%patch3 -p1 -b .check
+%patch4 -p1 -b .memoryview
 
 # Red Hat opensslconf.h #includes an architecture-specific file, but SWIG
 # doesn't follow the #include.
@@ -109,6 +103,10 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitearch}/M2Crypto-*.egg-info
 
 %changelog
+* Tue Jan 18 2011 Miloslav Trmač <mitr at redhat.com> - 0.21.1-1
+- Update to m2crypto-0.21.1
+- Make the test suite pass with Python 2.7
+
 * Wed Jul 21 2010 David Malcolm <dmalcolm at redhat.com> - 0.20.2-9
 - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
 
diff --git a/sources b/sources
index 50f1d3e..68f12aa 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-6c24410410d6eb1920ea43f77a93613a  M2Crypto-0.20.2.tar.gz
+f93d8462ff7646397a9f77a2fe602d17  M2Crypto-0.21.1.tar.gz


More information about the scm-commits mailing list