From blaz@gold.inlimbo.org  Mon Aug 13 08:31:29 2007
Return-Path: <blaz@gold.inlimbo.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4669A16A419
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 13 Aug 2007 08:31:24 +0000 (UTC)
	(envelope-from blaz@gold.inlimbo.org)
Received: from gold.inlimbo.org (gold.inlimbo.org [212.18.63.73])
	by mx1.freebsd.org (Postfix) with ESMTP id 9831D13C45A
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 13 Aug 2007 08:31:23 +0000 (UTC)
	(envelope-from blaz@gold.inlimbo.org)
Received: by gold.inlimbo.org (Postfix, from userid 1000)
	id 6C203307841; Mon, 13 Aug 2007 10:20:12 +0200 (CEST)
Message-Id: <20070813082012.6C203307841@gold.inlimbo.org>
Date: Mon, 13 Aug 2007 10:20:12 +0200 (CEST)
From: Blaz Zupan <blaz@si.FreeBSD.org>
Reply-To: Blaz Zupan <blaz@si.FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: steve@energistic.com
Subject: Update for net/mediaproxy port 
X-Send-Pr-Version: 3.113
X-GNATS-Notify: steve@energistic.com

>Number:         115459
>Category:       ports
>Synopsis:       Update for net/mediaproxy port
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    miwi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 13 08:40:01 GMT 2007
>Closed-Date:    Fri Sep 14 09:58:51 GMT 2007
>Last-Modified:  Fri Sep 14 09:58:51 GMT 2007
>Originator:     Blaz Zupan
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
>Environment:
System: FreeBSD gold.inlimbo.org 6.2-STABLE FreeBSD 6.2-STABLE #7: Sun Aug 12 20:15:44 CEST 2007 blaz@gold.inlimbo.org:/usr/obj/usr/src/sys/GOLD i386

>Description:

The net/mediaproxy is broken in multiple ways:

1. The proxy dispatcher does not start if py-MySQLdb is not installed,
but the port has no dependency on py-MySQLdb.

2. The proxy dispatcher does not start if pyrad (Python RADIUS) is not
installed, but there is no FreeBSD port of it and no dependency on it
in the port.

3. The port does not deinstall cleanly, because Python generates compiled
files when you startup mediaproxy and the compiled files are not included
in the pkg-plist.

The attached patch fixes those problems. I have removed the accounting option,
because the dependency on MySQL seems to be hardcoded in mediaproxy. The
patch includes a dependency on pyrad, I will submit a port of pyrad in a
separate PR.

>How-To-Repeat:
	
>Fix:

diff -urN mediaproxy.orig/Makefile mediaproxy/Makefile
--- mediaproxy.orig/Makefile	2007-06-01 09:27:12.000000000 +0200
+++ mediaproxy/Makefile	2007-08-13 09:57:47.000000000 +0200
@@ -6,7 +6,7 @@
 
 PORTNAME=	mediaproxy
 PORTVERSION=	1.8.2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net
 MASTER_SITES=	http://mediaproxy.ag-projects.com/ \
 		http://mediaproxy.ag-projects.com/old/
@@ -15,22 +15,17 @@
 MAINTAINER=	steve@energistic.com
 COMMENT=	A far-end NAT traversal solution for SER/OpenSER
 
-USE_RC_SUBR=	mediaproxy.sh
-
-WRKSRC=		${WRKDIR}/${PORTNAME}
+RUN_DEPENDS=	${LOCALBASE}/lib/${PYTHON_VERSION}/site-packages/MySQLdb/__init__.py:${PORTSDIR}/databases/py-MySQLdb
+RUN_DEPENDS+=	${LOCALBASE}/lib/${PYTHON_VERSION}/site-packages/pyrad/__init__.py:${PORTSDIR}/net/pyrad
 
+USE_RC_SUBR=	mediaproxy proxydispatcher
 USE_PYTHON=	2.3+
 
