[47693] trunk/dports/databases/couchdb-devel

febeling at macports.org febeling at macports.org
Tue Mar 3 14:47:25 PST 2009


Revision: 47693
          http://trac.macports.org/changeset/47693
Author:   febeling at macports.org
Date:     2009-03-03 14:47:23 -0800 (Tue, 03 Mar 2009)
Log Message:
-----------
databases/couchdb-devel: Fix logging, provide plist in LaunchDaemons.
* use forground process controlled by launchd/upsteam plist
* add stdout and stderr log file locations into plist
* make bin/couchdb honour stdout and stderr path options
* symlink plist into system location

Modified Paths:
--------------
    trunk/dports/databases/couchdb-devel/Portfile

Added Paths:
-----------
    trunk/dports/databases/couchdb-devel/files/
    trunk/dports/databases/couchdb-devel/files/patch-plist_stdout_stderr.diff

Modified: trunk/dports/databases/couchdb-devel/Portfile
===================================================================
--- trunk/dports/databases/couchdb-devel/Portfile	2009-03-03 21:23:10 UTC (rev 47692)
+++ trunk/dports/databases/couchdb-devel/Portfile	2009-03-03 22:47:23 UTC (rev 47693)
@@ -4,7 +4,7 @@
 
 name                couchdb-devel
 version             0.9.0a-incubating
-revision            1
+revision            2
 
 categories          databases
 platforms           darwin
@@ -30,24 +30,31 @@
     port:spidermonkey \
     port:erlang
 
+patchfiles      patch-plist_stdout_stderr.diff
+
+pre-configure {
+    system "cd ${worksrcpath}; ./bootstrap"
+}
+
 set dbgroup couchdb
 set dbuser couchdb
 set logdir ${prefix}/var/log/couchdb
 set dbdir ${prefix}/var/lib/couchdb
+set plistdir /Library/LaunchDaemons
 
-pre-configure {
-    system "cd ${worksrcpath}; ./bootstrap"
-}
-
-pre-destroot {
+post-destroot {
     addgroup ${dbgroup}
     adduser ${dbuser} gid=[existsgroup ${dbgroup}]
     xinstall -m 755 -o ${dbuser} -g ${dbgroup} -d \
 	${destroot}${dbdir} \
-	${destroot}${logdir}
+	${destroot}${logdir} \
+	${destroot}${plistdir}
     destroot.keepdirs-append \
         ${destroot}${dbdir} \
         ${destroot}${logdir}
+    set plist org.apache.couchdb.plist
+    ln -sf ${destroot}${prefix}${plistdir}${plist} \
+        ${destroot}${plistdir}/${plist}
 }
 
 livecheck.check	regex

Added: trunk/dports/databases/couchdb-devel/files/patch-plist_stdout_stderr.diff
===================================================================
--- trunk/dports/databases/couchdb-devel/files/patch-plist_stdout_stderr.diff	                        (rev 0)
+++ trunk/dports/databases/couchdb-devel/files/patch-plist_stdout_stderr.diff	2009-03-03 22:47:23 UTC (rev 47693)
@@ -0,0 +1,62 @@
+Index: bin/couchdb.tpl.in
+===================================================================
+--- bin/couchdb.tpl.in	(revision 748340)
++++ bin/couchdb.tpl.in	(working copy)
+@@ -222,7 +222,16 @@
+                 sleep $RESPAWN_TIMEOUT
+             done
+         else
+-            eval exec $command
++            if test "$PID_FILE_GIVEN" = "true"; then
++                PID_FLAG="-pidfile $PID_FILE"
++            fi
++            if test "$STDOUT_REDIR" = "true"; then
++                STDOUT_DEST="> $STDOUT_FILE"
++            fi
++            if test "$STDERR_REDIR" = "true"; then
++                STDERR_DEST="2> $STDERR_FILE"
++            fi
++            eval exec $command $PID_FLAG $STDOUT_DEST $STDERR_DEST
+         fi
+     fi
+ }
+@@ -273,9 +282,9 @@
+             -b) shift; BACKGROUND_BOOLEAN=true;;
+             -r) shift; RESPAWN_TIMEOUT=$1; shift;;
+             -R) shift; RECURSED_BOOLEAN=true;;
+-            -p) shift; PID_FILE=$1; shift;;
+-            -o) shift; STDOUT_FILE=$1; shift;;
+-            -e) shift; STDERR_FILE=$1; shift;;
++            -p) shift; PID_FILE=$1; PID_FILE_GIVEN=true; shift;;
++            -o) shift; STDOUT_FILE=$1; STDOUT_REDIR=true; shift;;
++            -e) shift; STDERR_FILE=$1; STDERR_REDIR=true; shift;;
+             -s) shift; check_status; exit $SCRIPT_OK;;
+             -k) shift; KILL_BOOLEAN=true;;
+             -d) shift; SHUTDOWN_BOOLEAN=true;;
+Index: etc/Makefile.am
+===================================================================
+--- etc/Makefile.am	(revision 748340)
++++ etc/Makefile.am	(working copy)
+@@ -58,6 +58,7 @@
+ 	fi
+ 	sed -e "s|%configure_input%|$@. Generated from $< by configure.|" \
+ 	    -e "s|%bindir%|$(bindir)|" \
++	    -e "s|%localstatelogdir%|$(localstatelogdir)|" \
+ 	    -e "s|%couchdb_command_name%|$(couchdb_command_name)|" \
+ 	< $< > $@
+ 
+Index: etc/launchd/org.apache.couchdb.plist.tpl.in
+===================================================================
+--- etc/launchd/org.apache.couchdb.plist.tpl.in	(revision 748340)
++++ etc/launchd/org.apache.couchdb.plist.tpl.in	(working copy)
+@@ -15,6 +15,10 @@
+     <key>ProgramArguments</key>
+     <array>
+       <string>%bindir%/%couchdb_command_name%</string>
++      <string>-o</string>
++      <string>%localstatelogdir%/couchdb.stdout</string>
++      <string>-e</string>
++      <string>%localstatelogdir%/couchdb.stderr</string>
+     </array>
+     <key>UserName</key>
+     <string>couchdb</string>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090303/7ecf7abf/attachment.html>


More information about the macports-changes mailing list