[arch-commits] Commit in goagent/trunk (PKGBUILD sslwrap-python-2.7.9.patch)

Felix Yan fyan at archlinux.org
Sat Dec 13 09:09:55 UTC 2014


    Date: Saturday, December 13, 2014 @ 10:09:54
  Author: fyan
Revision: 123826

upgpkg: goagent 3.2.3-2

add patch to work under python 2.7.9

Added:
  goagent/trunk/sslwrap-python-2.7.9.patch
Modified:
  goagent/trunk/PKGBUILD

----------------------------+
 PKGBUILD                   |   14 ++++++++----
 sslwrap-python-2.7.9.patch |   47 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 5 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2014-12-13 08:16:18 UTC (rev 123825)
+++ PKGBUILD	2014-12-13 09:09:54 UTC (rev 123826)
@@ -6,7 +6,7 @@
 pkgname=goagent
 pkgver=3.2.3
 #_commit=d911497475c516405dde59a968cd506424326b55
-pkgrel=1
+pkgrel=2
 pkgdesc="A gae proxy forked from gappproxy/wallproxy"
 arch=("any")
 url="http://goagent.googlecode.com"
@@ -18,13 +18,20 @@
 source=("git+https://github.com/goagent/goagent.git#tag=v$pkgver"
 #source=("git+https://github.com/goagent/goagent.git#commit=$_commit" 
         "${pkgname}.user.ini"
-        "${pkgname}.service")
+        "${pkgname}.service"
+        sslwrap-python-2.7.9.patch)
 backup=('etc/goagent')
 install=goagent.install
+sha512sums=('SKIP'
+            'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e'
+            '4327d5b874c5150296f9c027a60994853de1b68d4c4e32291a5c41c0e162ffbccf68b6208cbc096d099721b470e1df897ad61596d8ddd705543c15b58e9a0f7c'
+            'c999f2c3de574a2826b2ae51a0469c0a070e2f7177a86c70a21304fadede999342d1b01f5925a8785fa56f0745154734df65cb929b00bd5f9066f85c3d300354')
 
 prepare() {
   cd $pkgname
 
+  patch -p1 -i ../sslwrap-python-2.7.9.patch
+
   sed -e "s|^#!/usr/bin/env python|#!/usr/bin/env python2|" \
       -i local/{proxy.py,dnsproxy.py}
   sed -e 's|^            self.geoip = .*$|            self.geoip = pygeoip.GeoIP("/usr/share/GeoIP/GeoIP.dat")|' \
@@ -57,6 +64,3 @@
 }
 
 # vim:set ts=2 sw=2 et:
-sha512sums=('SKIP'
-            'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e'
-            '4327d5b874c5150296f9c027a60994853de1b68d4c4e32291a5c41c0e162ffbccf68b6208cbc096d099721b470e1df897ad61596d8ddd705543c15b58e9a0f7c')

Added: sslwrap-python-2.7.9.patch
===================================================================
--- sslwrap-python-2.7.9.patch	                        (rev 0)
+++ sslwrap-python-2.7.9.patch	2014-12-13 09:09:54 UTC (rev 123826)
@@ -0,0 +1,47 @@
+From 0a050807191e0aaff09160256d254a7368b8892e Mon Sep 17 00:00:00 2001
+From: Felix Yan <felixonmars at gmail.com>
+Date: Sat, 13 Dec 2014 16:24:15 +0800
+Subject: [PATCH] Re-add sslwrap to workaround gevent on Python 2.7.9
+
+---
+ local/proxylib.py | 27 +++++++++++++++++++++++++++
+ 1 file changed, 27 insertions(+)
+
+diff --git a/local/proxylib.py b/local/proxylib.py
+index 73e032e..ebaf067 100644
+--- a/local/proxylib.py
++++ b/local/proxylib.py
+@@ -40,6 +40,33 @@
+ gevent = sys.modules.get('gevent') or logging.warn('please enable gevent.')
+ 
+ 
++# Re-add sslwrap to Python 2.7.9
++import inspect
++__ssl__ = __import__('ssl')
++
++try:
++    _ssl = __ssl__._ssl
++except AttributeError:
++    _ssl = __ssl__._ssl2
++
++
++def new_sslwrap(sock, server_side=False, keyfile=None, certfile=None, cert_reqs=__ssl__.CERT_NONE, ssl_version=__ssl__.PROTOCOL_SSLv23, ca_certs=None, ciphers=None):
++    context = __ssl__.SSLContext(ssl_version)
++    context.verify_mode = cert_reqs or __ssl__.CERT_NONE
++    if ca_certs:
++        context.load_verify_locations(ca_certs)
++    if certfile:
++        context.load_cert_chain(certfile, keyfile)
++    if ciphers:
++        context.set_ciphers(ciphers)
++
++    caller_self = inspect.currentframe().f_back.f_locals['self']
++    return context._wrap_socket(sock, server_side=server_side, ssl_sock=caller_self)
++
++if not hasattr(_ssl, 'sslwrap'):
++    _ssl.sslwrap = new_sslwrap
++
++
+ try:
+     from Crypto.Cipher.ARC4 import new as RC4Cipher
+ except ImportError:



More information about the arch-commits mailing list