From 0de312e66c038a0ecbace9d5d57c8175f7b86410 Mon Sep 17 00:00:00 2001 From: Xavier Bachelot Date: Nov 27 2020 10:25:23 +0000 Subject: [PATCH 1/2] Update to 0.36.0 --- diff --git a/.gitignore b/.gitignore index 6292351..df2c5f3 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ M2Crypto-0.20.2.tar.gz /M2Crypto-0.32.0.tar.gz /M2Crypto-0.33.0.tar.gz /M2Crypto-0.35.2.tar.gz +/M2Crypto-0.36.0.tar.gz diff --git a/0001-base64.decodestring-was-finally-removed-in-Python-3..patch b/0001-base64.decodestring-was-finally-removed-in-Python-3..patch deleted file mode 100644 index bee4ee8..0000000 --- a/0001-base64.decodestring-was-finally-removed-in-Python-3..patch +++ /dev/null @@ -1,49 +0,0 @@ -From 7f98fca157b50708dd2c4848886e18a198e258c3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= -Date: Mon, 9 Mar 2020 13:16:53 +0100 -Subject: [PATCH] base64.decodestring() was finally removed in Python 3.8. - ---- - tests/test_x509.py | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/tests/test_x509.py b/tests/test_x509.py -index 057d7da..138af27 100644 ---- a/tests/test_x509.py -+++ b/tests/test_x509.py -@@ -15,7 +15,7 @@ import os - import time - import warnings - --from M2Crypto import ASN1, BIO, EVP, RSA, Rand, X509, m2 # noqa -+from M2Crypto import ASN1, BIO, EVP, RSA, Rand, X509, m2, six # noqa - from tests import unittest - - log = logging.getLogger(__name__) -@@ -592,7 +592,10 @@ class X509StackTestCase(unittest.TestCase): - - with warnings.catch_warnings(): - warnings.simplefilter('ignore', DeprecationWarning) -- seq = base64.decodestring(b64) -+ if six.PY3: -+ seq = base64.decodebytes(b64) -+ else: -+ seq = base64.decodestring(b64) - - stack = X509.new_stack_from_der(seq) - cert = stack.pop() -@@ -612,7 +615,10 @@ class X509StackTestCase(unittest.TestCase): - - with warnings.catch_warnings(): - warnings.simplefilter('ignore', DeprecationWarning) -- seq = base64.decodestring(b64) -+ if six.PY3: -+ seq = base64.decodebytes(b64) -+ else: -+ seq = base64.decodestring(b64) - - stack = X509.new_stack_from_der(seq) - num = len(stack) --- -2.26.2 - diff --git a/0001-wrap-SocketIO-in-io.Buffered-for-makefile.patch b/0001-wrap-SocketIO-in-io.Buffered-for-makefile.patch deleted file mode 100644 index 61fa914..0000000 --- a/0001-wrap-SocketIO-in-io.Buffered-for-makefile.patch +++ /dev/null @@ -1,47 +0,0 @@ -From d3a43ffe1bfe4c128d6ab7c390419dee68f4ca5a Mon Sep 17 00:00:00 2001 -From: lethliel -Date: Wed, 19 Feb 2020 11:53:05 +0100 -Subject: [PATCH] wrap SocketIO in io.Buffered* for makefile - -In python3.8 the fp is wrapped in a Buffer. -SSL.Connection.makefile returns a socketIO which is no buffer. - -SocketIO in 'r' mode: -use io.BufferedReader - -SocketIO in 'rw' mode: -use io.BufferedRWPair ---- - M2Crypto/SSL/Connection.py | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/M2Crypto/SSL/Connection.py b/M2Crypto/SSL/Connection.py -index 7053aa6..01bb61c 100644 ---- a/M2Crypto/SSL/Connection.py -+++ b/M2Crypto/SSL/Connection.py -@@ -12,6 +12,7 @@ Copyright 2008 Heikki Toivonen. All rights reserved. - - import logging - import socket -+import io - - from M2Crypto import BIO, Err, X509, m2, py27plus, six, util # noqa - from M2Crypto.SSL import Checker, Context, timeout # noqa -@@ -582,9 +583,12 @@ class Connection(object): - return m2.ssl_set_cipher_list(self.ssl, cipher_list) - - def makefile(self, mode='rb', bufsize=-1): -- # type: (AnyStr, int) -> socket._fileobject -+ # type: (AnyStr, int) -> Union[io.BufferedRWPair,io.BufferedReader] - if six.PY3: -- return socket.SocketIO(self, mode) -+ raw = socket.SocketIO(self, mode) -+ if 'rw' in mode: -+ return io.BufferedRWPair(raw, raw) -+ return io.BufferedReader(raw, io.DEFAULT_BUFFER_SIZE) - else: - return socket._fileobject(self, mode, bufsize) - --- -2.26.1 - diff --git a/m2crypto.spec b/m2crypto.spec index cfb59e4..c9670fc 100644 --- a/m2crypto.spec +++ b/m2crypto.spec @@ -2,20 +2,14 @@ %{?python_enable_dependency_generator} Name: m2crypto -Version: 0.35.2 -Release: 9%{?dist} +Version: 0.36.0 +Release: 1%{?dist} Summary: Support for using OpenSSL in Python scripts License: MIT URL: https://gitlab.com/m2crypto/m2crypto/ Source0: %{pypi_source M2Crypto} -# Backport from upstream -## From: https://gitlab.com/m2crypto/m2crypto/-/commit/d3a43ffe1bfe4c128d6ab7c390419dee68f4ca5a -Patch0001: 0001-wrap-SocketIO-in-io.Buffered-for-makefile.patch -## From: https://gitlab.com/m2crypto/m2crypto/-/commit/7f98fca157b50708dd2c4848886e18a198e258c3 -Patch0002: 0001-base64.decodestring-was-finally-removed-in-Python-3..patch - BuildRequires: gcc BuildRequires: openssl BuildRequires: openssl-devel @@ -67,6 +61,9 @@ fi %{python3_sitearch}/M2Crypto-*.egg-info/ %changelog +* Thu Nov 26 2020 Xavier Bachelot - 0.36.0-1 +- Update to 0.36.0 + * Tue Jul 28 2020 Fedora Release Engineering - 0.35.2-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild diff --git a/sources b/sources index 8a253f2..6d4cce7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (M2Crypto-0.35.2.tar.gz) = 3608b29a8e7d0732a2359e35fcaae191447aa7c0211ca3d057eed6cee7f0819f5c1121e7d41caca8cdea3c7911f8c447ee475b1b3d125e8dc3adde2718a59f36 +SHA512 (M2Crypto-0.36.0.tar.gz) = 5b7d6d10c943ff0e09e0e9748d5578e7e0f7659a73de4ba49481152bca05871aef2bfbb869e1636a7cebcf2dd8b9f67fb0d299a833d1d4ebd538031c35d7bca1 From ee00dc12e05b9466d2b70ebda5e3a00059e392dd Mon Sep 17 00:00:00 2001 From: Xavier Bachelot Date: Nov 27 2020 10:25:23 +0000 Subject: [PATCH 2/2] Fix use of mixed tabs/spaces --- diff --git a/m2crypto.spec b/m2crypto.spec index c9670fc..4e5c889 100644 --- a/m2crypto.spec +++ b/m2crypto.spec @@ -36,8 +36,8 @@ This package allows you to call OpenSSL functions from Python 3 scripts. %build %set_build_flags if pkg-config openssl ; then - CFLAGS="$CFLAGS `pkg-config --cflags openssl`" ; export CFLAGS - LDFLAGS="$LDFLAGS`pkg-config --libs-only-L openssl`" ; export LDFLAGS + CFLAGS="$CFLAGS `pkg-config --cflags openssl`" ; export CFLAGS + LDFLAGS="$LDFLAGS`pkg-config --libs-only-L openssl`" ; export LDFLAGS fi %py3_build @@ -45,8 +45,8 @@ fi %install %set_build_flags if pkg-config openssl ; then - CFLAGS="$CFLAGS `pkg-config --cflags openssl`" ; export CFLAGS - LDFLAGS="$LDFLAGS`pkg-config --libs-only-L openssl`" ; export LDFLAGS + CFLAGS="$CFLAGS `pkg-config --cflags openssl`" ; export CFLAGS + LDFLAGS="$LDFLAGS`pkg-config --libs-only-L openssl`" ; export LDFLAGS fi %py3_install