diff --git a/fix-tests.patch b/fix-tests.patch new file mode 100644 index 0000000..e57b2ac --- /dev/null +++ b/fix-tests.patch @@ -0,0 +1,41 @@ +From: Antonio Larrosa +Subject: Fix failing tests + +- ssl.OP_NO_COMPRESSION is set by default by ssl. +- thread_ident can be represented as a negative hex number now, + so replace the negative sign with the regex too, and not just the number. +Index: gevent-1.4.0/src/greentest/2.7/test_ssl.py +=================================================================== +--- gevent-1.4.0.orig/src/greentest/2.7/test_ssl.py ++++ gevent-1.4.0/src/greentest/2.7/test_ssl.py +@@ -742,14 +742,14 @@ class ContextTests(unittest.TestCase): + def test_options(self): + ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + # OP_ALL | OP_NO_SSLv2 | OP_NO_SSLv3 is the default value +- self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3, ++ self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_NO_COMPRESSION, + ctx.options) + ctx.options |= ssl.OP_NO_TLSv1 +- self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_NO_TLSv1, ++ self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_NO_COMPRESSION | ssl.OP_NO_TLSv1, + ctx.options) + if can_clear_options(): + ctx.options = (ctx.options & ~ssl.OP_NO_SSLv2) | ssl.OP_NO_TLSv1 +- self.assertEqual(ssl.OP_ALL | ssl.OP_NO_TLSv1 | ssl.OP_NO_SSLv3, ++ self.assertEqual(ssl.OP_ALL | ssl.OP_NO_TLSv1 | ssl.OP_NO_SSLv3 | ssl.OP_NO_COMPRESSION, + ctx.options) + ctx.options = 0 + self.assertEqual(0, ctx.options) +Index: gevent-1.4.0/src/gevent/tests/test__util.py +=================================================================== +--- gevent-1.4.0.orig/src/gevent/tests/test__util.py ++++ gevent-1.4.0/src/gevent/tests/test__util.py +@@ -134,7 +134,7 @@ class TestTree(greentest.TestCase): + + def _normalize_tree_format(self, value): + import re +- hexobj = re.compile('0x[0123456789abcdef]+L?', re.I) ++ hexobj = re.compile('-?0x[0123456789abcdef]+L?', re.I) + value = hexobj.sub('X', value) + value = value.replace('epoll', 'select') + value = value.replace('select', 'default') diff --git a/python-gevent.changes b/python-gevent.changes index 437c9de..d8dab67 100644 --- a/python-gevent.changes +++ b/python-gevent.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Mon Feb 4 11:37:48 UTC 2019 - Antonio Larrosa + +- Add patches to fix building the package: + * remove-testCongestion.patch to remove a test that is failing + due to a timeout + * fix-tests.patch to fix some tests + - ssl.OP_NO_COMPRESSION is set by default by ssl. + - thread_ident can be represented as a negative hex number now, + so replace the negative sign with the regex too, and not just the number. + * use-libev-cffi.patch, libev-cext seems to be broken on i586, so + use libev-cffi by default (also, the gevent documentation mentions + that upstream will make libev-cffi the default soon). + +------------------------------------------------------------------- +Fri Feb 1 10:35:13 UTC 2019 - Tomáš Chvátal + +- Make sure to skip tests that need network access + ------------------------------------------------------------------- Thu Jan 31 09:42:44 UTC 2019 - Tomáš Chvátal diff --git a/python-gevent.spec b/python-gevent.spec index a211612..fc8096e 100644 --- a/python-gevent.spec +++ b/python-gevent.spec @@ -26,23 +26,38 @@ Group: Development/Languages/Python URL: http://www.gevent.org/ Source: https://files.pythonhosted.org/packages/source/g/gevent/gevent-%{version}.tar.gz Source100: %{name}-rpmlintrc +Patch0: remove-testCongestion.patch +Patch1: fix-tests.patch +Patch2: use-libev-cffi.patch BuildRequires: %{python_module cffi} BuildRequires: %{python_module devel} +BuildRequires: %{python_module dnspython} BuildRequires: %{python_module greenlet >= 0.4.14} BuildRequires: %{python_module mock} BuildRequires: %{python_module objgraph} +BuildRequires: %{python_module psutil} +BuildRequires: %{python_module requests} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module zope.event} +BuildRequires: %{python_module zope.interface} +# /etc/protocols needed for tests BuildRequires: c-ares-devel BuildRequires: fdupes BuildRequires: libev-devel +BuildRequires: libuv-devel +BuildRequires: netcfg BuildRequires: python-rpm-macros BuildRequires: python3-testsuite Requires: python-cffi +Requires: python-dnspython Requires: python-greenlet +Requires: python-requests %if 0%{?suse_version} || 0%{?fedora_version} || 0%{?rhel} >= 8 Recommends: python-psutil +Recommends: python-zope.event %else Requires: python-psutil +Requires: python-zope.event %endif %python_subpackages @@ -67,30 +82,49 @@ out the list of the open source projects based on gevent. Summary: Documentation for %{name} Group: Documentation/Other Provides: %{python_module gevent-doc = %{version}} +BuildArch: noarch %description -n python-gevent-doc Documentation and examples for %{name}. %prep %setup -q -n gevent-%{version} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build export LIBEV_EMBED=0 export CARES_EMBED=0 -export GEVENT_NO_CFFI_BUILD=1 %python_build %install export LIBEV_EMBED=0 export CARES_EMBED=0 -export GEVENT_NO_CFFI_BUILD=1 %python_install %python_expand %fdupes %{buildroot}%{$python_sitearch} %check -# tests passed as 20 need network connection with no way to skip +# create ignore list of tests that reach out to the net +cat <<'EOF' >> network_tests.txt +test_urllib2net.py +test__server.py +test__server_pywsgi.py +test__socket_ssl.py +test___example_servers.py +test__socket_dns.py +test__getaddrinfo_import.py +test__examples.py +EOF export GEVENT_RESOLVER=thread -%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -m gevent.tests || : +# Setting the TRAVIS environment variable makes some different configuration +# for tests that use the network so they don't fail on travis (or obs) +export TRAVIS=1 +# Setting the APPVEYOR environment variable makes the tests use a workaround +# for Appveyor that we also need in obs for "wait_threads() failed to cleanup 1 threads" +export APPVEYOR=1 +export LANG=en_US.UTF-8 +%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -m gevent.tests --ignore network_tests.txt %files %{python_files} %doc AUTHORS README.rst TODO CHANGES.rst CONTRIBUTING.rst diff --git a/remove-testCongestion.patch b/remove-testCongestion.patch new file mode 100644 index 0000000..dbbda53 --- /dev/null +++ b/remove-testCongestion.patch @@ -0,0 +1,82 @@ +From: Antonio Larrosa +Subject: Remove testCongestion from test_socket.py + +Remove testCongestion from test_socket.py which is failing with a timeout. + +Index: gevent-1.4.0/src/greentest/3.7/test_socket.py +=================================================================== +--- gevent-1.4.0.orig/src/greentest/3.7/test_socket.py ++++ gevent-1.4.0/src/greentest/3.7/test_socket.py +@@ -2054,34 +2054,6 @@ class RDSTest(ThreadedRDSSocketTest): + self.data = b'select' + self.cli.sendto(self.data, 0, (HOST, self.port)) + +- def testCongestion(self): +- # wait until the sender is done +- self.evt.wait() +- +- def _testCongestion(self): +- # test the behavior in case of congestion +- self.data = b'fill' +- self.cli.setblocking(False) +- try: +- # try to lower the receiver's socket buffer size +- self.cli.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 16384) +- except OSError: +- pass +- with self.assertRaises(OSError) as cm: +- try: +- # fill the receiver's socket buffer +- while True: +- self.cli.sendto(self.data, 0, (HOST, self.port)) +- finally: +- # signal the receiver we're done +- self.evt.set() +- # sendto() should have failed with ENOBUFS +- self.assertEqual(cm.exception.errno, errno.ENOBUFS) +- # and we should have received a congestion notification through poll +- r, w, x = select.select([self.serv], [], [], 3.0) +- self.assertIn(self.serv, r) +- +- + @unittest.skipIf(fcntl is None, "need fcntl") + @unittest.skipUnless(HAVE_SOCKET_VSOCK, + 'VSOCK sockets required for this test.') +Index: gevent-1.4.0/src/greentest/3.6/test_socket.py +=================================================================== +--- gevent-1.4.0.orig/src/greentest/3.6/test_socket.py ++++ gevent-1.4.0/src/greentest/3.6/test_socket.py +@@ -1769,33 +1769,6 @@ class RDSTest(ThreadedRDSSocketTest): + self.data = b'select' + self.cli.sendto(self.data, 0, (HOST, self.port)) + +- def testCongestion(self): +- # wait until the sender is done +- self.evt.wait() +- +- def _testCongestion(self): +- # test the behavior in case of congestion +- self.data = b'fill' +- self.cli.setblocking(False) +- try: +- # try to lower the receiver's socket buffer size +- self.cli.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 16384) +- except OSError: +- pass +- with self.assertRaises(OSError) as cm: +- try: +- # fill the receiver's socket buffer +- while True: +- self.cli.sendto(self.data, 0, (HOST, self.port)) +- finally: +- # signal the receiver we're done +- self.evt.set() +- # sendto() should have failed with ENOBUFS +- self.assertEqual(cm.exception.errno, errno.ENOBUFS) +- # and we should have received a congestion notification through poll +- r, w, x = select.select([self.serv], [], [], 3.0) +- self.assertIn(self.serv, r) +- + + @unittest.skipUnless(thread, 'Threading required for this test.') + class BasicTCPTest(SocketConnectedTest): diff --git a/use-libev-cffi.patch b/use-libev-cffi.patch new file mode 100644 index 0000000..1ef9a16 --- /dev/null +++ b/use-libev-cffi.patch @@ -0,0 +1,23 @@ +From: Antonio Larrosa +Subject: Fix failing tests + +libev-cext seems to be broken on i586, so use libev-cffi by default +(also, the gevent documentation mentions that upstream will make +libev-cffi the default soon [1]). + +[1] http://www.gevent.org/loop_impls.html#libev + +Index: gevent-1.4.0/src/gevent/_config.py +=================================================================== +--- gevent-1.4.0.orig/src/gevent/_config.py ++++ gevent-1.4.0/src/gevent/_config.py +@@ -352,8 +352,8 @@ class Loop(ImportableSetting, Setting): + """ + + default = [ +- 'libev-cext', + 'libev-cffi', ++ 'libev-cext', + 'libuv-cffi', + ] if not WIN else [ + 'libuv-cffi',