aboutsummaryrefslogtreecommitdiff
path: root/databases/py-carbon
diff options
context:
space:
mode:
authorSteve Wills <swills@FreeBSD.org>2014-02-18 15:43:57 +0000
committerSteve Wills <swills@FreeBSD.org>2014-02-18 15:43:57 +0000
commitf25b2a73041d154b0ff8ca13e77c65a7d27277a6 (patch)
treea966606b13dd59ea8f9b6a85da1f0105c0ae6228 /databases/py-carbon
parent7a59446bf9b70dfd1daa9d69ee88ac08fe76b50e (diff)
downloadports-f25b2a73041d154b0ff8ca13e77c65a7d27277a6.tar.gz
ports-f25b2a73041d154b0ff8ca13e77c65a7d27277a6.zip
- Enhance init script [1]
- Fix with newer Django [2] - Lots of other cleanups and improvements, including moving the data to a more standard location - Take maintainership, maintainer has not responded to PRs in many months PR: ports/181043 [1] PR: ports/185097 [2] Submitted by: brd [1] Submitted by: swills (myself) [2] Approved by: maintainer timeout (bsdports@wayfair.com, >3 months)
Notes
Notes: svn path=/head/; revision=344911
Diffstat (limited to 'databases/py-carbon')
-rw-r--r--databases/py-carbon/Makefile10
-rw-r--r--databases/py-carbon/files/carbon.in55
-rw-r--r--databases/py-carbon/files/patch-conf__carbon.amqp.conf.example11
-rw-r--r--databases/py-carbon/files/patch-conf__carbon.conf.example10
-rw-r--r--databases/py-carbon/files/patch-lib__carbon__util.py11
-rw-r--r--databases/py-carbon/files/patch-setup.py4
-rw-r--r--databases/py-carbon/pkg-plist27
7 files changed, 94 insertions, 34 deletions
diff --git a/databases/py-carbon/Makefile b/databases/py-carbon/Makefile
index 89b46acc9a38..7873c772cdfa 100644
--- a/databases/py-carbon/Makefile
+++ b/databases/py-carbon/Makefile
@@ -3,23 +3,25 @@
PORTNAME= carbon
PORTVERSION= 0.9.12
+PORTREVISION= 1
CATEGORIES= databases python
-MASTER_SITES= https://github.com/graphite-project/${PORTNAME}/archive/${PORTVERSION}.tar.gz?dummy=
+MASTER_SITES= http://github.com/graphite-project/${PORTNAME}/archive/${PORTVERSION}.tar.gz?dummy=/
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
-MAINTAINER= bsdports@wayfair.com
+MAINTAINER= swills@FreeBSD.org
COMMENT= Backend storage application for graphite
LICENSE= APACHE20
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}txamqp>=0.3:${PORTSDIR}/net/py-txamqp \
- ${PYTHON_PKGNAMEPREFIX}whisper>=0.9.10:${PORTSDIR}/databases/py-whisper
+ ${PYTHON_PKGNAMEPREFIX}whisper>=0.9.10:${PORTSDIR}/databases/py-whisper \
+ ${PYTHON_PKGNAMEPREFIX}django>=1.4:${PORTSDIR}/www/py-django
USE_PYTHON= 2
USE_PYDISTUTILS= yes
USES= twisted:run
FETCH_ARGS= -o ${DISTNAME}${EXTRACT_SUFX}
USE_RC_SUBR= carbon
+PLIST_SUB+= RESETPREFIX=${PREFIX}
-NO_STAGE= yes
.include <bsd.port.mk>
diff --git a/databases/py-carbon/files/carbon.in b/databases/py-carbon/files/carbon.in
index a0379c4b1777..c583eb1a47bc 100644
--- a/databases/py-carbon/files/carbon.in
+++ b/databases/py-carbon/files/carbon.in
@@ -1,13 +1,19 @@
#!/bin/sh
-#
+#
+# $FreeBSD$
+#
+
# PROVIDE: carbon
# KEYWORD: shutdown
-#
+
+#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# carbon_enable (bool): Set to NO by default.
# Set it to YES to enable it.
+# carbon_conf: File where carbon configuration resides
+# Default: %%PREFIX%%/etc/carbon/carbon.conf
# carbon_user: The user account carbon daemon runs as what
# you want it to be. It uses 'root' user by
# default.
@@ -18,43 +24,38 @@
# mode, it may be very verbose. It will not run
# in debug by default.
# carbon_logdir: Directory where carbon logs are stored.
-# Default: /usr/local/graphite/storage/log
-# carbon_conf: File where carbon configuration resides
-# Default: /usr/local/etc/carbon/carbon.conf
-# carbon_pidfile: Location where carbon should place its pid file
-# Default: /var/run/carbon.pid
+# Default: /var/db/carbon/log
+#
. /etc/rc.subr
-name="carbon"
-rcvar=${name}_enable
+name=carbon
+rcvar=carbon_enable
load_rc_config ${name}
-: ${carbon_enable:="NO"}
-: ${carbon_user:="root"}
-: ${carbon_group:="wheel"}
-: ${carbon_conf:="/usr/local/etc/carbon/carbon.conf"}
-: ${carbon_debug:="NO"}
-: ${carbon_logdir:="/usr/local/graphite/storage/log"}
-: ${carbon_pidfile:="/var/run/carbon.pid"}
+: ${carbon_enable:=NO}
+: ${carbon_user:=root}
+: ${carbon_group:=wheel}
+: ${carbon_conf:=%%PREFIX%%/etc/carbon/carbon.conf}
+: ${carbon_debug:=NO}
+: ${carbon_logdir:=/var/db/carbon/log/}
+: ${pidfile:=/var/run/carbon.pid}
-status_cmd="${name}_status"
stop_cmd="${name}_stop"
+required_files="${carbon_conf} %%PREFIX%%/etc/carbon/storage-schemas.conf"
-command_interpreter="/usr/local/bin/python2.7"
-command="/usr/local/bin/carbon-cache.py"
-command_args="--config=${carbon_conf} --logdir ${carbon_logdir} --pidfile ${carbon_pidfile} start"
+command_interpreter="%%PREFIX%%/bin/python2.7"
+command="%%PREFIX%%/bin/carbon-cache.py"
+command_args="--config=${carbon_conf} --logdir ${carbon_logdir} --pidfile ${pidfile} start"
-carbon_stop() {
+carbon_stop()
+{
echo "Stopping $name"
+ pids=`check_pidfile ${pidfile} ${command} ${command_interpreter}`
- /usr/local/bin/carbon-cache.py --config=${carbon_conf} --pidfile ${carbon_pidfile} stop
-}
-
-carbon_status() {
- /usr/local/bin/carbon-cache.py --config=${carbon_conf} --pidfile ${carbon_pidfile} status
-
+ %%PREFIX%%/bin/carbon-cache.py --config=${carbon_conf} --pidfile ${pidfile} stop
+ wait_for_pids ${pids}
}
run_rc_command "$1"
diff --git a/databases/py-carbon/files/patch-conf__carbon.amqp.conf.example b/databases/py-carbon/files/patch-conf__carbon.amqp.conf.example
new file mode 100644
index 000000000000..af9b69b7f73a
--- /dev/null
+++ b/databases/py-carbon/files/patch-conf__carbon.amqp.conf.example
@@ -0,0 +1,11 @@
+--- conf/carbon.amqp.conf.example.orig 2014-02-13 17:04:10.949705742 +0000
++++ conf/carbon.amqp.conf.example 2014-02-13 17:04:42.404703056 +0000
+@@ -1,7 +1,7 @@
+ # This is a configuration file with AMQP enabled
+
+ [cache]
+-LOCAL_DATA_DIR =
++LOCAL_DATA_DIR = /var/db/carbon/whisper
+
+ # Specify the user to drop privileges to
+ # If this is blank carbon runs as the user that invokes it
diff --git a/databases/py-carbon/files/patch-conf__carbon.conf.example b/databases/py-carbon/files/patch-conf__carbon.conf.example
new file mode 100644
index 000000000000..f63435851229
--- /dev/null
+++ b/databases/py-carbon/files/patch-conf__carbon.conf.example
@@ -0,0 +1,10 @@
+--- conf/carbon.conf.example.orig 2014-02-13 16:47:59.689772807 +0000
++++ conf/carbon.conf.example 2014-02-13 16:48:17.904771292 +0000
+@@ -29,6 +29,7 @@
+ # PID_DIR = /var/run/
+ #
+ #LOCAL_DATA_DIR = /opt/graphite/storage/whisper/
++LOCAL_DATA_DIR = /var/db/carbon/whisper/
+
+ # Enable daily log rotation. If disabled, a kill -HUP can be used after a manual rotate
+ ENABLE_LOGROTATION = True
diff --git a/databases/py-carbon/files/patch-lib__carbon__util.py b/databases/py-carbon/files/patch-lib__carbon__util.py
new file mode 100644
index 000000000000..3dc40a7287fe
--- /dev/null
+++ b/databases/py-carbon/files/patch-lib__carbon__util.py
@@ -0,0 +1,11 @@
+--- ./lib/carbon/util.py.orig 2013-12-22 16:45:46.061449090 +0000
++++ ./lib/carbon/util.py 2013-12-22 16:46:00.326083639 +0000
+@@ -18,7 +18,7 @@
+ from time import sleep, time
+ from twisted.python.util import initgroups
+ from twisted.scripts.twistd import runApp
+-from twisted.scripts._twistd_unix import daemonize
++from django.utils import daemonize
+
+
+ daemonize = daemonize # Backwards compatibility
diff --git a/databases/py-carbon/files/patch-setup.py b/databases/py-carbon/files/patch-setup.py
index 928f06c2aaf3..c24bb08214f2 100644
--- a/databases/py-carbon/files/patch-setup.py
+++ b/databases/py-carbon/files/patch-setup.py
@@ -7,8 +7,8 @@
-storage_dirs = [ ('storage/whisper',[]), ('storage/lists',[]),
- ('storage/log',[]), ('storage/rrd',[]) ]
-conf_files = [ ('conf', glob('conf/*.example')) ]
-+storage_dirs = [ ('/var/db/graphite/storage/whisper',[]), ('/var/db/graphite/storage/lists',[]),
-+ ('/var/db/graphite/storage/log',[]), ('/var/db/graphite/storage/rrd',[]) ]
++storage_dirs = [ ('/var/db/carbon/whisper',[]), ('/var/db/carbon/lists',[]),
++ ('/var/db/carbon/log',[]), ('/var/db/carbon/rrd',[]) ]
+conf_files = [ ('/usr/local/etc/carbon', glob('conf/*.example')) ]
install_files = storage_dirs + conf_files
diff --git a/databases/py-carbon/pkg-plist b/databases/py-carbon/pkg-plist
index e7455365dd78..13b136c4acfd 100644
--- a/databases/py-carbon/pkg-plist
+++ b/databases/py-carbon/pkg-plist
@@ -3,15 +3,33 @@ bin/carbon-cache.py
bin/carbon-client.py
bin/carbon-relay.py
bin/validate-storage-schemas.py
+@unexec if cmp -s %D/etc/carbon/rewrite-rules.conf.example %D/etc/carbon/rewrite-rules.conf; then rm -f %D/etc/carbon/rewrite-rules.conf; fi
%%ETCDIR%%/rewrite-rules.conf.example
+@exec if [ ! -f %D/etc/carbon/rewrite-rules.conf ] ; then cp -p %D/%F %B/rewrite-rules.conf; fi
+@unexec if cmp -s %D/etc/carbon/carbon.amqp.conf.example %D/etc/carbon/carbon.amqp.conf; then rm -f %D/etc/carbon/carbon.amqp.conf; fi
%%ETCDIR%%/carbon.amqp.conf.example
+@exec if [ ! -f %D/etc/carbon/carbon.amqp.conf ] ; then cp -p %D/%F %B/carbon.amqp.conf; fi
+@unexec if cmp -s %D/etc/carbon/carbon.conf.example %D/etc/carbon/carbon.conf; then rm -f %D/etc/carbon/carbon.conf; fi
%%ETCDIR%%/carbon.conf.example
+@exec if [ ! -f %D/etc/carbon/carbon.conf ] ; then cp -p %D/%F %B/carbon.conf; fi
+@unexec if cmp -s %D/etc/carbon/aggregation-rules.conf.example %D/etc/carbon/aggregation-rules.conf; then rm -f %D/etc/carbon/aggregation-rules.conf; fi
%%ETCDIR%%/aggregation-rules.conf.example
+@exec if [ ! -f %D/etc/carbon/aggregation-rules.conf ] ; then cp -p %D/%F %B/aggregation-rules.conf; fi
+@unexec if cmp -s %D/etc/carbon/relay-rules.conf.example %D/etc/carbon/relay-rules.conf; then rm -f %D/etc/carbon/relay-rules.conf; fi
%%ETCDIR%%/relay-rules.conf.example
+@exec if [ ! -f %D/etc/carbon/relay-rules.conf ] ; then cp -p %D/%F %B/relay-rules.conf; fi
+@unexec if cmp -s %D/etc/carbon/storage-schemas.conf.example %D/etc/carbon/storage-schemas.conf; then rm -f %D/etc/carbon/storage-schemas.conf; fi
%%ETCDIR%%/storage-schemas.conf.example
+@exec if [ ! -f %D/etc/carbon/storage-schemas.conf ] ; then cp -p %D/%F %B/storage-schemas.conf; fi
+@unexec if cmp -s %D/etc/carbon/blacklist.conf.example %D/etc/carbon/blacklist.conf; then rm -f %D/etc/carbon/blacklist.conf; fi
%%ETCDIR%%/blacklist.conf.example
+@exec if [ ! -f %D/etc/carbon/blacklist.conf ] ; then cp -p %D/%F %B/blacklist.conf; fi
+@unexec if cmp -s %D/etc/carbon/storage-aggregation.conf.example %D/etc/carbon/storage-aggregation.conf; then rm -f %D/etc/carbon/storage-aggregation.conf; fi
%%ETCDIR%%/storage-aggregation.conf.example
+@exec if [ ! -f %D/etc/carbon/storage-aggregation.conf ] ; then cp -p %D/%F %B/storage-aggregation.conf; fi
+@unexec if cmp -s %D/etc/carbon/whitelist.conf.example %D/etc/carbon/whitelist.conf; then rm -f %D/etc/carbon/whitelist.conf; fi
%%ETCDIR%%/whitelist.conf.example
+@exec if [ ! -f %D/etc/carbon/whitelist.conf ] ; then cp -p %D/%F %B/whitelist.conf; fi
%%PYTHON_SITELIBDIR%%/twisted/plugins/carbon_aggregator_plugin.py
%%PYTHON_SITELIBDIR%%/twisted/plugins/carbon_relay_plugin.py
%%PYTHON_SITELIBDIR%%/twisted/plugins/carbon_cache_plugin.py
@@ -103,6 +121,13 @@ bin/validate-storage-schemas.py
%%PYTHON_SITELIBDIR%%/carbon/regexlist.py
%%PYTHON_SITELIBDIR%%/carbon/regexlist.pyc
%%PYTHON_SITELIBDIR%%/carbon/regexlist.pyo
-@dirrm %%ETCDIR%%
@dirrm %%PYTHON_SITELIBDIR%%/carbon/aggregator
@dirrm %%PYTHON_SITELIBDIR%%/carbon
+@dirrmtry %%ETCDIR%%
+@cwd /
+@dirrmtry var/db/carbon/whisper
+@dirrmtry var/db/carbon/rrd
+@dirrmtry var/db/carbon/log
+@dirrmtry var/db/carbon/lists
+@dirrmtry var/db/carbon
+@cwd %%RESETPREFIX%%