From cbc6f38774ca2eb4eeb79b55078d77f2de7d0225 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Wed, 8 May 2013 20:09:54 +0900 Subject: [PATCH] fix build problem of ssl modulle of CPython 3.0.1 --- .../Python-3.0.1/001_patch-svnversion.patch | 42 +++++++++++ .../Python-3.0.1/002_openssl_no_ssl2.patch | 75 +++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 plugins/python-build/patches/3.0.1/Python-3.0.1/001_patch-svnversion.patch create mode 100644 plugins/python-build/patches/3.0.1/Python-3.0.1/002_openssl_no_ssl2.patch diff --git a/plugins/python-build/patches/3.0.1/Python-3.0.1/001_patch-svnversion.patch b/plugins/python-build/patches/3.0.1/Python-3.0.1/001_patch-svnversion.patch new file mode 100644 index 00000000..5ee39e92 --- /dev/null +++ b/plugins/python-build/patches/3.0.1/Python-3.0.1/001_patch-svnversion.patch @@ -0,0 +1,42 @@ +--- configure.in ++++ configure.in +@@ -767,7 +767,7 @@ + then + SVNVERSION="svnversion \$(srcdir)" + else +- SVNVERSION="echo exported" ++ SVNVERSION="echo Unversioned directory" + fi + + case $MACHDEP in +--- Makefile.pre.in ++++ Makefile.pre.in +@@ -501,7 +501,7 @@ + $(SIGNAL_OBJS) \ + $(MODOBJS) \ + $(srcdir)/Modules/getbuildinfo.c +- $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c ++ $(CC) -c $(PY_CFLAGS) -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" -o $@ $(srcdir)/Modules/getbuildinfo.c + + Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile + $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \ +--- Modules/getbuildinfo.c ++++ Modules/getbuildinfo.c +@@ -48,5 +48,5 @@ + static const char svnversion[] = SVNVERSION; + if (svnversion[0] != '$') + return svnversion; /* it was interpolated, or passed on command line */ +- return "exported"; ++ return "Unversioned directory"; + } +--- Python/sysmodule.c ++++ Python/sysmodule.c +@@ -1161,7 +1161,7 @@ + + + svnversion = _Py_svnversion(); +- if (strcmp(svnversion, "exported") != 0) ++ if (strcmp(svnversion, "Unversioned directory") != 0 && strcmp(svnversion, "exported") != 0) + svn_revision = svnversion; + else if (istag) { + len = strlen(_patchlevel_revision); diff --git a/plugins/python-build/patches/3.0.1/Python-3.0.1/002_openssl_no_ssl2.patch b/plugins/python-build/patches/3.0.1/Python-3.0.1/002_openssl_no_ssl2.patch new file mode 100644 index 00000000..eb5f44ba --- /dev/null +++ b/plugins/python-build/patches/3.0.1/Python-3.0.1/002_openssl_no_ssl2.patch @@ -0,0 +1,75 @@ +diff -r -u ./Lib/ssl.py ../Python-3.0.1/Lib/ssl.py +--- ./Lib/ssl.py 2009-01-04 08:47:58.000000000 +0900 ++++ ../Python-3.0.1/Lib/ssl.py 2013-05-08 19:58:59.000000000 +0900 +@@ -60,8 +60,20 @@ + + from _ssl import SSLError + from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED +-from _ssl import (PROTOCOL_SSLv2, PROTOCOL_SSLv3, PROTOCOL_SSLv23, ++from _ssl import (PROTOCOL_SSLv3, PROTOCOL_SSLv23, + PROTOCOL_TLSv1) ++_PROTOCOL_NAMES = { ++ PROTOCOL_TLSv1: "TLSv1", ++ PROTOCOL_SSLv23: "SSLv23", ++ PROTOCOL_SSLv3: "SSLv3", ++} ++try: ++ from _ssl import PROTOCOL_SSLv2 ++ _SSLv2_IF_EXISTS = PROTOCOL_SSLv2 ++except ImportError: ++ _SSLv2_IF_EXISTS = None ++else: ++ _PROTOCOL_NAMES[PROTOCOL_SSLv2] = "SSLv2" + from _ssl import RAND_status, RAND_egd, RAND_add + from _ssl import ( + SSL_ERROR_ZERO_RETURN, +@@ -434,13 +446,4 @@ + return DER_cert_to_PEM_cert(dercert) + + def get_protocol_name(protocol_code): +- if protocol_code == PROTOCOL_TLSv1: +- return "TLSv1" +- elif protocol_code == PROTOCOL_SSLv23: +- return "SSLv23" +- elif protocol_code == PROTOCOL_SSLv2: +- return "SSLv2" +- elif protocol_code == PROTOCOL_SSLv3: +- return "SSLv3" +- else: +- return "" ++ return _PROTOCOL_NAMES.get(protocol_code, '') +diff -r -u ./Modules/_ssl.c ../Python-3.0.1/Modules/_ssl.c +--- ./Modules/_ssl.c 2009-02-03 05:41:29.000000000 +0900 ++++ ../Python-3.0.1/Modules/_ssl.c 2013-05-08 19:57:38.000000000 +0900 +@@ -62,7 +62,9 @@ + }; + + enum py_ssl_version { ++#ifndef OPENSSL_NO_SSL2 + PY_SSL_VERSION_SSL2, ++#endif + PY_SSL_VERSION_SSL3, + PY_SSL_VERSION_SSL23, + PY_SSL_VERSION_TLS1, +@@ -299,8 +301,10 @@ + self->ctx = SSL_CTX_new(TLSv1_method()); /* Set up context */ + else if (proto_version == PY_SSL_VERSION_SSL3) + self->ctx = SSL_CTX_new(SSLv3_method()); /* Set up context */ ++#ifndef OPENSSL_NO_SSL2 + else if (proto_version == PY_SSL_VERSION_SSL2) + self->ctx = SSL_CTX_new(SSLv2_method()); /* Set up context */ ++#endif + else if (proto_version == PY_SSL_VERSION_SSL23) + self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ + PySSL_END_ALLOW_THREADS +@@ -1691,8 +1695,10 @@ + PY_SSL_CERT_REQUIRED); + + /* protocol versions */ ++#ifndef OPENSSL_NO_SSL2 + PyModule_AddIntConstant(m, "PROTOCOL_SSLv2", + PY_SSL_VERSION_SSL2); ++#endif + PyModule_AddIntConstant(m, "PROTOCOL_SSLv3", + PY_SSL_VERSION_SSL3); + PyModule_AddIntConstant(m, "PROTOCOL_SSLv23",