-OPTIONS=	ACCOUNTING "ACCOUNTING support (Requires MySQL)" off
-
-.include <bsd.port.pre.mk>
-
-.if defined(WITH_ACCOUNTING)
-USE_MYSQL=	yes
-.endif
+post-extract:
+	${MV} ${WRKDIR}/${PORTNAME} ${WRKSRC}
 
 post-install:
 	${CP} -pRP ${WRKSRC}/ ${PREFIX}/mediaproxy
 	${CHOWN} -R 0:0 ${PREFIX}/mediaproxy
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff -urN mediaproxy.orig/files/mediaproxy.in mediaproxy/files/mediaproxy.in
--- mediaproxy.orig/files/mediaproxy.in	1970-01-01 01:00:00.000000000 +0100
+++ mediaproxy/files/mediaproxy.in	2007-08-13 09:56:21.000000000 +0200
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: mediaproxy
+# BEFORE: proxydispatcher openser ser
+#
+prefix=%%PREFIX%%
+
+# Add the following lines to /etc/rc.conf to enable mediaproxy:
+#
+# mediaproxy_enable="YES"
+
+. %%RC_SUBR%%
+
+name="mediaproxy"
+rcvar=`set_rcvar`
+command="${prefix}/bin/python"
+command_args="${prefix}/mediaproxy/mediaproxy.py"
+pidfile=${mediaproxy_pidfile:-"/var/run/mediaproxy.pid"}
+sig_stop="KILL"
+
+load_rc_config $name
+
+: ${mediaproxy_enable="NO"}
+
+stop_postcmd=stop_postcmd
+
+stop_postcmd()
+{
+  rm -f $pidfile
+}
+  
+run_rc_command "$1"
diff -urN mediaproxy.orig/files/mediaproxy.sh.in mediaproxy/files/mediaproxy.sh.in
--- mediaproxy.orig/files/mediaproxy.sh.in	2006-09-28 00:05:43.000000000 +0200
+++ mediaproxy/files/mediaproxy.sh.in	1970-01-01 01:00:00.000000000 +0100
@@ -1,86 +0,0 @@
-#!/bin/sh
-#
-# mediaproxy   starts and stops the SER MediaProxy server
-
-# PROVIDE: mediaproxy
-
-# Add the following line to /etc/rc.conf to enable mysql:
-# mediaproxy_enable (bool):	Set to "NO" by default.
-#				Set it to "YES" to enable mediaproxy.
-
-. /etc/rc.subr
-
-name="mediaproxy"
-rcvar=`set_rcvar`
-
-load_rc_config $name
-
-: ${mediaproxy_enable="NO"}
-
-INSTALL_DIR="%%PREFIX%%"
-RUNTIME_DIR="/var/run"
-
-PROXY="$INSTALL_DIR/mediaproxy/mediaproxy.py"
-DISPATCHER="$INSTALL_DIR/mediaproxy/proxydispatcher.py"
-PROXY_PID="$RUNTIME_DIR/mediaproxy.pid"
-DISPATCHER_PID="$RUNTIME_DIR/proxydispatcher.pid"
-
-# Options for mediaproxy and dispatcher. Do not include --pid <pidfile>
-# --pid <pidfile> will be added automatically if needed.
-PROXY_OPTIONS=""
-DISPATCHER_OPTIONS=""
-
-NAME="mediaproxy"
-DESC="SER MediaProxy server"
-
-echo $PROXY
-test -f $PROXY      || exit 0
-test -f $DISPATCHER || exit 0
-
-if [ "$PROXY_PID" != "/var/run/mediaproxy.pid" ]; then
-    PROXY_OPTIONS="--pid $PROXY_PID $PROXY_OPTIONS"
-fi
-if [ "$DISPATCHER_PID" != "/var/run/proxydispatcher.pid" ]; then
-    DISPATCHER_OPTIONS="--pid $DISPATCHER_PID $DISPATCHER_OPTIONS"
-fi
-
-start() {
-    if [ $mediaproxy_enable = "YES" ]; then
-        echo -n "Starting $DESC: $NAME"
-        $PROXY $PROXY_OPTIONS
-        $DISPATCHER $DISPATCHER_OPTIONS
-        echo "."
-    fi
-}
-
-stop () {
-    echo -n "Stopping $DESC: $NAME"
-    if [ -f $PROXY_PID ]; then
-        kill `cat $PROXY_PID`
-    fi
-    if [ -f $DISPATCHER_PID ]; then
-        kill `cat $DISPATCHER_PID`
-    fi
-    echo "."
-}
-
-case "$1" in
-    start)
-        start
-        ;;
-    stop)
-        stop
-        ;;
-    restart|force-reload)
-        stop
-        #sleep 1
-        start
-        ;;
-    *)
-        echo "Usage: ${INSTALL_DIR}/etc/rc.d/$NAME {start|stop|restart|force-reload}" >&2
-        exit 1
-        ;;
-esac
-
-exit 0
-
diff -urN mediaproxy.orig/files/proxydispatcher.in mediaproxy/files/proxydispatcher.in
--- mediaproxy.orig/files/proxydispatcher.in	1970-01-01 01:00:00.000000000 +0100
+++ mediaproxy/files/proxydispatcher.in	2007-08-13 09:56:21.000000000 +0200
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: proxydispatcher
+# BEFORE: openser ser
+#
+prefix=%%PREFIX%%
+
+# Add the following lines to /etc/rc.conf to enable proxydispatcher:
+#
+# proxydispatcher_enable="YES"
+
+. %%RC_SUBR%%
+
+name="proxydispatcher"
+rcvar=`set_rcvar`
+command="${prefix}/bin/python"
+command_args="${prefix}/mediaproxy/proxydispatcher.py"
+pidfile=${proxydispatcher_pidfile:-"/var/run/proxydispatcher.pid"}
+sig_stop="KILL"
+
+load_rc_config $name
+
+: ${proxydispatcher_enable="NO"}
+
+stop_postcmd=stop_postcmd
+
+stop_postcmd()
+{
+  rm -f $pidfile
+}
+
+run_rc_command "$1"
diff -urN mediaproxy.orig/pkg-plist mediaproxy/pkg-plist
--- mediaproxy.orig/pkg-plist	2007-06-01 09:27:12.000000000 +0200
+++ mediaproxy/pkg-plist	2007-08-13 10:07:52.000000000 +0200
@@ -195,6 +195,9 @@
 mediaproxy/web/images/40/zoep.png
 mediaproxy/web/images/40/zyxel-p2000.png
 mediaproxy/web/media_sessions.phtml
