first hopefully complete replacement from f16 mod_python-3.3.1-0
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Sun, 26 May 2013 06:17:28 +0000 (08:17 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Sun, 26 May 2013 06:17:28 +0000 (08:17 +0200)
Makefile [new file with mode: 0644]
README [new file with mode: 0644]
mod_python-3.1.3-ldflags.patch [new file with mode: 0644]
mod_python-3.1.4-cflags.patch [new file with mode: 0644]
mod_python-3.3.1-buckets.patch [new file with mode: 0644]
mod_python-3.3.1-no-user-site-directory.patch [new file with mode: 0644]
mod_python-3.3.1-pycapsule.patch [new file with mode: 0644]
mod_python.spec [new file with mode: 0644]
python.conf [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..15d830b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,60 @@
+#
+WEBFETCH          := wget
+SHA1SUM                   := sha1sum
+
+ALL               += mod_python
+mod_python-URL1           := http://mirror.onelab.eu/third-party/mod_python-3.3.1.tgz
+mod_python-URL2           := http://planet-lab.org/third-party/mod_python-3.3.1.tgz
+mod_python-SHA1SUM := e538170fd78e09408b6d8593da980b126a0fef93
+mod_python        := $(notdir $(mod_python-URL1))
+
+##############################
+define download_target
+$(1): $($(1))
+.PHONY: $(1)
+$($(1)): 
+       @if [ ! -e "$($(1))" ] ; then \
+       { echo Using primary; echo "$(WEBFETCH) $($(1)-URL1)" ; $(WEBFETCH) $($(1)-URL1) ; } || \
+       { echo Using secondary; echo "$(WEBFETCH) $($(1)-URL2)" ; $(WEBFETCH) $($(1)-URL2) ; } ; fi
+       @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi
+       @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \
+           echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \
+           echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \
+           echo "In Makefile: $($(1)-SHA1SUM)" ; \
+           false ; \
+       else \
+           ls -l $($(1)) ; \
+       fi
+endef
+
+$(eval $(call download_target,mod_python))
+
+sources: $(ALL)
+.PHONY: sources
+
+####################
+# default - overridden by the build
+SPECFILE = mod_python.spec
+
+PWD=$(shell pwd)
+PREPARCH ?= noarch
+RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)"
+trees: sources
+       rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
+
+srpm: sources
+       rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bs $(SPECFILE)
+
+TARGET ?= $(shell uname -m)
+rpm: sources
+       rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps --target $(TARGET) -bb $(SPECFILE)
+
+clean:
+       rm -f *.rpm *.tgz *.bz2 *.gz
+
+++%: varname=$(subst +,,$@)
+++%:
+       @echo "$(varname)=$($(varname))"
++%: varname=$(subst +,,$@)
++%:
+       @echo "$($(varname))"
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..f40be54
--- /dev/null
+++ b/README
@@ -0,0 +1,5 @@
+Building our own mod_python, as it was dropped from f18
+
+This module comes almost litterally from mod_python-3.3.1-16.fc16.src.rpm from the fedora 16 distrib
+
+We've only replaced the gz by Makefile so we fetch it from mirror
diff --git a/mod_python-3.1.3-ldflags.patch b/mod_python-3.1.3-ldflags.patch
new file mode 100644 (file)
index 0000000..b146a22
--- /dev/null
@@ -0,0 +1,11 @@
+--- mod_python-3.1.3/configure.in.ldflags
++++ mod_python-3.1.3/configure.in
+@@ -225,7 +225,7 @@
+     LDFLAGS="${LDFLAGS} -Wl,-framework,Python"
+   fi
+ else
+-  LDFLAGS="${LDFLAGS} -L${PyLIBPL}"
++  #LDFLAGS="${LDFLAGS} -L${PyLIBPL}"
+   AC_CHECK_LIB(python${PyVERSION}, Py_NewInterpreter,
+              [ PyPYTHONLIBS="-lpython${PyVERSION}" ],
+              [ LDFLAGS="$save_LDFLAGS"
diff --git a/mod_python-3.1.4-cflags.patch b/mod_python-3.1.4-cflags.patch
new file mode 100644 (file)
index 0000000..4e07315
--- /dev/null
@@ -0,0 +1,11 @@
+--- mod_python-3.1.4/src/Makefile.in.cflags
++++ mod_python-3.1.4/src/Makefile.in
+@@ -45,7 +45,7 @@
+       @echo
+       @echo 'Compiling for DSO.'
+       @echo
+-      $(APXS) $(INCLUDES) -c $(SRCS) $(LDFLAGS) $(LIBS) @SOLARIS_HACKS@
++      $(APXS) $(INCLUDES) $(APXS_CFLAGS) -c $(SRCS) $(LDFLAGS) $(LIBS) @SOLARIS_HACKS@
+       @rm -f mod_python.so
+       @ln -s .libs/mod_python.so mod_python.so
+ clean:
diff --git a/mod_python-3.3.1-buckets.patch b/mod_python-3.3.1-buckets.patch
new file mode 100644 (file)
index 0000000..71bee74
--- /dev/null
@@ -0,0 +1,11 @@
+--- mod_python-3.3.1/src/connobject.c.buckets
++++ mod_python-3.3.1/src/connobject.c
+@@ -139,7 +139,7 @@ static PyObject * _conn_read(conn_rec *c
+     bytes_read = 0;
+     while ((bytes_read < len || len == 0) &&
+-           !(b == APR_BRIGADE_SENTINEL(b) ||
++           !(b == APR_BRIGADE_SENTINEL(bb) ||
+              APR_BUCKET_IS_EOS(b) || APR_BUCKET_IS_FLUSH(b))) {
+         const char *data;
diff --git a/mod_python-3.3.1-no-user-site-directory.patch b/mod_python-3.3.1-no-user-site-directory.patch
new file mode 100644 (file)
index 0000000..09729bc
--- /dev/null
@@ -0,0 +1,16 @@
+diff --git a/src/mod_python.c b/src/mod_python.c
+index 1c8e90e..01cfb1d 100644
+--- a/src/mod_python.c
++++ b/src/mod_python.c
+@@ -796,7 +796,10 @@ static int python_init(apr_pool_t *p, apr_pool_t *ptemp,
+     if (initialized == 0 || !Py_IsInitialized()) 
+     {
+         initialized = 1;
+-        
++
++        /* disable user site directories */
++        Py_NoUserSiteDirectory = 1;
++
+         /* initialze the interpreter */
+         Py_Initialize();
diff --git a/mod_python-3.3.1-pycapsule.patch b/mod_python-3.3.1-pycapsule.patch
new file mode 100644 (file)
index 0000000..05f41a4
--- /dev/null
@@ -0,0 +1,57 @@
+diff -Nur mod_python-3.3.1.orig/src/connobject.c mod_python-3.3.1/src/connobject.c
+--- mod_python-3.3.1.orig/src/connobject.c     2006-12-03 15:36:37.000000000 +1100
++++ mod_python-3.3.1/src/connobject.c  2010-10-20 19:33:28.853600297 +1100
+@@ -426,7 +426,7 @@
+         return (PyObject *)self->hlo;
+     }
+     else if (strcmp(name, "_conn_rec") == 0) {
+-        return PyCObject_FromVoidPtr(self->conn, 0);
++        return PyCapsule_New(self->conn, "MpConn", 0);
+     }
+     else
+         return PyMember_Get((char *)self->conn, conn_memberlist, name);
+diff -Nur mod_python-3.3.1.orig/src/mod_python.c mod_python-3.3.1/src/mod_python.c
+--- mod_python-3.3.1.orig/src/mod_python.c     2006-11-09 17:21:23.000000000 +1100
++++ mod_python-3.3.1/src/mod_python.c  2010-10-20 19:34:44.124630590 +1100
+@@ -182,7 +182,7 @@
+     idata->istate = istate;
+     /* obcallback will be created on first use */
+     idata->obcallback = NULL; 
+-    p = PyCObject_FromVoidPtr((void *) idata, NULL);
++    p = PyCapsule_New((void *) idata, "MpInterpreterData", NULL);
+     PyDict_SetItemString(interpreters, (char *)name, p);
+     Py_DECREF(p);
+@@ -261,7 +261,7 @@
+             idata = save_interpreter(name, istate);
+     }
+     else {
+-        idata = (interpreterdata *)PyCObject_AsVoidPtr(p);
++        idata = (interpreterdata *)PyCapsule_GetPointer(p, "MpInterpreterData");
+     }
+ #ifdef WITH_THREAD
+diff -Nur mod_python-3.3.1.orig/src/requestobject.c mod_python-3.3.1/src/requestobject.c
+--- mod_python-3.3.1.orig/src/requestobject.c  2006-12-03 15:36:37.000000000 +1100
++++ mod_python-3.3.1/src/requestobject.c       2010-10-20 19:33:28.853600297 +1100
+@@ -1611,7 +1611,7 @@
+         }
+     }
+     else if (strcmp(name, "_request_rec") == 0) {
+-        return PyCObject_FromVoidPtr(self->request_rec, 0);
++        return PyCapsule_New(self->request_rec, "MpRequest", 0);
+     }
+     else
+         return PyMember_GetOne((char*)self->request_rec,
+diff -Nur mod_python-3.3.1.orig/src/serverobject.c mod_python-3.3.1/src/serverobject.c
+--- mod_python-3.3.1.orig/src/serverobject.c   2006-12-03 15:36:37.000000000 +1100
++++ mod_python-3.3.1/src/serverobject.c        2010-10-20 19:33:28.856933673 +1100
+@@ -225,7 +225,7 @@
+ static PyObject *getsrv_recmbr(serverobject *self, void *name) 
+ {
+     if (strcmp(name, "_server_rec") == 0) {
+-        return PyCObject_FromVoidPtr(self->server, 0);
++        return PyCapsule_New(self->server, "MpServer", 0);
+     }
+     return PyMember_GetOne((char*)self->server,
+                            find_memberdef(server_rec_mbrs, name));
diff --git a/mod_python.spec b/mod_python.spec
new file mode 100644 (file)
index 0000000..afc9cac
--- /dev/null
@@ -0,0 +1,81 @@
+%global contentdir /var/www
+
+%define name mod_python
+%define version 3.3.1
+%define taglevel 0
+
+%define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
+
+Summary: An embedded Python interpreter for the Apache HTTP Server
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Source: http://www.apache.org/dist/httpd/modpython/%{name}-%{version}.tgz
+Source1: python.conf
+Patch1: mod_python-3.1.3-ldflags.patch
+Patch2: mod_python-3.1.4-cflags.patch
+Patch3: mod_python-3.3.1-buckets.patch
+Patch4: mod_python-3.3.1-pycapsule.patch
+Patch5: mod_python-3.3.1-no-user-site-directory.patch
+
+Packager: PlanetLab <devel@planet-lab.org>
+Distribution: PlanetLab %{plrelease}
+
+URL: http://www.modpython.org/
+License: ASL 2.0
+Group: System Environment/Daemons
+BuildRequires: httpd-devel >= 2.0.40-6, python-devel
+Requires: httpd-mmn = %(cat %{_includedir}/httpd/.mmn || echo missing)
+Requires: httpd >= 2.0.40
+
+%description
+Mod_python is a module that embeds the Python language interpreter within
+the server, allowing Apache handlers to be written in Python.
+
+Mod_python brings together the versatility of Python and the power of
+the Apache Web server for a considerable boost in flexibility and
+performance over the traditional CGI approach.
+
+%prep
+%setup -q
+%patch1 -p1 -b .ldflags
+%patch2 -p1 -b .cflags
+%patch3 -p1 -b .buckets
+%patch4 -p1 -b .capsule
+%patch5 -p1 -b .no-user-site-directory
+
+# Convert to utf-8
+for file in CREDITS NEWS; do
+    iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \
+    touch -r $file $file.new && \
+    mv $file.new $file
+done
+
+%build
+%configure --with-apxs=%{_sbindir}/apxs --with-max-locks=4
+make %{?_smp_mflags} APXS_CFLAGS="-Wc,-fno-strict-aliasing"
+
+%install
+mkdir -p $RPM_BUILD_ROOT%{_libdir}/httpd/modules
+make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
+
+# Install the config file
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d
+install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/
+
+# Install the manual.
+mkdir -p $RPM_BUILD_ROOT%{contentdir}/manual/mod/mod_python
+cp -a doc-html/* $RPM_BUILD_ROOT%{contentdir}/manual/mod/mod_python/
+
+%files
+%defattr(-,root,root,-)
+%doc README NEWS CREDITS LICENSE NOTICE
+%{contentdir}/manual/mod/mod_python
+%{_libdir}/httpd/modules/mod_python.so
+%config(noreplace) %{_sysconfdir}/httpd/conf.d/*.conf
+%{python_sitearch}/mod_python*
+
+%changelog
+* Sun May 26 2013 Thierry Parmentelat <thierry.parmentelat@inria.fr>
+- reinstate for fedora18
+- fresh start from mod_python-3.3.1-16.fc16.src.rpm
diff --git a/python.conf b/python.conf
new file mode 100644 (file)
index 0000000..2da4b7c
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Mod_python is a module that embeds the Python language interpreter
+# within the server, allowing Apache handlers to be written in Python.
+#
+
+LoadModule python_module modules/mod_python.so
+
+# Override type-map handler for /var/www/manual
+<Directory "/var/www/manual/mod/mod_python">
+       <Files *.html>
+               SetHandler default-handler
+       </Files>
+</Directory>
+
+# This will cause files beneath /var/www/html with the extension .spam
+# to be handled by the Python script /var/www/html/eggs.py
+#
+#<Directory /var/www/html>
+#    AddHandler python-program .spam
+#    PythonHandler eggs
+#</Directory>
+
+# This will cause all requests to the /python heirachy of your
+# webserver to be handled by the python script /path/to/myhandler.py
+#
+#<Location /python>
+#    SetHandler python-program
+#    PythonPath "sys.path + ['/path/to']"
+#    PythonHandler myhandler
+#</Location>
+
+# This will cause all requests to the /python hierachy of your
+# webserver to be handled by mod_python's Publisher handler
+# (see http://localhost/manual/mod/mod_python/hand-pub.html)
+#
+#<Location /python>
+#    SetHandler python-program
+#    PythonHandler mod_python.publisher
+#</Location>
+
+# This will cause the output of all requests to files beneath
+# /var/www/html with the extension .flt to be filtered through
+# the Python script /var/www/html/filter.py
+#
+#<Directory /var/www/html>
+#    PythonOutputFilter filter MYFILTER
+#    AddOutputFilter MYFILTER .flt
+#</Directory>
+
+# This will enable use of "Python Server Pages", HTML pages with
+# inline Python code which is interpreted by the server:
+#
+#<Directory /var/www/html>
+#    AddHandler mod_python .psp
+#    PythonHandler mod_python.psp
+#</Directory>
+