From owner-svn-ports-head@freebsd.org Thu Jul 5 18:23:24 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A89A10451ED; Thu, 5 Jul 2018 18:23:24 +0000 (UTC) (envelope-from dch@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3EEB8E7D5; Thu, 5 Jul 2018 18:23:23 +0000 (UTC) (envelope-from dch@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95DE01D9B2; Thu, 5 Jul 2018 18:23:23 +0000 (UTC) (envelope-from dch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w65INNXu000812; Thu, 5 Jul 2018 18:23:23 GMT (envelope-from dch@FreeBSD.org) Received: (from dch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w65INNb3000810; Thu, 5 Jul 2018 18:23:23 GMT (envelope-from dch@FreeBSD.org) Message-Id: <201807051823.w65INNb3000810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dch set sender to dch@FreeBSD.org using -f From: Dave Cottlehuber Date: Thu, 5 Jul 2018 18:23:23 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r473979 - in head/www/py-graphite-api: . files X-SVN-Group: ports-head X-SVN-Commit-Author: dch X-SVN-Commit-Paths: in head/www/py-graphite-api: . files X-SVN-Commit-Revision: 473979 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2018 18:23:24 -0000 Author: dch Date: Thu Jul 5 18:23:22 2018 New Revision: 473979 URL: https://svnweb.freebsd.org/changeset/ports/473979 Log: www/py-graphite-api: clean up rc.d script - fix ordering in rc.d script so that daemon doesn't hang on startup - teach rc.d to behave when installing with multiple python & gunicorn versions - clean up substitutions in SUB_LIST, pkg-list and *.in script - ensure working directories are re-created on startup if required PR: 223264 Submitted by: Horst Kapfenberger Approved by: jrm MFH: 2018Q3 Differential Revision: https://reviews.freebsd.org/D13581 Modified: head/www/py-graphite-api/Makefile head/www/py-graphite-api/files/graphiteapi.in Modified: head/www/py-graphite-api/Makefile ============================================================================== --- head/www/py-graphite-api/Makefile Thu Jul 5 17:31:36 2018 (r473978) +++ head/www/py-graphite-api/Makefile Thu Jul 5 18:23:22 2018 (r473979) @@ -3,11 +3,12 @@ PORTNAME= graphite-api PORTVERSION= 1.1.3 +PORTREVISION= 1 CATEGORIES= www python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} -MAINTAINER= dch@skunkwerks.at +MAINTAINER= dch@FreeBSD.org COMMENT= Graphite-web, without the interface - just the rendering HTTP API LICENSE= APACHE20 @@ -24,15 +25,16 @@ RUN_DEPENDS= \ ${PYTHON_PKGNAMEPREFIX}gunicorn>=19.4.1:www/py-gunicorn@${PY_FLAVOR} \ xorg-fonts-truetype>=0:x11-fonts/xorg-fonts-truetype -NO_ARCH= yes USES= python USE_PYTHON= distutils py3kplist +NO_ARCH= yes + GRAPHITEAPI_APP= graphiteapi SUB_FILES= pkg-message -SUB_LIST= PORTNAME=${PORTNAME} \ - PREFIX=${PREFIX} \ +SUB_LIST= PYTHON_VER=${PYTHON_VER} \ + PYTHON_VERSION=${PYTHON_VERSION} \ GRAPHITEAPI_APP=${GRAPHITEAPI_APP} \ GRAPHITEAPI_USER=${GRAPHITEAPI_USER} \ GRAPHITEAPI_GROUP=${GRAPHITEAPI_GROUP} \ @@ -40,10 +42,7 @@ SUB_LIST= PORTNAME=${PORTNAME} \ GRAPHITEAPI_TMPDIR=${GRAPHITEAPI_TMPDIR} \ GRAPHITEAPI_PIDFILE=${GRAPHITEAPI_PIDFILE} -PLIST_SUB= PORTNAME=${PORTNAME} \ - PORTVERSION=${PORTVERSION} \ - PREFIX=${PREFIX} \ - GRAPHITEAPI_APP=${GRAPHITEAPI_APP} \ +PLIST_SUB= GRAPHITEAPI_APP=${GRAPHITEAPI_APP} \ GRAPHITEAPI_USER=${GRAPHITEAPI_USER} \ GRAPHITEAPI_GROUP=${GRAPHITEAPI_GROUP} \ GRAPHITEAPI_LOGDIR=${GRAPHITEAPI_LOGDIR} \ Modified: head/www/py-graphite-api/files/graphiteapi.in ============================================================================== --- head/www/py-graphite-api/files/graphiteapi.in Thu Jul 5 17:31:36 2018 (r473978) +++ head/www/py-graphite-api/files/graphiteapi.in Thu Jul 5 18:23:22 2018 (r473979) @@ -23,8 +23,10 @@ name="%%GRAPHITEAPI_APP%%" rcvar="%%GRAPHITEAPI_APP%%_enable" +desc="graphite-web rendering API" -# defaults +load_rc_config ${name} + : ${graphiteapi_enable:="NO"} : ${graphiteapi_user="%%GRAPHITEAPI_USER%%"} : ${graphiteapi_group="%%GRAPHITEAPI_GROUP%%"} @@ -32,21 +34,32 @@ rcvar="%%GRAPHITEAPI_APP%%_enable" : ${graphiteapi_config="%%ETCDIR%%/%%GRAPHITEAPI_APP%%.yaml"} : ${graphiteapi_flags="--workers 4"} -# daemon -command="%%PREFIX%%/bin/gunicorn" required_files="${graphiteapi_config}" -command_args="graphite_api.app:app" + +command="%%PREFIX%%/bin/gunicorn-%%PYTHON_VER%%" +procname="%%PYTHON_VERSION%%" + +pidfile="%%GRAPHITEAPI_PIDFILE%%" + +command_args="--daemon graphite_api.app:app" command_args="${command_args} --user ${graphiteapi_user} --group ${graphiteapi_group}" command_args="${command_args} --bind ${graphiteapi_address}" -command_args="${command_args} --env TZ=UTC" command_args="${command_args} --env GRAPHITE_API_CONFIG=${graphiteapi_config}" command_args="${command_args} --pid %%GRAPHITEAPI_PIDFILE%%" command_args="${command_args} --worker-tmp-dir %%GRAPHITEAPI_TMPDIR%%" command_args="${command_args} --error-logfile %%GRAPHITEAPI_LOGDIR%%/error.log" command_args="${command_args} --access-logfile %%GRAPHITEAPI_LOGDIR%%/access.log" -# support SIGHUP to reload configuration file extra_commands="reload" +start_precmd="start_precmd" -load_rc_config $name +start_precmd() +{ + test -d "%%GRAPHITEAPI_LOGDIR%%" || install -d -o + ${graphiteapi_user} \ + -g ${graphiteapi_group} -m 0750 "%%GRAPHITEAPI_LOGDIR%%" + test -d "%%GRAPHITEAPI_TMPDIR%%" || install -d -o ${graphiteapi_user} \ + -g ${graphiteapi_group} -m 0750 "%%GRAPHITEAPI_TMPDIR%%" +} + run_rc_command "$1"