ports/79197: Maintainer update: www/cocoon 2.1.7

Jean-Baptiste Quenot jbq at anyware-tech.com
Thu Mar 24 13:40:09 UTC 2005


>Number:         79197
>Category:       ports
>Synopsis:       Maintainer update: www/cocoon 2.1.7
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 24 13:40:08 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Jean-Baptiste Quenot
>Release:        FreeBSD 5.3-RELEASE i386
>Organization:
Anyware Technologies -- http://www.anyware-tech.com/
>Environment:
System: FreeBSD vision.anyware 5.3-RELEASE FreeBSD 5.3-RELEASE #0: Fri Nov 5 04:19:18 UTC 2004 root at harlow.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
This is an update of Cocoon to 2.1.7.  Thanks in advance!
>How-To-Repeat:
>Fix:
diff --exclude=.svn --exclude=work --exclude=admin -ruN /usr/ports/www/cocoon/Makefile ./Makefile
--- /usr/ports/www/cocoon/Makefile	Sat Nov 20 17:53:25 2004
+++ ./Makefile	Thu Mar 24 14:31:20 2005
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=	cocoon
-PORTVERSION=	2.1.6
+PORTVERSION=	2.1.7
 CATEGORIES=	www java
 MASTER_SITES=	${MASTER_SITE_APACHE:S,%SUBDIR%,${PORTNAME},}
 DISTNAME=	${PDISTNAME}-src
@@ -35,12 +35,12 @@
 COPYDIRS=	*.txt tools/jetty tools/loader legal webapp
 
 PORT?=		8888
-PID_FILE?=	/var/run/${APP_NAME}.pid
+PID_FILE?=	${APP_HOME}/${APP_NAME}.pid
 RUNASUSER?=	www
 RUNASUID?=	80
 GROUP?=		www
 GID?=		80
-LOGFILE?=	/var/log/${APP_NAME}.log
+LOG_FILE?=	${APP_HOME}/${APP_NAME}.log
 
 SUBSTITUTIONS=	\
 	-e "s|%%APP_HOME%%|${APP_HOME}|g" \
@@ -49,12 +49,13 @@
 	-e "s|%%PORT%%|${PORT}|g" \
 	-e "s|%%COCOON_LIB%%|${COCOON_LIB}|g" \
 	-e "s|%%JAVA_HOME%%|${JAVA_HOME}|g" \
+	-e "s|%%JAVA%%|${JAVA}|g" \
 	-e "s|%%PID_FILE%%|${PID_FILE}|g" \
 	-e "s|%%RUNASUSER%%|${RUNASUSER}|g" \
 	-e "s|%%RUNASUID%%|${RUNASUID}|g" \
 	-e "s|%%GROUP%%|${GROUP}|g" \
 	-e "s|%%GID%%|${GID}|g" \
-	-e "s|%%LOGFILE%%|${LOGFILE}|g" \
+	-e "s|%%LOG_FILE%%|${LOG_FILE}|g" \
 	-e "s|%%PYTHON_CMD%%|${PYTHON_CMD}|g"
 
 # Load options (before including bsd.port.pre.mk)
@@ -102,9 +103,10 @@
 	cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./build.sh
 
 post-build:
-	${LN} -s ${WRKSRC}/build/webapp ${WRKSRC}/webapp
+	${TEST} -h ${WRKSRC}/webapp || ${LN} -s ${WRKSRC}/build/webapp ${WRKSRC}/webapp
 
 	@${ECHO_MSG} "===> Building packing list"
+	@> ${PLIST}
 
 	@cd ${WRKSRC} && ${FIND} -H ${COPYDIRS} -type f \
 	| ${SED} -e "s|^|${APP_NAME}/|" >> ${PLIST}
diff --exclude=.svn --exclude=work --exclude=admin -ruN /usr/ports/www/cocoon/Makefile.options ./Makefile.options
--- /usr/ports/www/cocoon/Makefile.options	Sat Nov 20 17:53:25 2004
+++ ./Makefile.options	Thu Mar 24 11:22:54 2005
@@ -18,6 +18,7 @@
 OPTIONS+=	LINKREWRITER	'Enable the linkrewriter block'	on
 OPTIONS+=	LUCENE	'Enable the lucene block'	on
 OPTIONS+=	NAMING	'Enable the naming block'	on
+OPTIONS+=	OJB	'Enable the ojb block'	on
 OPTIONS+=	PARANOID	'Enable the paranoid block'	on
 OPTIONS+=	POI	'Enable the poi block'	on
 OPTIONS+=	PORTAL	'Enable the portal block'	off
@@ -28,6 +29,10 @@
 OPTIONS+=	WEB3	'Enable the web3 block'	on
 OPTIONS+=	XMLDB	'Enable the xmldb block'	on
 OPTIONS+=	XSP	'Enable the xsp block'	on
+OPTIONS+=	PHP	'Enable the php block'	off
+OPTIONS+=	PORTAL_FW	'Enable the portal-fw block'	off
+OPTIONS+=	SWF	'Enable the swf block'	off
+OPTIONS+=	WOODY	'Enable the woody block'	off
 OPTIONS+=	APPLES	'Enable the apples block'	on
 OPTIONS+=	ASCIIART	'Enable the asciiart block'	on
 OPTIONS+=	AXIS	'Enable the axis block'	on
@@ -41,12 +46,11 @@
 OPTIONS+=	LINOTYPE	'Enable the linotype block'	on
 OPTIONS+=	MAIL	'Enable the mail block'	on
 OPTIONS+=	MIDI	'Enable the midi block'	on
-OPTIONS+=	OJB	'Enable the ojb block'	on
 OPTIONS+=	PETSTORE	'Enable the petstore block'	on
 OPTIONS+=	PROXY	'Enable the proxy block'	on
 OPTIONS+=	QDOX	'Enable the qdox block'	on
+OPTIONS+=	QUERYBEAN	'Enable the querybean block'	on
 OPTIONS+=	REPOSITORY	'Enable the repository block'	on
-OPTIONS+=	SCRATCHPAD	'Enable the scratchpad block'	on
 OPTIONS+=	SERIALIZERS	'Enable the serializers block'	on
 OPTIONS+=	SLIDE	'Enable the slide block'	on
 OPTIONS+=	SLOP	'Enable the slop block'	on
@@ -54,7 +58,3 @@
 OPTIONS+=	TAGLIB	'Enable the taglib block'	on
 OPTIONS+=	TOUR	'Enable the tour block'	on
 OPTIONS+=	WEBDAV	'Enable the webdav block'	on
-OPTIONS+=	PHP	'Enable the php block'	off
-OPTIONS+=	PORTAL_FW	'Enable the portal-fw block'	off
-OPTIONS+=	SWF	'Enable the swf block'	off
-OPTIONS+=	WOODY	'Enable the woody block'	off
diff --exclude=.svn --exclude=work --exclude=admin -ruN /usr/ports/www/cocoon/Makefile.test-options ./Makefile.test-options
--- /usr/ports/www/cocoon/Makefile.test-options	Sat Nov 20 17:53:25 2004
+++ ./Makefile.test-options	Thu Mar 24 11:22:27 2005
@@ -14,7 +14,6 @@
 
 .if defined(WITH_CHAPERON)
 BLOCKS+=	chaperon
-BLOCKS+=	xsp
 .endif
 
 .if defined(WITH_DATABASES)
@@ -56,14 +55,20 @@
 
 .if defined(WITH_LUCENE)
 BLOCKS+=	lucene
-BLOCKS+=	forms
-BLOCKS+=	xsp
 .endif
 
 .if defined(WITH_NAMING)
 BLOCKS+=	naming
 .endif
 
+.if defined(WITH_OJB)
+BLOCKS+=	ojb
+BLOCKS+=	databases
+BLOCKS+=	forms
+BLOCKS+=	hsqldb
+BLOCKS+=	xsp
+.endif
+
 .if defined(WITH_PARANOID)
 BLOCKS+=	paranoid
 .endif
@@ -75,7 +80,8 @@
 .if defined(WITH_PORTAL)
 BLOCKS+=	portal
 BLOCKS+=	authentication-fw
-BLOCKS+=	html
+BLOCKS+=	cron
+BLOCKS+=	forms
 BLOCKS+=	session-fw
 BLOCKS+=	xsp
 .endif
@@ -112,10 +118,29 @@
 BLOCKS+=	xsp
 .endif
 
+.if defined(WITH_PHP)
+BLOCKS+=	php
+.endif
+
+.if defined(WITH_PORTAL_FW)
+BLOCKS+=	portal-fw
+BLOCKS+=	authentication-fw
+BLOCKS+=	session-fw
+BLOCKS+=	xsp
+.endif
+
+.if defined(WITH_SWF)
+BLOCKS+=	swf
+.endif
+
+.if defined(WITH_WOODY)
+BLOCKS+=	woody
+BLOCKS+=	xsp
+.endif
+
 .if defined(WITH_APPLES)
 BLOCKS+=	apples
 BLOCKS+=	forms
