public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Julian Ospald" <hasufell@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pypy3/, dev-python/pypy3/files/
Date: Tue, 13 Oct 2015 17:03:36 +0000 (UTC)	[thread overview]
Message-ID: <1444755717.0edfac4a30fb6b007940e336cbfd4aad57a9910e.hasufell@gentoo> (raw)

commit:     0edfac4a30fb6b007940e336cbfd4aad57a9910e
Author:     Julian Ospald <hasufell <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 12 20:39:16 2015 +0000
Commit:     Julian Ospald <hasufell <AT> gentoo <DOT> org>
CommitDate: Tue Oct 13 17:01:57 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0edfac4a

dev-python/pypy3: add libressl support

 dev-python/pypy3/files/pypy3-2.4.0-libressl.patch | 187 ++++++++++++++++++++++
 dev-python/pypy3/pypy3-2.4.0.ebuild               |   6 +-
 2 files changed, 191 insertions(+), 2 deletions(-)

diff --git a/dev-python/pypy3/files/pypy3-2.4.0-libressl.patch b/dev-python/pypy3/files/pypy3-2.4.0-libressl.patch
new file mode 100644
index 0000000..5852939
--- /dev/null
+++ b/dev-python/pypy3/files/pypy3-2.4.0-libressl.patch
@@ -0,0 +1,187 @@
+From 66bef80988c9efe60b61c6bc05f3206b4c3df7e8 Mon Sep 17 00:00:00 2001
+From: hasufell <hasufell@gentoo.org>
+Date: Mon, 12 Oct 2015 20:43:50 +0200
+Subject: [PATCH] Add LibreSSL support, patches backported from upstream
+
+https://bitbucket.org/pypy/pypy/pull-requests/333/deal-with-platforms-without-rand_egd-take/diff
+---
+ pypy/module/_ssl/interp_ssl.py                 | 34 +++++++++++++++-----------
+ pypy/module/_ssl/test/test_ssl.py              |  8 +++---
+ rpython/rlib/ropenssl.py                       |  6 ++++-
+ rpython/rtyper/tool/rffi_platform.py           | 12 ++++++---
+ rpython/rtyper/tool/test/test_rffi_platform.py | 24 +++++++++++++++++-
+ 5 files changed, 61 insertions(+), 23 deletions(-)
+
+diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
+index 0cac165..f210167 100644
+--- a/pypy/module/_ssl/interp_ssl.py
++++ b/pypy/module/_ssl/interp_ssl.py
+@@ -310,20 +310,26 @@ if HAVE_OPENSSL_RAND:
+         res = libssl_RAND_status()
+         return space.wrap(res)
+ 
+-    @unwrap_spec(path=str)
+-    def RAND_egd(space, path):
+-        """RAND_egd(path) -> bytes
+-
+-        Queries the entropy gather daemon (EGD) on socket path.  Returns number
+-        of bytes read.  Raises socket.sslerror if connection to EGD fails or
+-        if it does provide enough data to seed PRNG."""
+-        with rffi.scoped_str2charp(path) as socket_path:
+-            bytes = libssl_RAND_egd(socket_path)
+-        if bytes == -1:
+-            raise ssl_error(space,
+-                            "EGD connection failed or EGD did not return "
+-                            "enough data to seed the PRNG")
+-        return space.wrap(bytes)
++    if HAVE_OPENSSL_RAND_EGD:
++        @unwrap_spec(path=str)
++        def RAND_egd(space, path):
++            """RAND_egd(path) -> bytes
++
++            Queries the entropy gather daemon (EGD) on socket path.  Returns number
++            of bytes read.  Raises socket.sslerror if connection to EGD fails or
++            if it does provide enough data to seed PRNG."""
++            with rffi.scoped_str2charp(path) as socket_path:
++                bytes = libssl_RAND_egd(socket_path)
++            if bytes == -1:
++                raise ssl_error(space,
++                                "EGD connection failed or EGD did not return "
++                                "enough data to seed the PRNG")
++            return space.wrap(bytes)
++    else:
++        # Dummy func for platforms missing RAND_egd(). Most likely LibreSSL.
++        @unwrap_spec(path=str)
++        def RAND_egd(space, path):
++            raise ssl_error(space, "RAND_egd unavailable")
+ 
+ 
+ class SSLSocket(W_Root):
+diff --git a/pypy/module/_ssl/test/test_ssl.py b/pypy/module/_ssl/test/test_ssl.py
+index 3204610..9722fd5 100644
+--- a/pypy/module/_ssl/test/test_ssl.py
++++ b/pypy/module/_ssl/test/test_ssl.py
+@@ -33,7 +33,8 @@ class AppTestSSL:
+         assert isinstance(_ssl.OPENSSL_VERSION_INFO, tuple)
+         assert len(_ssl.OPENSSL_VERSION_INFO) == 5
+         assert isinstance(_ssl.OPENSSL_VERSION, str)
+-        assert 'openssl' in _ssl.OPENSSL_VERSION.lower()
++        lower_version = _ssl.OPENSSL_VERSION.lower()
++        assert 'openssl' in lower_version or "libressl" in lower_version
+ 
+     def test_RAND_add(self):
+         import _ssl
+@@ -64,8 +65,9 @@ class AppTestSSL:
+ 
+     def test_sslwrap(self):
+         import ssl, _socket, sys, gc
+-        if sys.platform == 'darwin' or 'freebsd' in sys.platform:
+-            skip("hangs indefinitely on OSX & FreeBSD (also on CPython)")
++        if sys.platform == 'darwin' or 'freebsd' in sys.platform or \
++                'openbsd' in sys.platform:
++            skip("hangs indefinitely on OSX & BSD (also on CPython)")
+         s = _socket.socket()
+         ss = ssl.wrap_socket(s)
+ 
+diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py
+index c36779d..6fe45d0 100644
+--- a/rpython/rlib/ropenssl.py
++++ b/rpython/rlib/ropenssl.py
+@@ -168,6 +168,9 @@ OBJ_NAME = rffi.CArrayPtr(OBJ_NAME_st)
+ 
+ HAVE_OPENSSL_RAND = OPENSSL_VERSION_NUMBER >= 0x0090500f
+ HAVE_SSL_CTX_CLEAR_OPTIONS = OPENSSL_VERSION_NUMBER >= 0x009080df
++HAVE_OPENSSL_RAND_EGD = rffi_platform.has('RAND_egd("/")',
++                                          '#include <openssl/rand.h>',
++                                          libraries=['ssl', 'crypto'])
+ 
+ def external(name, argtypes, restype, **kw):
+     kw['compilation_info'] = eci
+@@ -194,7 +197,8 @@ ssl_external('CRYPTO_set_id_callback',
+ if HAVE_OPENSSL_RAND:
+     ssl_external('RAND_add', [rffi.CCHARP, rffi.INT, rffi.DOUBLE], lltype.Void)
+     ssl_external('RAND_status', [], rffi.INT)
+-    ssl_external('RAND_egd', [rffi.CCHARP], rffi.INT)
++    if HAVE_OPENSSL_RAND_EGD:
++        ssl_external('RAND_egd', [rffi.CCHARP], rffi.INT)
+ ssl_external('SSL_CTX_new', [SSL_METHOD], SSL_CTX)
+ ssl_external('SSL_get_SSL_CTX', [SSL], SSL_CTX)
+ ssl_external('TLSv1_method', [], SSL_METHOD)
+diff --git a/rpython/rtyper/tool/rffi_platform.py b/rpython/rtyper/tool/rffi_platform.py
+index 1760877..1d56c20 100755
+--- a/rpython/rtyper/tool/rffi_platform.py
++++ b/rpython/rtyper/tool/rffi_platform.py
+@@ -17,12 +17,15 @@ from rpython.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong, intmask
+ #
+ # Helpers for simple cases
+ 
+-def eci_from_header(c_header_source, include_dirs=None):
++def eci_from_header(c_header_source, include_dirs=None, libraries=None):
+     if include_dirs is None:
+         include_dirs = []
++    if libraries is None:
++        libraries = []
+     return ExternalCompilationInfo(
+         post_include_bits=[c_header_source],
+-        include_dirs=include_dirs
++        include_dirs=include_dirs,
++        libraries=libraries,
+     )
+ 
+ def getstruct(name, c_header_source, interesting_fields):
+@@ -75,9 +78,10 @@ def getintegerfunctionresult(function, args=None, c_header_source='', includes=[
+         CConfig._compilation_info_.includes = includes
+     return configure(CConfig)['RESULT']
+ 
+-def has(name, c_header_source, include_dirs=None):
++def has(name, c_header_source, include_dirs=None, libraries=None):
+     class CConfig:
+-        _compilation_info_ = eci_from_header(c_header_source, include_dirs)
++        _compilation_info_ = \
++            eci_from_header(c_header_source, include_dirs, libraries)
+         HAS = Has(name)
+     return configure(CConfig)['HAS']
+ 
+diff --git a/rpython/rtyper/tool/test/test_rffi_platform.py b/rpython/rtyper/tool/test/test_rffi_platform.py
+index bfa069e..4feae87 100644
+--- a/rpython/rtyper/tool/test/test_rffi_platform.py
++++ b/rpython/rtyper/tool/test/test_rffi_platform.py
+@@ -271,12 +271,34 @@ def test_array():
+                                        [("d_name", lltype.FixedSizeArray(rffi.CHAR, 1))])
+     assert dirent.c_d_name.length == 32
+ 
+-def test_has():
++def test_has_0001():
+     assert rffi_platform.has("x", "int x = 3;")
+     assert not rffi_platform.has("x", "")
+     # has() should also not crash if it is given an invalid #include
+     assert not rffi_platform.has("x", "#include <some/path/which/cannot/exist>")
+ 
++def test_has_0002():
++    assert rffi_platform.has("pow", "#include <math.h>", libraries=["m"])
++
++def test_has_0003():
++    """multiple libraries"""
++    assert rffi_platform.has("pow", "#include <math.h>", libraries=["m", "c"])
++
++def test_has_0004():
++    """bogus symbol name"""
++    assert not rffi_platform.has("pow", "#include <math.h>",
++                                 libraries=["boguslibname"])
++
++def test_has_0005():
++    """bogus symbol name and lib name"""
++    assert not rffi_platform.has("bogus_symbol_name", "#include <math.h>",
++                                 libraries=["boguslibname"])
++
++def test_has_0006():
++    """missing include"""
++    assert not rffi_platform.has("pow", "", libraries=["m"])
++
++
+ def test_verify_eci():
+     eci = ExternalCompilationInfo()
+     rffi_platform.verify_eci(eci)
+-- 
+2.6.1
+

diff --git a/dev-python/pypy3/pypy3-2.4.0.ebuild b/dev-python/pypy3/pypy3-2.4.0.ebuild
index 1c66a02..47a824e 100644
--- a/dev-python/pypy3/pypy3-2.4.0.ebuild
+++ b/dev-python/pypy3/pypy3-2.4.0.ebuild
@@ -16,13 +16,14 @@ SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${P}-src.tar.bz2"
 LICENSE="MIT"
 SLOT="0/$(get_version_component_range 1-2 ${PV})"
 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
-IUSE="bzip2 gdbm +jit low-memory ncurses sandbox shadowstack sqlite cpu_flags_x86_sse2 tk"
+IUSE="bzip2 gdbm +jit libressl low-memory ncurses sandbox shadowstack sqlite cpu_flags_x86_sse2 tk"
 
 RDEPEND=">=sys-libs/zlib-1.1.3:0=
 	virtual/libffi:0=
 	virtual/libintl:0=
 	dev-libs/expat:0=
-	dev-libs/openssl:0=
+	!libressl? ( dev-libs/openssl:0= )
+	libressl? ( dev-libs/libressl:= )
 	bzip2? ( app-arch/bzip2:0= )
 	gdbm? ( sys-libs/gdbm:0= )
 	ncurses? ( =sys-libs/ncurses-5*:0= )
@@ -79,6 +80,7 @@ src_prepare() {
 		"${FILESDIR}/1.9-scripts-location.patch" \
 		"${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch" \
 		"${FILESDIR}"/2.3.1-shared-lib.patch	# 517002
+	epatch "${FILESDIR}"/${PN}-2.4.0-libressl.patch
 
 	epatch_user
 }


             reply	other threads:[~2015-10-13 17:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 17:03 Julian Ospald [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-12-20 22:03 [gentoo-commits] repo/gentoo:master commit in: dev-python/pypy3/, dev-python/pypy3/files/ Michał Górny
2016-03-03 10:47 Michał Górny
2016-06-09 19:46 Michał Górny
2017-02-17 11:44 Michał Górny
2017-04-25 21:49 Michał Górny
2017-04-30 19:22 Michał Górny
2017-06-09 23:10 Michał Górny
2019-10-18 16:24 Michał Górny
2019-11-01  8:07 Michał Górny
2019-11-01  8:07 Michał Górny
2019-12-30 11:59 Michał Górny
2020-04-11  7:49 Michał Górny
2020-06-30 18:50 Michał Górny
2020-08-02  9:35 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444755717.0edfac4a30fb6b007940e336cbfd4aad57a9910e.hasufell@gentoo \
    --to=hasufell@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox