From a388e4a1706ac2cb8a64e465db1d8e99025adc27 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 13 Jun 2012 18:43:31 +0200 Subject: reorg repo --- Makefile | 4 + mod_wsgi-3.3-httpd24.patch | 192 +++++++++++++++++++++++++++++++++++++++++++++ mod_wsgi.spec | 138 ++++++++++++++++++++++++++++++++ wsgi.conf | 1 + 4 files changed, 335 insertions(+) create mode 100644 Makefile create mode 100644 mod_wsgi-3.3-httpd24.patch create mode 100644 mod_wsgi.spec create mode 100644 wsgi.conf diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1e65467 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../common/Makefile + diff --git a/mod_wsgi-3.3-httpd24.patch b/mod_wsgi-3.3-httpd24.patch new file mode 100644 index 0000000..1e9a8b4 --- /dev/null +++ b/mod_wsgi-3.3-httpd24.patch @@ -0,0 +1,192 @@ + +http://code.google.com/p/modwsgi/source/detail?r=8906fb52b6b23455320c848216f6120c979e57f5 +http://code.google.com/p/modwsgi/source/detail?r=25deb4b94536c96d63505b2a6d4dfb5be1b38195 + +diff -r 21f4dac5959a -r 8906fb52b6b2 mod_wsgi/mod_wsgi.c +--- mod_wsgi-3.3/mod_wsgi.c.httpd24 ++++ mod_wsgi-3.3/mod_wsgi.c +@@ -193,6 +193,9 @@ static PyTypeObject Auth_Type; + #endif + #if AP_MODULE_MAGIC_AT_LEAST(20060110,0) + #define MOD_WSGI_WITH_AUTHZ_PROVIDER 1 ++#if AP_MODULE_MAGIC_AT_LEAST(20100919,0) ++#define MOD_WSGI_WITH_AUTHZ_PROVIDER_PARSED 1 ++#endif + #endif + #endif + +@@ -5637,7 +5640,7 @@ static void wsgi_python_version(void) + } + } + +-static apr_status_t wsgi_python_term() ++static apr_status_t wsgi_python_term(void) + { + PyInterpreterState *interp = NULL; + PyThreadState *tstate = NULL; +@@ -7851,6 +7854,7 @@ static const char *wsgi_set_auth_group_s + return NULL; + } + ++#if !defined(MOD_WSGI_WITH_AUTHN_PROVIDER) + static const char *wsgi_set_user_authoritative(cmd_parms *cmd, void *mconfig, + const char *f) + { +@@ -7866,6 +7870,7 @@ static const char *wsgi_set_user_authori + + return NULL; + } ++#endif + + static const char *wsgi_set_group_authoritative(cmd_parms *cmd, void *mconfig, + const char *f) +@@ -10092,6 +10097,17 @@ static void wsgi_process_socket(apr_pool + } + apr_sockaddr_ip_get(&c->local_ip, c->local_addr); + ++#if AP_MODULE_MAGIC_AT_LEAST(20111130,0) ++ if ((rv = apr_socket_addr_get(&c->client_addr, APR_REMOTE, sock)) ++ != APR_SUCCESS) { ++ ap_log_error(APLOG_MARK, APLOG_INFO, rv, wsgi_server, ++ "mod_wsgi (pid=%d): Failed call " ++ "apr_socket_addr_get(APR_REMOTE).", getpid()); ++ apr_socket_close(sock); ++ return; ++ } ++ apr_sockaddr_ip_get(&c->client_ip, c->client_addr); ++#else + if ((rv = apr_socket_addr_get(&c->remote_addr, APR_REMOTE, sock)) + != APR_SUCCESS) { + ap_log_error(APLOG_MARK, WSGI_LOG_INFO(rv), wsgi_server, +@@ -10101,6 +10117,7 @@ static void wsgi_process_socket(apr_pool + return; + } + apr_sockaddr_ip_get(&c->remote_ip, c->remote_addr); ++#endif + + c->base_server = daemon->group->server; + +@@ -10183,7 +10200,7 @@ static apr_status_t wsgi_worker_acquire( + } + } + +-static apr_status_t wsgi_worker_release() ++static apr_status_t wsgi_worker_release(void) + { + WSGIThreadStack *stack = wsgi_worker_stack; + +@@ -10232,7 +10249,7 @@ static apr_status_t wsgi_worker_release( + } + } + +-static apr_status_t wsgi_worker_shutdown() ++static apr_status_t wsgi_worker_shutdown(void) + { + int i; + apr_status_t rv; +@@ -12739,8 +12756,13 @@ static int wsgi_hook_daemon_handler(conn + * file for the host. + */ + ++#if AP_MODULE_MAGIC_AT_LEAST(20111130,0) ++ r->connection->client_ip = (char *)apr_table_get(r->subprocess_env, ++ "REMOTE_ADDR"); ++#else + r->connection->remote_ip = (char *)apr_table_get(r->subprocess_env, + "REMOTE_ADDR"); ++#endif + + key = apr_psprintf(p, "%s|%s", + apr_table_get(r->subprocess_env, +@@ -13259,6 +13281,18 @@ static PyObject *Auth_environ(AuthObject + Py_DECREF(object); + } + ++#if AP_MODULE_MAGIC_AT_LEAST(20111130,0) ++ if (r->useragent_ip) { ++ value = r->useragent_ip; ++#if PY_MAJOR_VERSION >= 3 ++ object = PyUnicode_DecodeLatin1(value, strlen(value), NULL); ++#else ++ object = PyString_FromString(value); ++#endif ++ PyDict_SetItemString(vars, "REMOTE_ADDR", object); ++ Py_DECREF(object); ++ } ++#else + if (c->remote_ip) { + value = c->remote_ip; + #if PY_MAJOR_VERSION >= 3 +@@ -13269,6 +13303,7 @@ static PyObject *Auth_environ(AuthObject + PyDict_SetItemString(vars, "REMOTE_ADDR", object); + Py_DECREF(object); + } ++#endif + + #if PY_MAJOR_VERSION >= 3 + value = ap_document_root(r); +@@ -13292,6 +13327,17 @@ static PyObject *Auth_environ(AuthObject + Py_DECREF(object); + } + ++#if AP_MODULE_MAGIC_AT_LEAST(20111130,0) ++ rport = c->client_addr->port; ++ value = apr_itoa(r->pool, rport); ++#if PY_MAJOR_VERSION >= 3 ++ object = PyUnicode_DecodeLatin1(value, strlen(value), NULL); ++#else ++ object = PyString_FromString(value); ++#endif ++ PyDict_SetItemString(vars, "REMOTE_PORT", object); ++ Py_DECREF(object); ++#else + rport = c->remote_addr->port; + value = apr_itoa(r->pool, rport); + #if PY_MAJOR_VERSION >= 3 +@@ -13301,6 +13347,7 @@ static PyObject *Auth_environ(AuthObject + #endif + PyDict_SetItemString(vars, "REMOTE_PORT", object); + Py_DECREF(object); ++#endif + + value = r->protocol; + #if PY_MAJOR_VERSION >= 3 +@@ -14391,8 +14438,13 @@ static int wsgi_hook_access_checker(requ + host = ap_get_remote_host(r->connection, r->per_dir_config, + REMOTE_HOST, NULL); + ++#if AP_MODULE_MAGIC_AT_LEAST(20111130,0) ++ if (!host) ++ host = r->useragent_ip; ++#else + if (!host) + host = r->connection->remote_ip; ++#endif + + allow = wsgi_allow_access(r, config, host); + +@@ -14645,8 +14697,14 @@ static int wsgi_hook_check_user_id(reque + + #if defined(MOD_WSGI_WITH_AUTHZ_PROVIDER) + ++#if MOD_WSGI_WITH_AUTHZ_PROVIDER_PARSED ++static authz_status wsgi_check_authorization(request_rec *r, ++ const char *require_args, ++ const void *parsed_require_line) ++#else + static authz_status wsgi_check_authorization(request_rec *r, + const char *require_args) ++#endif + { + WSGIRequestConfig *config; + +@@ -14695,6 +14753,9 @@ static authz_status wsgi_check_authoriza + static const authz_provider wsgi_authz_provider = + { + &wsgi_check_authorization, ++#if MOD_WSGI_WITH_AUTHZ_PROVIDER_PARSED ++ NULL, ++#endif + }; + + #else diff --git a/mod_wsgi.spec b/mod_wsgi.spec new file mode 100644 index 0000000..7aa8229 --- /dev/null +++ b/mod_wsgi.spec @@ -0,0 +1,138 @@ +%{!?_httpd_apxs: %{expand: %%global _httpd_apxs %%{_sbindir}/apxs}} +%{!?_httpd_mmn: %{expand: %%global _httpd_mmn %%(cat %{_includedir}/httpd/.mmn || echo missing-httpd-devel)}} +%{!?_httpd_confdir: %{expand: %%global _httpd_confdir %%{_sysconfdir}/httpd/conf.d}} +# /etc/httpd/conf.d with httpd < 2.4 and defined as /etc/httpd/conf.modules.d with httpd >= 2.4 +%{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}} + +Name: mod_wsgi +Version: 3.3 +Release: 5%{?dist}.1 +Summary: A WSGI interface for Python web applications in Apache + +Group: System Environment/Libraries +License: ASL 2.0 +URL: http://modwsgi.org +Source0: http://modwsgi.googlecode.com/files/%{name}-%{version}.tar.gz +Source1: wsgi.conf +Patch0: mod_wsgi-3.3-httpd24.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: httpd-devel +BuildRequires: python-devel +Requires: httpd-mmn = %{_httpd_mmn} + +%description +The mod_wsgi adapter is an Apache module that provides a WSGI compliant +interface for hosting Python based web applications within Apache. The +adapter is written completely in C code against the Apache C runtime and +for hosting WSGI applications within Apache has a lower overhead than using +existing WSGI adapters for mod_python or CGI. + + +%prep +%setup -q +%patch0 -p1 -b .httpd24 + +%build +%configure --enable-shared --with-apxs=%{_httpd_apxs} +make LDFLAGS="-L%{_libdir}" %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT + +install -d -m 755 $RPM_BUILD_ROOT%{_httpd_modconfdir} +%if "%{_httpd_modconfdir}" == "%{_httpd_confdir}" +# httpd <= 2.2.x +install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_httpd_confdir}/wsgi.conf +%else +# httpd >= 2.4.x +install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_httpd_modconfdir}/10-wsgi.conf +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%doc LICENCE README +%config(noreplace) %{_httpd_modconfdir}/*.conf +%{_libdir}/httpd/modules/mod_wsgi.so + + +%changelog +* Thu Apr 19 2012 Remi Collet - 3.3-5.1 +- sync with rawhide, rebuild for remi repo + +* Wed Mar 28 2012 Remi Collet - 3.3-5 +- rebuild for remi repo + +* Mon Mar 26 2012 Joe Orton - 3.3-5 +- move wsgi.conf to conf.modules.d + +* Mon Mar 26 2012 Joe Orton - 3.3-4 +- rebuild for httpd 2.4 + +* Tue Mar 13 2012 Joe Orton - 3.3-3 +- prepare for httpd 2.4.x + +* Fri Jan 13 2012 Fedora Release Engineering - 3.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Nov 01 2011 James Bowes 3.3-1 +- update to 3.3 + +* Tue Feb 08 2011 Fedora Release Engineering - 3.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Tue Jul 27 2010 David Malcolm - 3.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Tue Mar 9 2010 Josh Kayse - 3.2-1 +- update to 3.2 + +* Sun Mar 07 2010 Josh Kayse - 3.1-2 +- removed conflicts as it violates fedora packaging policy + +* Sun Mar 07 2010 Josh Kayse - 3.1-1 +- update to 3.1 +- add explicit enable-shared +- add conflicts mod_python < 3.3.1 + +* Sat Jul 25 2009 Fedora Release Engineering - 2.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu Jul 02 2009 James Bowes 2.5-1 +- Update to 2.5 + +* Wed Feb 25 2009 Fedora Release Engineering - 2.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Sun Nov 30 2008 Ignacio Vazquez-Abrams - 2.3-2 +- Rebuild for Python 2.6 + +* Tue Oct 28 2008 Luke Macken 2.3-1 +- Update to 2.3 + +* Mon Sep 29 2008 James Bowes 2.1-2 +- Remove requires on httpd-devel + +* Wed Jul 02 2008 James Bowes 2.1-1 +- Update to 2.1 + +* Mon Jun 16 2008 Ricky Zhou 1.3-4 +- Build against the shared python lib. + +* Tue Feb 19 2008 Fedora Release Engineering - 1.3-3 +- Autorebuild for GCC 4.3 + +* Sun Jan 06 2008 James Bowes 1.3-2 +- Require httpd + +* Sat Jan 05 2008 James Bowes 1.3-1 +- Update to 1.3 + +* Sun Sep 30 2007 James Bowes 1.0-1 +- Initial packaging for Fedora + diff --git a/wsgi.conf b/wsgi.conf new file mode 100644 index 0000000..19f3567 --- /dev/null +++ b/wsgi.conf @@ -0,0 +1 @@ +LoadModule wsgi_module modules/mod_wsgi.so -- cgit