+@unexec rm -f %D/mediaproxy/modules/external/DNS/*.pyc
+@unexec rm -f %D/mediaproxy/modules/external/*.pyc
+@unexec rm -f %D/mediaproxy/modules/*.pyc
 @dirrm mediaproxy/web/images/40
 @dirrm mediaproxy/web/images/35
 @dirrm mediaproxy/web/images/30
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Mon Aug 13 08:40:13 UTC 2007 
State-Changed-Why:  
Awaiting maintainers feedback 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115459 

From: Steve Ames <steve@energistic.com>
To: bug-followup@FreeBSD.ORG
Cc:  
Subject: Re: ports/115459: Update for net/mediaproxy port
Date: Mon, 13 Aug 2007 11:49:33 -0400

 Approved. It does have a dependancy on a seperate PR to add
 a new port so that PR will need to be handled first or
 net/mediaproxy will cease compiling.
 
 On Mon, Aug 13, 2007 at 08:40:08AM +0000, Edwin Groothuis wrote:
 > Maintainer of net/mediaproxy,
 > 
 > Please note that PR ports/115459 has just been submitted.
 > 
 > If it contains a patch for an upgrade, an enhancement or a bug fix
 > you agree on, reply to this email stating that you approve the patch
 > and a committer will take care of it.
 > 
 > The full text of the PR can be found at:
 >     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/115459
 > 
 > -- 
 > Edwin Groothuis
 > edwin@FreeBSD.org
Responsible-Changed-From-To: freebsd-ports-bugs->miwi 
Responsible-Changed-By: miwi 
Responsible-Changed-When: Mon Aug 20 16:43:03 UTC 2007 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115459 
State-Changed-From-To: feedback->closed 
State-Changed-By: miwi 
State-Changed-When: Fri Sep 14 09:58:49 UTC 2007 
State-Changed-Why:  
Maintainer/Feedback timeout. Please feel free to submit a follow-up for 
this PR ticket if you can come up with a solution. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115459 
>Unformatted:
