From 536a4e5969a1f20fa1e7c817481fc4f7e5d8cbdb Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Apr 09 2013 13:51:06 +0000 Subject: add the GLOBAL_ACK_EINTR constant to the list of exported symbols (#920589) --- diff --git a/0001-add-the-GLOBAL_ACK_EINTR-constant-to-the-list-of-exp.patch b/0001-add-the-GLOBAL_ACK_EINTR-constant-to-the-list-of-exp.patch new file mode 100644 index 0000000..40a0347 --- /dev/null +++ b/0001-add-the-GLOBAL_ACK_EINTR-constant-to-the-list-of-exp.patch @@ -0,0 +1,61 @@ +From a2fb13434cf975b2e9b19067c8968f91e190de5b Mon Sep 17 00:00:00 2001 +From: Zdenek Pavlas +Date: Wed, 13 Mar 2013 16:55:58 +0100 +Subject: [PATCH 1/2] add the GLOBAL_ACK_EINTR constant to the list of exported symbols + +... if built against a new enough version of libcurl + +Bug: https://bugzilla.redhat.com/920589 + +Signed-off-by: Kamil Dudka +--- + src/pycurl.c | 19 +++++++++++++++---- + 1 files changed, 15 insertions(+), 4 deletions(-) + +diff --git a/src/pycurl.c b/src/pycurl.c +index 619ca20..9950e00 100644 +--- a/src/pycurl.c ++++ b/src/pycurl.c +@@ -3210,6 +3210,16 @@ static PyTypeObject CurlMulti_Type = { + */ + }; + ++static int ++are_global_init_flags_valid(int flags) ++{ ++#ifdef CURL_GLOBAL_ACK_EINTR ++ /* CURL_GLOBAL_ACK_EINTR was introduced in libcurl-7.30.0 */ ++ return !(flags & ~(CURL_GLOBAL_ALL | CURL_GLOBAL_ACK_EINTR)); ++#else ++ return !(flags & ~(CURL_GLOBAL_ALL)); ++#endif ++} + + /************************************************************************* + // module level +@@ -3227,10 +3237,7 @@ do_global_init(PyObject *dummy, PyObject *args) + return NULL; + } + +- if (!(option == CURL_GLOBAL_SSL || +- option == CURL_GLOBAL_WIN32 || +- option == CURL_GLOBAL_ALL || +- option == CURL_GLOBAL_NOTHING)) { ++ if (!are_global_init_flags_valid(option)) { + PyErr_SetString(PyExc_ValueError, "invalid option to global_init"); + return NULL; + } +@@ -3866,6 +3873,10 @@ initpycurl(void) + insint(d, "GLOBAL_ALL", CURL_GLOBAL_ALL); + insint(d, "GLOBAL_NOTHING", CURL_GLOBAL_NOTHING); + insint(d, "GLOBAL_DEFAULT", CURL_GLOBAL_DEFAULT); ++#ifdef CURL_GLOBAL_ACK_EINTR ++ /* CURL_GLOBAL_ACK_EINTR was introduced in libcurl-7.30.0 */ ++ insint(d, "GLOBAL_ACK_EINTR", CURL_GLOBAL_ACK_EINTR); ++#endif + + + /* constants for curl_multi_socket interface */ +-- +1.7.1 + diff --git a/0002-tests-global_init_ack_eintr.py-test-GLOBAL_ACK_EINTR.patch b/0002-tests-global_init_ack_eintr.py-test-GLOBAL_ACK_EINTR.patch new file mode 100644 index 0000000..4768b7f --- /dev/null +++ b/0002-tests-global_init_ack_eintr.py-test-GLOBAL_ACK_EINTR.patch @@ -0,0 +1,42 @@ +From 3fba1b63a99f68bedb9a3d60326d22bd8f10f83b Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Wed, 3 Apr 2013 15:06:32 +0200 +Subject: [PATCH 2/2] tests/global_init_ack_eintr.py: test GLOBAL_ACK_EINTR + +... if we have a new enough version of libcurl +--- + tests/global_init_ack_eintr.py | 22 ++++++++++++++++++++++ + 1 files changed, 22 insertions(+), 0 deletions(-) + create mode 100644 tests/global_init_ack_eintr.py + +diff --git a/tests/global_init_ack_eintr.py b/tests/global_init_ack_eintr.py +new file mode 100644 +index 0000000..429fc3f +--- /dev/null ++++ b/tests/global_init_ack_eintr.py +@@ -0,0 +1,22 @@ ++#! /usr/bin/env python ++# -*- coding: iso-8859-1 -*- ++# vi:ts=4:et ++ ++import pycurl ++import unittest ++ ++from . import util ++ ++class GlobalInitAckEintrTest(unittest.TestCase): ++ def test_global_init_default(self): ++ # initialize libcurl with DEFAULT flags ++ pycurl.global_init(pycurl.GLOBAL_DEFAULT) ++ pycurl.global_cleanup() ++ ++ def test_global_init_ack_eintr(self): ++ # the GLOBAL_ACK_EINTR flag was introduced in libcurl-7.30, but can also ++ # be backported for older versions of libcurl at the distribution level ++ if not util.pycurl_version_less_than(7, 30) or hasattr(pycurl, 'GLOBAL_ACK_EINTR'): ++ # initialize libcurl with the GLOBAL_ACK_EINTR flag ++ pycurl.global_init(pycurl.GLOBAL_ACK_EINTR) ++ pycurl.global_cleanup() +-- +1.7.1 + diff --git a/python-pycurl.spec b/python-pycurl.spec index d9be513..2ebae08 100644 --- a/python-pycurl.spec +++ b/python-pycurl.spec @@ -13,6 +13,10 @@ Source0: http://pycurl.sourceforge.net/download/pycurl-%{version}.tar.gz # sync with upstream's 9b8f4e38 Patch0: 0000-pycurl-7.19.7-9b8f4e38.patch +# bz #920589 - add the GLOBAL_ACK_EINTR constant to the list of exported symbols +Patch1: 0001-add-the-GLOBAL_ACK_EINTR-constant-to-the-list-of-exp.patch +Patch2: 0002-tests-global_init_ack_eintr.py-test-GLOBAL_ACK_EINTR.patch + Requires: keyutils-libs BuildRequires: python-devel BuildRequires: curl-devel >= 7.19.0 @@ -48,6 +52,10 @@ find -type f | xargs sed -i 's/\$Id: [^$]*\$/$Id$/' # upstream patches %patch0 -p1 +# patches not yet upstream +%patch1 -p1 +%patch2 -p1 + %build CFLAGS="$RPM_OPT_FLAGS -DHAVE_CURL_OPENSSL" %{__python} setup.py build @@ -66,6 +74,7 @@ rm -rf %{buildroot}%{_datadir}/doc/pycurl %changelog * Tue Apr 09 2013 Kamil Dudka - 7.19.0-16.20120408git9b8f4e38 - sync with upstream 9b8f4e38 (fixes #928370) +- add the GLOBAL_ACK_EINTR constant to the list of exported symbols (#920589) * Wed Mar 06 2013 Kamil Dudka - 7.19.0-15 - allow to return -1 from the write callback (#857875)