Hello community,

here is the log from the commit of package python-scgi for openSUSE:Factory 
checked in at 2013-05-02 11:44:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-scgi (Old)
 and      /work/SRC/openSUSE:Factory/.python-scgi.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-scgi"

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-scgi/python-scgi.changes  2012-01-30 
12:28:20.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.python-scgi.new/python-scgi.changes     
2013-05-02 11:44:45.000000000 +0200
@@ -1,0 +2,11 @@
+Tue Apr 23 21:49:28 UTC 2013 - [email protected]
+
+- Update to version 1.14:
+  + Improve logic for reaping dead child processes.
+  + Properly handle interrupted system calls while doing a restart.
+  + Drop GIL when passing file descriptors.
+  + Add target to build multi-architecture mod_scgi for Mac OS.
+- Rebase python-scgi-newstyle-classes.patch.
+- Add python-scgi-apache24.patch: Port to Apache 2.4.
+
+-------------------------------------------------------------------

Old:
----
  scgi-1.13.tar.gz

New:
----
  python-scgi-apache24.patch
  scgi-1.14.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-scgi.spec ++++++
--- /var/tmp/diff_new_pack.DZjVEB/_old  2013-05-02 11:44:46.000000000 +0200
+++ /var/tmp/diff_new_pack.DZjVEB/_new  2013-05-02 11:44:46.000000000 +0200
@@ -1,7 +1,7 @@
 #
-# spec file for package python-scgi (Version 1.13)
+# spec file for package python-scgi
 #
-# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -15,17 +15,15 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
-# norootforbuild
-
 
 Name:           python-scgi
-Version:        1.13
-Release:        1
+Version:        1.14
+Release:        0
 #
-Group:          Development/Libraries/Python
-License:        SUSE-Python-1.6
 #
-BuildRequires:  apache2-devel pcre-devel python-devel
+BuildRequires:  apache2-devel
+BuildRequires:  pcre-devel
+BuildRequires:  python-devel
 %define        apxs    /usr/sbin/apxs2
 %define        apache_libexecdir       %(%{apxs} -q LIBEXECDIR)
 %define apache_mmn        %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && 
$MMN)
@@ -37,8 +35,11 @@
 Source:         http://python.ca/scgi/releases/scgi-%{version}.tar.gz
 Patch0:         python-scgi-newstyle-classes.patch
 Patch1:         python-scgi-1.13_documentation_path.patch
+Patch2:         python-scgi-apache24.patch
 #
-Summary:        Python implementation of the SCGI protocol.
+Summary:        Python implementation of the SCGI protocol
+License:        SUSE-Python-1.6
+Group:          Development/Libraries/Python
 
 %description
 The SCGI protocol is a replacement for the Common Gateway Interface
@@ -48,18 +49,12 @@
 
 This package contains the python bindings.
 
-
-
-Authors:
---------
-    Neil Schemenauer <[email protected]>
-
 %package -n apache2-mod_scgi
-License:        SUSE-Python-1.6
-Group:          Development/Libraries/Python
-Requires:       apache2 %{apache_mmn}
+Requires:       %{apache_mmn}
+Requires:       apache2
 #
-Summary:        Apache module named mod_scgi that implements the client side 
of the protocol.
+Summary:        Apache module named mod_scgi that implements the client side 
of the protocol
+Group:          Development/Libraries/Python
 
 %description -n apache2-mod_scgi
 The SCGI protocol is a replacement for the Common Gateway Interface
@@ -71,16 +66,11 @@
 
 To load mod_python into Apache, run the command "a2enmod scgi" as root.
 
-
-
-Authors:
---------
-    Neil Schemenauer <[email protected]>
-
 %prep
 %setup -n scgi-%{version}
 %patch0 -p1
 %patch1
+%patch2 -p1
 
 %build
 CFLAGS="%{optflags}" \

