[Pkg-erlang-commits] r1198 - in couchdb/trunk/debian: . patches

sbisbee-guest at alioth.debian.org sbisbee-guest at alioth.debian.org
Sun Feb 28 08:01:39 UTC 2010


Author: sbisbee-guest
Date: 2010-02-28 08:01:36 +0000 (Sun, 28 Feb 2010)
New Revision: 1198

Modified:
   couchdb/trunk/debian/changelog
   couchdb/trunk/debian/control
   couchdb/trunk/debian/patches/init.patch
Log:
fixing the init patch, and updating the related files

Modified: couchdb/trunk/debian/changelog
===================================================================
--- couchdb/trunk/debian/changelog	2010-02-28 02:07:50 UTC (rev 1197)
+++ couchdb/trunk/debian/changelog	2010-02-28 08:01:36 UTC (rev 1198)
@@ -6,11 +6,12 @@
 
   [ Sam Bisbee ]
   * Updated debian/patches/init.patch, adding a grace period to the init
-    script's stop task to allow couchdb's child processes (beam, heart, etc.) a
-    chance to exit before deciding whether the task was successful or not.
+    script's stop task to allow couchdb's child processes (ie., heart) a chance
+    to exit before deciding whether the task was successful or not. This adds a
+    dependency on procps (`ps` command).
   * Removed debian/preinst, undoing killall preinst patch from 0.10.0-1 that is
-    no longer needed due to the grace period init patch in this release.
-    (closes: #562901) 
+    no longer needed due to the grace period init patch in this release. This 
+    also removes the dependency on psmisc. (closes: #562901) 
 
  -- Sam Bisbee <sbisbee at computervip.com>  Tue, 02 Feb 2010 23:10:21 -0500
 

Modified: couchdb/trunk/debian/control
===================================================================
--- couchdb/trunk/debian/control	2010-02-28 02:07:50 UTC (rev 1197)
+++ couchdb/trunk/debian/control	2010-02-28 08:01:36 UTC (rev 1198)
@@ -6,7 +6,7 @@
 Standards-Version: 3.8.3
 Build-Depends: cdbs (>= 0.4.42), debhelper (>= 7.2.11),
  erlang-dev (>= 1:13.b.1-dfsg-3), help2man, libcurl4-openssl-dev,
- libicu-dev, libmozjs-dev, libreadline-dev, psmisc
+ libicu-dev, libmozjs-dev, libreadline-dev, procps
 Homepage: http://couchdb.apache.org/
 Vcs-Svn: svn+ssh://svn.debian.org/svn/pkg-erlang/couchdb
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-erlang/couchdb

Modified: couchdb/trunk/debian/patches/init.patch
===================================================================
--- couchdb/trunk/debian/patches/init.patch	2010-02-28 02:07:50 UTC (rev 1197)
+++ couchdb/trunk/debian/patches/init.patch	2010-02-28 08:01:36 UTC (rev 1198)
@@ -1,15 +1,7 @@
 --- couchdb-0.10.1/etc/init/couchdb.tpl.in	2009-07-14 16:21:39.000000000 -0400
-+++ couchdb-0.10.1.new/etc/init/couchdb.tpl.in	2010-01-25 20:49:25.000000000 -0500
-@@ -28,13 +28,17 @@
- DESCRIPTION="database server"
- NAME=couchdb
- SCRIPT_NAME=`basename $0`
--COUCHDB=%bindir%/%couchdb_command_name%
--CONFIGURATION_FILE=%sysconfdir%/default/couchdb
--RUN_DIR=%localstaterundir%
-+COUCHDB=/usr/bin/couchdb
-+CONFIGURATION_FILE=/etc/default/couchdb
-+RUN_DIR=/var/run/couchdb
++++ couchdb-0.10.1.new/etc/init/couchdb.tpl.in	2010-02-28 01:51:30.000000000 -0500
+@@ -33,8 +33,12 @@
+ RUN_DIR=%localstaterundir%
  LSB_LIBRARY=/lib/lsb/init-functions
  
 +# Grace time in seconds to give the beam process to stop when we're running the
@@ -30,14 +22,19 @@
      if test -n "$COUCHDB_USER"; then
          chown $COUCHDB_USER "$RUN_DIR"
          if su $COUCHDB_USER -c "$command" > /dev/null; then
-@@ -100,19 +105,33 @@
+@@ -100,19 +105,35 @@
      if test -n "$COUCHDB_OPTIONS"; then
          command="$command $COUCHDB_OPTIONS"
      fi
 +
-+    # Need to record here, before the file gets wiped.
 +    pid=`cat $RUN_DIR/couchdb.pid` 
++    [ -z "$pid" ] && return $SCRIPT_OK
 +
++    # We need `heart`'s pid because its ppid is set to 1 when the beam proc
++    # ends, thereby hiding itself from our `ps` check bellow.
++    heart_pid=`ps -f --ppid $pid | grep "heart -pid $pid " | awk '{print $2}'`
++    [ -n "$heart_pid" ] && heart_pid=",$heart_pid" #for `ps` call formatting
++
      if test -n "$COUCHDB_USER"; then
 -        if su $COUCHDB_USER -c "$command" > /dev/null; then
 -            return $SCRIPT_OK
@@ -55,17 +52,14 @@
      fi
 +
 +    i=0
-+    while ps -f -p $pid --ppid $pid > /dev/null
++    while ps -p $pid$heart_pid --ppid $pid$heart_pid > /dev/null 
 +    do
-+      i=`expr $i + 1`
-+      if [ $i -ge $STOP_GRACE_TIME ]
-+      then
-+        return $SCRIPT_ERROR
-+      fi
++        [ $i -ge $STOP_GRACE_TIME ] && return $SCRIPT_ERROR
 +
-+      sleep 1
++        sleep 1
++        i=`expr $i + 1`
 +    done
-+ 
++
 +    return $SCRIPT_OK
  }
  




More information about the Pkg-erlang-commits mailing list