-BLOCKS+=	xsp
 .endif
 
 .if defined(WITH_ASCIIART)
@@ -145,7 +170,8 @@
 .if defined(WITH_FACES)
 BLOCKS+=	faces
 BLOCKS+=	authentication-fw
-BLOCKS+=	html
+BLOCKS+=	cron
+BLOCKS+=	forms
 BLOCKS+=	portal
 BLOCKS+=	session-fw
 BLOCKS+=	taglib
@@ -154,7 +180,6 @@
 
 .if defined(WITH_FORMS)
 BLOCKS+=	forms
-BLOCKS+=	xsp
 .endif
 
 .if defined(WITH_JAVAFLOW)
@@ -186,14 +211,6 @@
 BLOCKS+=	midi
 .endif
 
-.if defined(WITH_OJB)
-BLOCKS+=	ojb
-BLOCKS+=	databases
-BLOCKS+=	forms
-BLOCKS+=	hsqldb
-BLOCKS+=	xsp
-.endif
-
 .if defined(WITH_PETSTORE)
 BLOCKS+=	petstore
 BLOCKS+=	databases
@@ -211,25 +228,22 @@
 BLOCKS+=	qdox
 .endif
 
-.if defined(WITH_REPOSITORY)
-BLOCKS+=	repository
+.if defined(WITH_QUERYBEAN)
+BLOCKS+=	querybean
 BLOCKS+=	databases
-BLOCKS+=	eventcache
+BLOCKS+=	forms
 BLOCKS+=	hsqldb
-BLOCKS+=	jms
+BLOCKS+=	lucene
+BLOCKS+=	ojb
 BLOCKS+=	xsp
 .endif
 
-.if defined(WITH_SCRATCHPAD)
-BLOCKS+=	scratchpad
-BLOCKS+=	axis
-BLOCKS+=	batik
-BLOCKS+=	cron
+.if defined(WITH_REPOSITORY)
+BLOCKS+=	repository
 BLOCKS+=	databases
 BLOCKS+=	eventcache
 BLOCKS+=	hsqldb
 BLOCKS+=	jms
-BLOCKS+=	repository
 BLOCKS+=	xsp
 .endif
 
@@ -264,7 +278,6 @@
 BLOCKS+=	batik
 BLOCKS+=	fop
 BLOCKS+=	forms
-BLOCKS+=	xsp
 .endif
 
 .if defined(WITH_WEBDAV)
@@ -274,26 +287,6 @@
 BLOCKS+=	hsqldb
 BLOCKS+=	jms
 BLOCKS+=	repository
-BLOCKS+=	xsp
-.endif
-
-.if defined(WITH_PHP)
-BLOCKS+=	php
-.endif
-
-.if defined(WITH_PORTAL_FW)
-BLOCKS+=	portal-fw
-BLOCKS+=	authentication-fw
-BLOCKS+=	session-fw
-BLOCKS+=	xsp
-.endif
-
-.if defined(WITH_SWF)
-BLOCKS+=	swf
-.endif
-
-.if defined(WITH_WOODY)
-BLOCKS+=	woody
 BLOCKS+=	xsp
 .endif
 
Binary files /usr/ports/www/cocoon/cocoon-2.1.7.tbz and ./cocoon-2.1.7.tbz differ
diff --exclude=.svn --exclude=work --exclude=admin -ruN /usr/ports/www/cocoon/distinfo ./distinfo
--- /usr/ports/www/cocoon/distinfo	Sat Nov 20 17:53:25 2004
+++ ./distinfo	Thu Mar 24 11:19:36 2005
@@ -1,2 +1,2 @@
-MD5 (cocoon-2.1.6-src.tar.gz) = d7a3a5b2c89452df95f85eeb031bbbae
-SIZE (cocoon-2.1.6-src.tar.gz) = 44430985
+MD5 (cocoon-2.1.7-src.tar.gz) = 423209dad3650e4f4fb1d76bd64a4747
+SIZE (cocoon-2.1.7-src.tar.gz) = 41950734
diff --exclude=.svn --exclude=work --exclude=admin -ruN /usr/ports/www/cocoon/files/cocoon.sh ./files/cocoon.sh
--- /usr/ports/www/cocoon/files/cocoon.sh	Fri Jul  2 00:30:19 2004
+++ ./files/cocoon.sh	Thu Mar 24 13:05:52 2005
@@ -19,7 +19,7 @@
 command=%%PREFIX%%/sbin/%%APP_NAME%%ctl
 command_args="$1"
 pidfile=%%PID_FILE%%