++++++ python-scgi-apache24.patch ++++++
--- a/apache2/mod_scgi.c
+++ b/apache2/mod_scgi.c
@@ -135,16 +135,16 @@
     return DECLINED;
 }
 
-static void log_err(const char *file, int line, request_rec *r,
+static void log_err(const char *file, int line, int index, request_rec *r,
                     apr_status_t status, const char *msg)
 {
-    ap_log_rerror(file, line, APLOG_ERR, status, r, "scgi: %s", msg);
+    ap_log_rerror(file, line, index, APLOG_ERR, status, r, "scgi: %s", msg);
 }
 
-static void log_debug(const char *file, int line, request_rec *r, const
+static void log_debug(const char *file, int line, int index, request_rec *r, 
const
                       char *msg)
 {
-    ap_log_rerror(file, line, APLOG_DEBUG, APR_SUCCESS, r, msg);
+    ap_log_rerror(file, line, index, APLOG_DEBUG, APR_SUCCESS, r, "%s", msg);
 }
 
 static char *http2env(apr_pool_t *p, const char *name)
@@ -312,7 +312,7 @@
     int i;
     apr_status_t rv = 0;
     apr_port_t  port = 0;
-    GET_PORT(port, r->connection->remote_addr);
+    GET_PORT(port, r->useragent_addr);
 
     log_debug(APLOG_MARK,r, "sending headers");
     t = apr_table_make(r->pool, 40);
@@ -324,14 +324,14 @@
            buf = "0";
     add_header(t, "CONTENT_LENGTH",  buf);
     add_header(t, "SCGI", SCGI_PROTOCOL_VERSION);
-    add_header(t, "SERVER_SOFTWARE", ap_get_server_version());
+    add_header(t, "SERVER_SOFTWARE", ap_get_server_banner());
     add_header(t, "SERVER_PROTOCOL", r->protocol);
     add_header(t, "SERVER_NAME", ap_get_server_name(r));
     add_header(t, "SERVER_ADMIN", r->server->server_admin);
     add_header(t, "SERVER_ADDR", r->connection->local_ip);
     add_header(t, "SERVER_PORT", apr_psprintf(r->pool, "%u",
                                               ap_get_server_port(r)));
-    add_header(t, "REMOTE_ADDR", r->connection->remote_ip);
+    add_header(t, "REMOTE_ADDR", r->useragent_ip);
     add_header(t, "REMOTE_PORT", apr_psprintf(r->pool, "%d", port));
     add_header(t, "REMOTE_USER", r->user);
     add_header(t, "REQUEST_METHOD", r->method);
++++++ python-scgi-newstyle-classes.patch ++++++
--- /var/tmp/diff_new_pack.DZjVEB/_old  2013-05-02 11:44:46.000000000 +0200
+++ /var/tmp/diff_new_pack.DZjVEB/_new  2013-05-02 11:44:46.000000000 +0200
@@ -1,17 +1,17 @@
-diff --git a/scgi/scgi_server.py b/scgi/scgi_server.py
-index 0ff8453..19cbe0e 100644
---- a/scgi/scgi_server.py
-+++ b/scgi/scgi_server.py
-@@ -48,7 +48,7 @@ def read_env(input):
-         env[items[i]] = items[i+1]
-     return env
+Index: scgi-1.14/scgi/scgi_server.py
+===================================================================
+--- scgi-1.14.orig/scgi/scgi_server.py
++++ scgi-1.14/scgi/scgi_server.py
+@@ -61,7 +61,7 @@ class Child:
+         self.closed = 1
+ 
  
 -class SCGIHandler:
 +class SCGIHandler(object):
  
      # Subclasses should override the handle_connection method.
  
-@@ -159,7 +159,7 @@ class SCGIHandler:
+@@ -172,7 +172,7 @@ class SCGIHandler:
              print "%s: %r" % (k, v)
  
  

++++++ scgi-1.13.tar.gz -> scgi-1.14.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scgi-1.13/CHANGES.txt new/scgi-1.14/CHANGES.txt
--- old/scgi-1.13/CHANGES.txt   2008-06-28 01:40:10.000000000 +0200
+++ new/scgi-1.14/CHANGES.txt   2009-11-22 00:05:18.000000000 +0100
@@ -1,3 +1,41 @@
+Summary of changes
+==================
+
+v1.14
+-----
+
+Author: Neil Schemenauer <[email protected]>
+Date:   Sat Nov 21 17:02:23 2009 -0600
+
+    Update version numbers for v1.14 release.
+
+Author: Neil Schemenauer <[email protected]>
+Date:   Tue Oct 27 17:06:12 2009 -0600
+
+    Improve logic for reaping dead child processes.
+    
+    Simply the logic for reaping dead children. This also fixes some
+    corner case bugs related to signal handling.
+
+Author: Neil Schemenauer <[email protected]>
+Date:   Mon Jul 20 11:16:23 2009 -0600
+
+    Properly handle interrupted system calls while doing a restart.
+
+Author: Neil Schemenauer <[email protected]>
+Date:   Thu Jul 9 21:35:42 2009 -0600
+
+    Drop GIL when passing file descriptors.
+
+Author: Neil Schemenauer <[email protected]>
+Date:   Sat Aug 9 18:12:22 2008 -0600
+
+    Add target to build multi-architecture mod_scgi for Mac OS.
+
+
+v1.13
+-----
+
 Author: Neil Schemenauer <[email protected]>
 Date:   Wed Jun 11 17:40:47 2008 -0600
 
@@ -33,6 +71,10 @@
     the path being served by SCGI exists on the filesystem.  Ensure that
     PATH_INFO is correct.  Thanks to David Binger for point out the fix.
 
+
+v1.12
+-----
+
 Author: Jeroen T. Vermeulen <[email protected]>
 Date:   Wed Feb 7 11:28:22 2007 -0600
 
@@ -88,6 +130,10 @@
 
     Add some pypi information.
 
+
+v1.11
+-----
+
 Author: Neil Schemenauer <[email protected]>
 Date:   Mon Aug 14 15:49:04 2006 -0600
 
@@ -149,3 +195,4 @@
 Date:   Fri May 19 09:30:23 2006 -0600
 
     Import scgi 1.10.
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scgi-1.13/PKG-INFO new/scgi-1.14/PKG-INFO
--- old/scgi-1.13/PKG-INFO      2008-06-28 01:40:10.000000000 +0200
+++ new/scgi-1.14/PKG-INFO      2009-11-22 00:05:18.000000000 +0100
@@ -1,12 +1,12 @@
 Metadata-Version: 1.0
 Name: scgi
-Version: 1.13
+Version: 1.14
 Summary: A Python package for implementing SCGI servers.
 Home-page: http://python.ca/scgi/
 Author: Neil Schemenauer
 Author-email: [email protected]
 License: DFSG approved (see LICENSE.txt)
-Download-URL: http://python.ca/scgi/releases/scgi-1.13.tar.gz
+Download-URL: http://python.ca/scgi/releases/scgi-1.14.tar.gz
 Description: UNKNOWN
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scgi-1.13/apache1/mod_scgi.c 
new/scgi-1.14/apache1/mod_scgi.c
--- old/scgi-1.13/apache1/mod_scgi.c    2008-06-12 01:42:36.000000000 +0200
+++ new/scgi-1.14/apache1/mod_scgi.c    2009-11-22 00:02:09.000000000 +0100
@@ -1,4 +1,4 @@
-#define MOD_SCGI_VERSION "1.13"
+#define MOD_SCGI_VERSION "1.14"
 #define SCGI_PROTOCOL_VERSION "1"
 /* #define VERBOSE_DEBUG */
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scgi-1.13/apache2/Makefile 
new/scgi-1.14/apache2/Makefile
--- old/scgi-1.13/apache2/Makefile      2008-06-12 01:42:30.000000000 +0200
+++ new/scgi-1.14/apache2/Makefile      2008-11-01 08:43:38.000000000 +0100
@@ -2,13 +2,21 @@
 APXS=apxs2
 APACHECTL=apache2ctl
 
+# Extra args for building a multi-architecture version OS X 10.5.
+UNIVERSAL="-arch ppc7400 -arch ppc64 -arch i386 -arch x86_64"
+
 all:
        $(APXS) -c mod_scgi.c
 
-# XXX should not need the -c option but for some reason it's required :-(
 install:
        $(APXS) -i -c mod_scgi.c
 
+universal:
+       $(APXS) -c -Wl,$(UNIVERSAL) -Wc,$(UNIVERSAL) mod_scgi.c
+
+install_universal:
+       $(APXS) -c -Wl,$(UNIVERSAL) -Wc,$(UNIVERSAL) mod_scgi.c
+
 clean:
        rm -rf mod_scgi.o mod_scgi.lo mod_scgi.slo mod_scgi.la .libs
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scgi-1.13/apache2/mod_scgi.c 
new/scgi-1.14/apache2/mod_scgi.c
--- old/scgi-1.13/apache2/mod_scgi.c    2008-06-12 01:42:36.000000000 +0200
+++ new/scgi-1.14/apache2/mod_scgi.c    2009-11-22 00:02:06.000000000 +0100
@@ -4,7 +4,7 @@
  *
  */
 
-#define MOD_SCGI_VERSION "1.13"
+#define MOD_SCGI_VERSION "1.14"
 #define SCGI_PROTOCOL_VERSION "1"
 
 #include "ap_config.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scgi-1.13/scgi/__init__.py 
new/scgi-1.14/scgi/__init__.py
--- old/scgi-1.13/scgi/__init__.py      2008-06-12 01:42:36.000000000 +0200
+++ new/scgi-1.14/scgi/__init__.py      2009-11-22 00:02:01.000000000 +0100
@@ -1 +1 @@
-__version__ = "1.13"
+__version__ = "1.14"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scgi-1.13/scgi/passfd.c new/scgi-1.14/scgi/passfd.c
--- old/scgi-1.13/scgi/passfd.c 2008-06-12 01:42:31.000000000 +0200
+++ new/scgi-1.14/scgi/passfd.c 2009-07-10 05:33:34.000000000 +0200
@@ -42,6 +42,7 @@
 static int
 recv_fd(int sockfd)
 {
+       ssize_t rv;
        char tmp[CMSG_SPACE(sizeof(int))];
        struct cmsghdr *cmsg;
        struct iovec iov;
@@ -56,8 +57,12 @@
        msg.msg_control = tmp;
        msg.msg_controllen = sizeof(tmp);
 
-       if (recvmsg(sockfd, &msg, 0) <= 0)
+       Py_BEGIN_ALLOW_THREADS
+       rv = recvmsg(sockfd, &msg, 0);
+       Py_END_ALLOW_THREADS
+       if (rv <= 0) {
                return -1;
+       }
        cmsg = CMSG_FIRSTHDR(&msg);
        return *(int *) CMSG_DATA(cmsg);
 }
@@ -65,6 +70,7 @@
 static int
 send_fd (int sockfd, int fd)
 {
+       ssize_t rv;
        char tmp[CMSG_SPACE(sizeof(int))];
        struct cmsghdr *cmsg;
        struct iovec iov;
@@ -84,7 +90,10 @@
        msg.msg_iov = &iov;
        msg.msg_iovlen = 1;
 
-       if (sendmsg(sockfd, &msg, 0) != 1)
+       Py_BEGIN_ALLOW_THREADS
+       rv = sendmsg(sockfd, &msg, 0);
+       Py_END_ALLOW_THREADS
+       if (rv != 1)
                return -1;
 
        return 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scgi-1.13/scgi/scgi_server.py 
new/scgi-1.14/scgi/scgi_server.py
--- old/scgi-1.13/scgi/scgi_server.py   2008-06-12 01:42:31.000000000 +0200
+++ new/scgi-1.14/scgi/scgi_server.py   2009-11-21 23:59:58.000000000 +0100
@@ -48,6 +48,19 @@
         env[items[i]] = items[i+1]
     return env
 
+
+class Child:
+    def __init__(self, pid, fd):
+        self.pid = pid
+        self.fd = fd
+        self.closed = 0
+
+    def close(self):
+        if not self.closed:
+            os.close(self.fd)
+        self.closed = 1
+
+
 class SCGIHandler:
 
     # Subclasses should override the handle_connection method.
@@ -169,7 +182,7 @@
         self.host = host
         self.port = port
         self.max_children = max_children
-        self.children = {} # { pid : fd }
+        self.children = []
         self.spawn_child()
         self.restart = 0
 
@@ -196,42 +209,33 @@
             sys.exit(0)
         else:
             os.close(parent_fd)
-            self.children[pid] = child_fd
+            self.children.append(Child(pid, child_fd))
+
+    def get_child(self, pid):
+        for child in self.children:
+            if child.pid == pid:
+                return child
+        return None
 
     def reap_children(self):
         while self.children:
             (pid, status) = os.waitpid(-1, os.WNOHANG)
             if pid <= 0:
                 break
-            os.close(self.children[pid])
-            del self.children[pid]
+            child = self.get_child(pid)
+            child.close()
+            self.children.remove(child)
 
     def do_stop(self):
-        #
-        # First close connections to the children, which will cause them
-        # to exit after finishing what they are doing.
-        #
-        for fd in self.children.values():
-            os.close(fd)
-        #
-        # Then do a blocking wait on each until we have cleared the
-        # slate.
-        #
-        for pid in self.children.keys():
-            (pid, status) = os.waitpid(pid, 0)
-        self.children = {}
+        # Close connections to the children, which will cause them to exit
+        # after finishing what they are doing.
+        for child in self.children:
+            child.close()
 
     def do_restart(self):
-        # Stop
         self.do_stop()
-
-        #
-        # Fire off a new child, we'll be wanting it soon.
-        #
-        self.spawn_child()
         self.restart = 0
 
-
     def delegate_request(self, conn):
         """Pass a request fd to a child process to handle.  This method
         blocks if all the children are busy and we have reached the
@@ -251,8 +255,9 @@
         timeout = 0
 
         while 1:
+            fds = [child.fd for child in self.children if not child.closed]
             try:
-                r, w, e = select.select(self.children.values(), [], [], 
timeout)
+                r, w, e = select.select(fds, [], [], timeout)
             except select.error, e:
                 if e[0] == errno.EINTR:  # got a signal, try again
                     continue
@@ -261,8 +266,12 @@
                 # One or more children look like they are ready.  Sort
                 # the file descriptions so that we keep preferring the
                 # same child.
-                r.sort()
-                child_fd = r[0]
+                child = None
+                for child in self.children:
+                    if not child.closed and child.fd in r:
+                        break
+                if child is None:
+                    continue # no child found, should not get here
 
                 # Try to read the single byte written by the child.
                 # This can fail if the child died or the pipe really
@@ -271,7 +280,7 @@
                 # we fall through to the "reap_children" logic and will
                 # retry the select call.
                 try:
-                    ready_byte = os.read(child_fd, 1)
+                    ready_byte = os.read(child.fd, 1)
                     if not ready_byte:
                         raise IOError # child died?
                     assert ready_byte == "1", repr(ready_byte)
@@ -289,7 +298,7 @@
                     # through to the "reap_children" logic and will
                     # retry the select call.
                     try:
-                        passfd.sendfd(child_fd, conn.fileno())
+                        passfd.sendfd(child.fd, conn.fileno())
                     except IOError, exc:
                         if exc.errno == errno.EPIPE:
                             pass # broken pipe, child died?

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to