!1 package init
From: @hht8 Reviewed-by: @small_leek Signed-off-by: @small_leek
This commit is contained in:
commit
96e4ec06e4
41
Changed-functions-to-pre-post-actions-when-forking.patch
Normal file
41
Changed-functions-to-pre-post-actions-when-forking.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 0f34844009075391c55419a3afb90e469facf35e Mon Sep 17 00:00:00 2001
|
||||
From: Graham Dumpleton <Graham.Dumpleton@gmail.com>
|
||||
Date: Tue, 14 May 2019 16:14:07 +1000
|
||||
Subject: [PATCH] Changed functions to pre/post actions when forking.
|
||||
|
||||
---
|
||||
src/server/mod_wsgi.c | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/server/mod_wsgi.c b/src/server/mod_wsgi.c
|
||||
index 2e4bb24d..bf55945a 100644
|
||||
--- a/src/server/mod_wsgi.c
|
||||
+++ b/src/server/mod_wsgi.c
|
||||
@@ -4345,8 +4345,13 @@ static void wsgi_python_child_init(apr_pool_t *p)
|
||||
* do it if Python was initialised in parent process.
|
||||
*/
|
||||
|
||||
- if (wsgi_python_initialized && !wsgi_python_after_fork)
|
||||
+ if (wsgi_python_initialized && !wsgi_python_after_fork) {
|
||||
+#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7)
|
||||
+ PyOS_AfterFork_Child();
|
||||
+#else
|
||||
PyOS_AfterFork();
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
/* Finalise any Python objects required by child process. */
|
||||
|
||||
@@ -10422,6 +10427,12 @@ static int wsgi_start_process(apr_pool_t *p, WSGIDaemonProcess *daemon)
|
||||
wsgi_exit_daemon_process(0);
|
||||
}
|
||||
|
||||
+ if (wsgi_python_initialized) {
|
||||
+#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7)
|
||||
+ PyOS_AfterFork_Parent();
|
||||
+#endif
|
||||
+ }
|
||||
+
|
||||
apr_pool_note_subprocess(p, &daemon->process, APR_KILL_AFTER_TIMEOUT);
|
||||
apr_proc_other_child_register(&daemon->process, wsgi_manage_process,
|
||||
daemon, NULL, p);
|
||||
55
Use-official-APIs-for-accessing-interpreter-list.patch
Normal file
55
Use-official-APIs-for-accessing-interpreter-list.patch
Normal file
@ -0,0 +1,55 @@
|
||||
From b03b02df6318afe26052db5b0365732152cacea2 Mon Sep 17 00:00:00 2001
|
||||
From: Graham Dumpleton <Graham.Dumpleton@gmail.com>
|
||||
Date: Tue, 14 May 2019 16:14:42 +1000
|
||||
Subject: [PATCH] Use official APIs for accessing interpreter list.
|
||||
|
||||
---
|
||||
src/server/wsgi_interp.c | 18 ++++++++++++------
|
||||
1 file changed, 12 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/server/wsgi_interp.c b/src/server/wsgi_interp.c
|
||||
index 4a948509..3fbca04b 100644
|
||||
--- a/src/server/wsgi_interp.c
|
||||
+++ b/src/server/wsgi_interp.c
|
||||
@@ -338,9 +338,10 @@ static PyObject *ShutdownInterpreter_call(
|
||||
|
||||
PyThreadState_Swap(NULL);
|
||||
|
||||
- tstate = tstate->interp->tstate_head;
|
||||
+ tstate = PyInterpreterState_ThreadHead(tstate->interp);
|
||||
+
|
||||
while (tstate) {
|
||||
- tstate_next = tstate->next;
|
||||
+ tstate_next = PyThreadState_Next(tstate);
|
||||
if (tstate != tstate_save) {
|
||||
PyThreadState_Swap(tstate);
|
||||
PyThreadState_Clear(tstate);
|
||||
@@ -436,9 +437,13 @@ InterpreterObject *newInterpreterObject(const char *name)
|
||||
*/
|
||||
|
||||
if (!name) {
|
||||
+#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7)
|
||||
+ interp = PyInterpreterState_Main();
|
||||
+#else
|
||||
interp = PyInterpreterState_Head();
|
||||
- while (interp->next)
|
||||
- interp = interp->next;
|
||||
+ while (PyInterpreterState_Next(interp))
|
||||
+ interp = PyInterpreterState_Next(interp);
|
||||
+#endif
|
||||
|
||||
name = "";
|
||||
}
|
||||
@@ -1883,9 +1888,10 @@ static void Interpreter_dealloc(InterpreterObject *self)
|
||||
|
||||
PyThreadState_Swap(NULL);
|
||||
|
||||
- tstate = tstate->interp->tstate_head;
|
||||
+ tstate = PyInterpreterState_ThreadHead(tstate->interp);
|
||||
+
|
||||
while (tstate) {
|
||||
- tstate_next = tstate->next;
|
||||
+ tstate_next = PyThreadState_Next(tstate);
|
||||
if (tstate != tstate_save) {
|
||||
PyThreadState_Swap(tstate);
|
||||
PyThreadState_Clear(tstate);
|
||||
11
mod_wsgi-4.5.20-exports.patch
Normal file
11
mod_wsgi-4.5.20-exports.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- mod_wsgi-4.5.20/Makefile.in
|
||||
+++ mod_wsgi-4.5.20/Makefile.in
|
||||
@@ -28,7 +28,7 @@
|
||||
all : src/server/mod_wsgi.la
|
||||
|
||||
src/server/mod_wsgi.la : $(SRCFILES)
|
||||
- $(APXS) -c $(CPPFLAGS) $(CFLAGS) $(SRCFILES) $(LDFLAGS) $(LDLIBS)
|
||||
+ $(APXS) -Wl,-export-symbols-regex -Wl,wsgi_module -c $(CPPFLAGS) $(CFLAGS) $(SRCFILES) $(LDFLAGS) $(LDLIBS)
|
||||
|
||||
$(DESTDIR)$(LIBEXECDIR) :
|
||||
mkdir -p $@
|
||||
BIN
mod_wsgi-4.6.4.tar.gz
Normal file
BIN
mod_wsgi-4.6.4.tar.gz
Normal file
Binary file not shown.
76
mod_wsgi.spec
Normal file
76
mod_wsgi.spec
Normal file
@ -0,0 +1,76 @@
|
||||
%{!?_httpd_apxs: %{expand: %%global _httpd_apxs %%{_sbindir}/apxs}}
|
||||
%{!?_httpd_mmn: %{expand: %%global _httpd_mmn %%(cat %{_includedir}/httpd/.mmn 2>/dev/null || echo 0-0)}}
|
||||
%{!?_httpd_confdir: %{expand: %%global _httpd_confdir %%{_sysconfdir}/httpd/conf.d}}
|
||||
%{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}}
|
||||
%{!?_httpd_moddir: %{expand: %%global _httpd_moddir %%{_libdir}/httpd/modules}}
|
||||
%global sphinxbin %{_bindir}/sphinx-build-3
|
||||
Name: mod_wsgi
|
||||
Version: 4.6.4
|
||||
Release: 1
|
||||
Summary: A WSGI interface for Python web applications in Apache
|
||||
License: ASL 2.0
|
||||
URL: https://modwsgi.readthedocs.io/
|
||||
Source0: https://github.com/GrahamDumpleton/mod_wsgi/archive/%{version}.tar.gz#/mod_wsgi-%{version}.tar.gz
|
||||
Patch1: mod_wsgi-4.5.20-exports.patch
|
||||
Patch2: Use-official-APIs-for-accessing-interpreter-list.patch
|
||||
Patch3: Changed-functions-to-pre-post-actions-when-forking.patch
|
||||
BuildRequires: httpd-devel gcc
|
||||
%{?filter_provides_in: %filter_provides_in %{_httpd_moddir}/.*\.so$}
|
||||
%{?filter_setup}
|
||||
%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.
|
||||
|
||||
%package -n python3-%{name}
|
||||
Summary: %summary
|
||||
Requires: httpd-mmn = %{_httpd_mmn}
|
||||
BuildRequires: python3-devel, python3-sphinx
|
||||
Provides: mod_wsgi = %{version}-%{release}
|
||||
Provides: mod_wsgi%{?_isa} = %{version}-%{release}
|
||||
Obsoletes: mod_wsgi < %{version}-%{release}
|
||||
%description -n python3-%{name}
|
||||
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
|
||||
%autosetup n %{name}-%{version} -p1
|
||||
|
||||
%build
|
||||
make -C docs html SPHINXBUILD=%{sphinxbin}
|
||||
export LDFLAGS="$RPM_LD_FLAGS -L%{_libdir}"
|
||||
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
|
||||
mkdir py3build/
|
||||
cp -R * py3build/ || :
|
||||
pushd py3build
|
||||
%configure --enable-shared --with-apxs=%{_httpd_apxs} --with-python=python3
|
||||
make %{?_smp_mflags}
|
||||
%py3_build
|
||||
popd
|
||||
|
||||
%install
|
||||
pushd py3build
|
||||
make install DESTDIR=$RPM_BUILD_ROOT LIBEXECDIR=%{_httpd_moddir}
|
||||
mv $RPM_BUILD_ROOT%{_httpd_moddir}/mod_wsgi{,_python3}.so
|
||||
install -d -m 755 $RPM_BUILD_ROOT%{_httpd_modconfdir}
|
||||
%py3_install
|
||||
mv $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express{,-3}
|
||||
popd
|
||||
|
||||
%files -n python3-%{name}
|
||||
%license LICENSE
|
||||
%doc CREDITS.rst README.rst
|
||||
%{_httpd_moddir}/mod_wsgi_python3.so
|
||||
%{python3_sitearch}/mod_wsgi-*.egg-info
|
||||
%{python3_sitearch}/mod_wsgi
|
||||
%{_bindir}/mod_wsgi-express-3
|
||||
|
||||
%changelog
|
||||
* Thu Nov 19 2020 huanghaitao <huanghaitao8@huawei.com> - 4.6.4-1
|
||||
- package init
|
||||
4
mod_wsgi.yaml
Normal file
4
mod_wsgi.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
version_control: github
|
||||
src_repo: GrahamDumpleton/mod_wsgi
|
||||
tag_prefix: ""
|
||||
separator: "."
|
||||
Loading…
x
Reference in New Issue
Block a user