-procname=java
+procname=%%JAVA%%
 
 # set defaults
 
diff --exclude=.svn --exclude=work --exclude=admin -ruN /usr/ports/www/cocoon/files/cocoonctl ./files/cocoonctl
--- /usr/ports/www/cocoon/files/cocoonctl	Fri Jul  2 00:30:19 2004
+++ ./files/cocoonctl	Thu Mar 24 12:47:17 2005
@@ -6,43 +6,157 @@
 # Date Created:  2004-05-04 11:14:05
 # Revision:      $FreeBSD: ports/www/cocoon/files/cocoonctl,v 1.1 2004/07/01 22:30:19 glewis Exp $
 ################################################################################
+# Copyright (c) 2004, Jean-Baptiste Quenot <jb.quenot at caraldi.com>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+#   list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+#   this list of conditions and the following disclaimer in the documentation
+#   and/or other materials provided with the distribution.
+# * The name of the contributors may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+################################################################################
+#
+# Files handled by this script (pid file, log files) must reside in a writable
+# directory, ie the directory must be owned by the user running the program.
+
+import sys, os, signal, time, stat, re
+
+def readProcessId():
+    f = open(PID_FILE, 'r')
+    pid = int(f.readline())
+    f.close()
+    return pid
+
+def isProgramRunning(pid):
+    # Send a dummy signal to the process.  If it died, an exception is
+    # thrown
+    try:
+        os.kill(pid, signal.SIGCONT)
+        return 1
+    except OSError:
+        return 0
+
+def usage():
+    print >> sys.stderr, "Usage: %s {start|stop|restart}" % sys.argv[0]
+
+def start():
+    cwd = os.getcwd()
+    if os.path.exists(PID_FILE):
+        # Read the process id
+        pid = readProcessId()
 
-import sys, os, signal, time
+        if isProgramRunning(pid):
+            print >> sys.stderr, '%s already started' % APP_NAME
+            sys.exit(3)
+
+    if not(os.path.exists(COMMAND)):
+        print >> sys.stderr, '%s cannot be found' % COMMAND
+        sys.exit(3)
+
+    # Append program output to a log file
+    l = open(LOG_FILE, 'a')
+    orig_stderr = os.dup(sys.stderr.fileno())
+    os.dup2(l.fileno(), sys.stdout.fileno())
+    os.dup2(l.fileno(), sys.stderr.fileno())
+
+    finfo = os.stat(COMMAND)[stat.ST_MODE]
+    executable = stat.S_IMODE(finfo) & 0111
+    if not(executable):
+        sys.stderr = os.fdopen(orig_stderr, 'w')
+        print >> sys.stderr, 'Cannot run %s, execute bit is missing' % COMMAND
+        sys.exit(5)
+
+    if APP_HOME:
+        # Change current directory to APP_HOME
+        os.chdir(APP_HOME)
+
+    # Start program in the background
+    pid = os.spawnv(os.P_NOWAIT, COMMAND, ARGS)
+
+    # Wait a little
+    time.sleep(.4)
+    (status_pid, status) = os.waitpid(pid, os.WNOHANG)
+
+    # Check program exit status, if available
+    if status_pid != 0 and os.WIFEXITED(status):
+        sys.stderr = os.fdopen(orig_stderr, 'w')
+        print >> sys.stderr, 'Could not start %s.  Check %s for errors.' % (APP_NAME, LOG_FILE)
+        sys.exit(2)
+
+    # It's alive, so write down the process id
+    os.chdir(cwd)
+    f = open(PID_FILE, 'w')
+    print >> f, pid
+    f.close()
+
+def warnNotRunning():
+    if sys.argv[1] == "stop":
+        print >> sys.stderr, '%s is not running' % APP_NAME
+    else:
+        print >> sys.stderr, 'Warning: %s was not running' % APP_NAME
 
-LOGFILE = "%%LOGFILE%%"
-PREFIX = "%%PREFIX%%"
-APP_NAME = "%%APP_NAME%%"
-PID_FILE = "%%PID_FILE%%"
+def cleanup():
+    os.unlink(PID_FILE)
 
-if __name__ == '__main__':
-    if sys.argv[1] == "start":
-        # Append cocoon output to a log file
-        l = open(LOGFILE, 'a')
-        os.dup2(l.fileno(), sys.stdout.fileno())
-        os.dup2(l.fileno(), sys.stderr.fileno())
-
-        # Start cocoon in the background
-        command = PREFIX + "/sbin/" + APP_NAME + ".sh"
-        pid = os.spawnl(os.P_NOWAIT, command, command, "servlet")
+def stop():
+    if os.path.exists(PID_FILE):
+        # Read the process id
+        pid = readProcessId()
+    else:
+        warnNotRunning()
+        return
 
-        # Wait a little
-        time.sleep(0.4)
+    if not(isProgramRunning(pid)):
+        warnNotRunning()
+        cleanup()
+        return
 
-        # Send a dummy signal to the process.  If it died, an exception is
-        # thrown
-        os.kill(pid, signal.SIGCONT)
+    # Terminate program
+    os.kill(pid, signal.SIGTERM)
+
+    while isProgramRunning(pid):
+        time.sleep(.1)
+
+    cleanup()
+
+if __name__ == '__main__':
+    LOG_FILE = "%%LOG_FILE%%"
+    APP_NAME = "%%APP_NAME%%"
+    APP_HOME = "%%APP_HOME%%"
+    PID_FILE = "%%PID_FILE%%"
+    COMMAND = "%%PREFIX%%/sbin/%%APP_NAME%%.sh"
+    ARGS = [COMMAND, "servlet"]
+
+    if len(sys.argv) != 2:
+        usage()
+        sys.exit(1)
+
+    if sys.argv[1] == "start":
+        start()
 
-        # It's alive, so write down the process id
-        f = open(PID_FILE, 'w')
-        print >> f, pid
-        f.close()
     elif sys.argv[1] == "stop":
-        # Read the process id
-        f = open(PID_FILE, 'r')
-        pid = int(f.readline())
-        f.close()
+        stop()
+
+    elif sys.argv[1] == "restart":
+        stop()
+        start()
 
-        # Terminate cocoon
-        os.kill(pid, signal.SIGTERM)
     else:
-        print "Usage: %s start|stop" % sys.argv[0]
+        usage()
+        sys.exit(1)
diff --exclude=.svn --exclude=work --exclude=admin -ruN /usr/ports/www/cocoon/files/pkg-deinstall ./files/pkg-deinstall
--- /usr/ports/www/cocoon/files/pkg-deinstall	Fri Jul  2 00:30:19 2004
+++ ./files/pkg-deinstall	Thu Mar 24 11:39:42 2005
@@ -18,7 +18,7 @@
 PID_FILE=%%PID_FILE%%
 RUNASUSER=%%RUNASUSER%%
 APP_NAME=%%APP_NAME%%
-LOGFILE=%%LOGFILE%%
+LOG_FILE=%%LOG_FILE%%
 
 # Make sure we're in the right stage of the process
 if [ "$2" = "DEINSTALL" ]; then
@@ -43,8 +43,8 @@
         fi
     fi
 
-    echo -n ">> Removing log file (${LOGFILE})..."
-    if rm ${LOGFILE} > /dev/null 2> /dev/null ; then
+    echo -n ">> Removing log file (${LOG_FILE})..."
+    if rm ${LOG_FILE} > /dev/null 2> /dev/null ; then
         echo " [ DONE ]"
     else
         echo " [ FAILED ]"
diff --exclude=.svn --exclude=work --exclude=admin -ruN /usr/ports/www/cocoon/files/pkg-install ./files/pkg-install
--- /usr/ports/www/cocoon/files/pkg-install	Fri Jul  2 00:30:19 2004
+++ ./files/pkg-install	Thu Mar 24 11:40:39 2005
@@ -16,7 +16,7 @@
 GID=%%GID%%
 APP_NAME=%%APP_NAME%%
 PID_FILE=%%PID_FILE%%
-LOGFILE=%%LOGFILE%%
+LOG_FILE=%%LOG_FILE%%
 
 if [ "$2" = "POST-INSTALL" ]; then
     # We're called after the 'make install' process
@@ -48,8 +48,6 @@
     fi
 
     chown -R ${RUNASUSER}:${GROUP} $PKG_PREFIX/${APP_NAME}
-    touch ${LOGFILE} ${PID_FILE}
-    chown ${RUNASUSER}:${GROUP} ${LOGFILE} ${PID_FILE}
 fi
 
 exit 0
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list