[python-carbon/f17] Initial import from review.
jsteffan
jsteffan at fedoraproject.org
Sun Nov 25 00:03:02 UTC 2012
commit 6f69d527db348b1acfec84d0cc82b50839c82e73
Author: Jonathan Steffan <jsteffan at fedoraproject.org>
Date: Sat Nov 24 17:02:57 2012 -0700
Initial import from review.
.gitignore | 1 +
python-carbon-0.9.10-fedora.patch | 79 ++++++++++++++++++++++++
python-carbon-aggregator.init | 86 ++++++++++++++++++++++++++
python-carbon-cache.init | 86 ++++++++++++++++++++++++++
python-carbon-relay.init | 86 ++++++++++++++++++++++++++
python-carbon.spec | 122 +++++++++++++++++++++++++++++++++++++
python-carbon.sysconfig | 4 +
sources | 1 +
8 files changed, 465 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..7220ff6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/carbon-0.9.10.tar.gz
diff --git a/python-carbon-0.9.10-fedora.patch b/python-carbon-0.9.10-fedora.patch
new file mode 100644
index 0000000..c92bd1c
--- /dev/null
+++ b/python-carbon-0.9.10-fedora.patch
@@ -0,0 +1,79 @@
+diff -up ./conf/carbon.conf.example.orig ./conf/carbon.conf.example
+--- ./conf/carbon.conf.example.orig 2012-05-31 15:09:32.796575476 -0600
++++ ./conf/carbon.conf.example 2012-05-31 15:10:59.641332773 -0600
+@@ -30,10 +30,17 @@
+ #
+ #LOCAL_DATA_DIR = /opt/graphite/storage/whisper/
+
++STORAGE_DIR = /var/lib/carbon/
++LOCAL_DATA_DIR = /var/lib/carbon/whisper/
++WHITELISTS_DIR = /var/lib/carbon/lists/
++CONF_DIR = /etc/carbon/
++LOG_DIR = /var/log/carbon/
++PID_DIR = /var/run/
++
+ # Specify the user to drop privileges to
+ # If this is blank carbon runs as the user that invokes it
+ # This user must have write access to the local data directory
+-USER =
++USER = carbon
+
+ # Limit the size of the cache to avoid swapping or becoming CPU bound.
+ # Sorts and serving cache queries gets more expensive as the cache grows.
+diff -up ./setup.cfg.orig ./setup.cfg
+--- ./setup.cfg.orig 2012-05-31 15:20:40.649786911 -0600
++++ ./setup.cfg 2012-05-31 15:21:10.019706501 -0600
+@@ -1,9 +1,9 @@
+-[install]
+-prefix = /opt/graphite
+-install-lib = %(prefix)s/lib
++#[install]
++#prefix = /opt/graphite
++#install-lib = %(prefix)s/lib
+
+-[bdist_rpm]
+-requires = python-twisted
+- whisper
++#[bdist_rpm]
++#requires = python-twisted
++# whisper
+
+-post-install = distro/redhat/misc/postinstall
++#post-install = distro/redhat/misc/postinstall
+diff -up ./setup.py.orig ./setup.py
+--- ./setup.py.orig 2012-05-31 15:11:28.825257256 -0600
++++ ./setup.py 2012-05-31 15:29:55.807188675 -0600
+@@ -12,14 +12,20 @@ else:
+ setup_kwargs = dict()
+
+
+-storage_dirs = [ ('storage/whisper',[]), ('storage/lists',[]),
+- ('storage/log',[]), ('storage/rrd',[]) ]
+-conf_files = [ ('conf', glob('conf/*.example')) ]
++#storage_dirs = [ ('storage/whisper',[]), ('storage/lists',[]),
++# ('storage/log',[]), ('storage/rrd',[]) ]
++#conf_files = [ ('conf', glob('conf/*.example')) ]
+ #XXX Need a way to have these work for bdist_rpm but be left alone for everything else
+ #init_scripts = [ ('/etc/init.d', ['distro/redhat/init.d/carbon-cache',
+ # 'distro/redhat/init.d/carbon-relay',
+ # 'distro/redhat/init.d/carbon-aggregator']) ]
+
++storage_dirs = [
++ ('/var/lib/carbon/whisper',[]),
++ ('/var/lib/carbon/lists',[]),
++ ('/var/lib/carbon/rrd',[])
++]
++
+ setup(
+ name='carbon',
+ version='0.9.10',
+@@ -32,7 +38,8 @@ setup(
+ package_dir={'' : 'lib'},
+ scripts=glob('bin/*'),
+ package_data={ 'carbon' : ['*.xml'] },
+- data_files=storage_dirs + conf_files, # + init_scripts,
++ #data_files=storage_dirs + conf_files, # + init_scripts,
++ data_files=storage_dirs,
+ install_requires=['twisted', 'txamqp'],
+ **setup_kwargs
+ )
diff --git a/python-carbon-aggregator.init b/python-carbon-aggregator.init
new file mode 100644
index 0000000..d9fb261
--- /dev/null
+++ b/python-carbon-aggregator.init
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# carbon-aggregator init file for starting up the carbon-aggregator daemon
+#
+# chkconfig: - 20 80
+# description: Starts and stops the carbon-aggregator daemon.
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/bin/carbon-aggregator"
+pidfile="/var/run/carbon-aggregator.pid"
+
+CONFIG="/etc/carbon/carbon.conf"
+LOG_DIR="/var/log/carbon"
+
+[ -e /etc/sysconfig/carbon ] && . /etc/sysconfig/carbon
+
+lockfile=/var/lock/subsys/carbon-aggregator
+
+start() {
+ [ -f $CONFIG ] || exit 6
+ [ -x $exec ] || exit 5
+ echo -n $"Starting `basename $exec`: "
+ daemon "$exec --config=$CONFIG --pidfile=$pidfile --logdir=$LOG_DIR start"
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && touch $lockfile
+ return $retval
+}
+
+stop() {
+ echo -n $"Stopping `basename $exec`: "
+ killproc -p $pidfile `basename $exec`
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ stop
+ start
+}
+
+rh_status() {
+ status -p $pidfile `basename $exec`
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ $1
+ ;;
+ status)
+ rh_status
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+ exit 2
+esac
+exit $?
+
diff --git a/python-carbon-cache.init b/python-carbon-cache.init
new file mode 100644
index 0000000..8f8ae82
--- /dev/null
+++ b/python-carbon-cache.init
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# carbon-cache init file for starting up the carbon-cache daemon
+#
+# chkconfig: - 20 80
+# description: Starts and stops the carbon-cache daemon.
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/bin/carbon-cache"
+pidfile="/var/run/carbon-cache.pid"
+
+CONFIG="/etc/carbon/carbon.conf"
+LOG_DIR="/var/log/carbon"
+
+[ -e /etc/sysconfig/carbon ] && . /etc/sysconfig/carbon
+
+lockfile=/var/lock/subsys/carbon-cache
+
+start() {
+ [ -f $CONFIG ] || exit 6
+ [ -x $exec ] || exit 5
+ echo -n $"Starting `basename $exec`: "
+ daemon "$exec --config=$CONFIG --pidfile=$pidfile --logdir=$LOG_DIR start"
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && touch $lockfile
+ return $retval
+}
+
+stop() {
+ echo -n $"Stopping `basename $exec`: "
+ killproc -p $pidfile `basename $exec`
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ stop
+ start
+}
+
+rh_status() {
+ status -p $pidfile `basename $exec`
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ $1
+ ;;
+ status)
+ rh_status
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+ exit 2
+esac
+exit $?
+
diff --git a/python-carbon-relay.init b/python-carbon-relay.init
new file mode 100644
index 0000000..cc70749
--- /dev/null
+++ b/python-carbon-relay.init
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# carbon-relay init file for starting up the carbon-relay daemon
+#
+# chkconfig: - 20 80
+# description: Starts and stops the carbon-relay daemon.
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/bin/carbon-relay"
+pidfile="/var/run/carbon-relay.pid"
+
+CONFIG="/etc/carbon/carbon.conf"
+LOG_DIR="/var/log/carbon"
+
+[ -e /etc/sysconfig/carbon ] && . /etc/sysconfig/carbon
+
+lockfile=/var/lock/subsys/carbon-relay
+
+start() {
+ [ -f $CONFIG ] || exit 6
+ [ -x $exec ] || exit 5
+ echo -n $"Starting `basename $exec`: "
+ daemon "$exec --config=$CONFIG --pidfile=$pidfile --logdir=$LOG_DIR start"
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && touch $lockfile
+ return $retval
+}
+
+stop() {
+ echo -n $"Stopping `basename $exec`: "
+ killproc -p $pidfile `basename $exec`
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ stop
+ start
+}
+
+rh_status() {
+ status -p $pidfile `basename $exec`
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ $1
+ ;;
+ status)
+ rh_status
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+ exit 2
+esac
+exit $?
+
diff --git a/python-carbon.spec b/python-carbon.spec
new file mode 100644
index 0000000..a9797ee
--- /dev/null
+++ b/python-carbon.spec
@@ -0,0 +1,122 @@
+%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
+
+Name: python-carbon
+Version: 0.9.10
+Release: 1%{?dist}
+Summary: Back-end data caching and persistence daemon for Graphite
+
+License: ASL 2.0
+URL: https://launchpad.net/graphite/
+Source0: https://github.com/downloads/graphite-project/carbon/carbon-0.9.10.tar.gz
+Source1: %{name}-cache.init
+Source2: %{name}-relay.init
+Source3: %{name}-aggregator.init
+Source4: %{name}.sysconfig
+Patch0: python-carbon-0.9.10-fedora.patch
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch: noarch
+BuildRequires: python-devel, python-setuptools
+Requires: python-whisper, python-twisted-core >= 8.0
+Requires(post): chkconfig
+Requires(pre): shadow-utils
+Requires(preun): chkconfig, initscripts
+
+
+%description
+Twisted daemon that listens for time-series data and writes this data
+out to whisper databases, relays the data or aggregates the data.
+Carbon is a data collection and storage agent.
+
+
+%prep
+%setup -q -n carbon-%{version}
+# Patch for Filesystem Hierarchy Standard
+%patch0 -p1
+
+
+%build
+%{__python} setup.py build
+
+
+%install
+rm -rf %{buildroot}
+%{__python} setup.py install -O1 --skip-build --root %{buildroot}
+
+# Temp mv to non .py locations
+pushd %{buildroot}/usr/bin/
+%{__mv} carbon-aggregator.py carbon-aggregator
+%{__mv} carbon-cache.py carbon-cache
+%{__mv} carbon-client.py carbon-client
+%{__mv} carbon-relay.py carbon-relay
+%{__mv} validate-storage-schemas.py validate-storage-schemas
+popd
+
+%{__mkdir_p} %{buildroot}%{_sysconfdir}/carbon
+%{__mkdir_p} %{buildroot}%{_localstatedir}/log/carbon
+%{__mkdir_p} %{buildroot}%{_localstatedir}/run/carbon
+%{__mkdir_p} %{buildroot}%{_sharedstatedir}/carbon
+
+# Install system configuration and init scripts
+%{__install} -Dp -m0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/carbon-cache
+%{__install} -Dp -m0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/carbon-relay
+%{__install} -Dp -m0755 %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/carbon-aggregator
+%{__install} -Dp -m0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/carbon
+
+# Install default configuration files
+%{__mkdir_p} %{buildroot}%{_sysconfdir}/carbon
+%{__install} -Dp -m0644 conf/carbon.conf.example %{buildroot}%{_sysconfdir}/carbon/carbon.conf
+%{__install} -Dp -m0644 conf/storage-schemas.conf.example %{buildroot}%{_sysconfdir}/carbon/storage-schemas.conf
+
+
+%pre
+getent group carbon >/dev/null || groupadd -r carbon
+getent passwd carbon >/dev/null || \
+ useradd -r -g carbon -d %{_sharedstatedir}/carbon \
+ -s /sbin/nologin -c "Carbon cache daemon" carbon
+
+
+%preun
+if [ $1 -eq 0 ] ; then
+ /sbin/service carbon-cache stop >/dev/null 2>&1
+ /sbin/chkconfig --del carbon-cache
+ /sbin/service carbon-relay stop >/dev/null 2>&1
+ /sbin/chkconfig --del carbon-relay
+ /sbin/service carbon-aggregator stop >/dev/null 2>&1
+ /sbin/chkconfig --del carbon-aggregator
+fi
+
+
+%post
+/sbin/chkconfig --add carbon-cache
+/sbin/chkconfig --add carbon-relay
+/sbin/chkconfig --add carbon-aggregator
+
+
+%postun
+if [ $1 = 0 ]; then
+ getent passwd carbon >/dev/null && \
+ userdel -r carbon 2>/dev/null
+fi
+
+
+%files
+%doc LICENSE conf/*
+%dir %{_sysconfdir}/carbon
+%dir %{_localstatedir}/run/carbon
+%{_bindir}/carbon*
+%{_bindir}/validate-storage-schemas
+%{_sysconfdir}/init.d/carbon-*
+%config(noreplace) %{_sysconfdir}/carbon/*
+%config(noreplace) %{_sysconfdir}/sysconfig/carbon
+%attr(0755,-,-) %{python_sitelib}/carbon/amqp_publisher.py
+%attr(0755,-,-) %{python_sitelib}/carbon/amqp_listener.py
+%{python_sitelib}/*
+%attr(-,carbon,carbon) %{_localstatedir}/log/carbon
+%attr(-,carbon,carbon) %{_sharedstatedir}/carbon
+
+
+%changelog
+* Thu May 30 2012 Jonathan Steffan <jsteffan at fedoraproject.org> - 0.9.10-1
+- Initial Package
diff --git a/python-carbon.sysconfig b/python-carbon.sysconfig
new file mode 100644
index 0000000..a2fabe7
--- /dev/null
+++ b/python-carbon.sysconfig
@@ -0,0 +1,4 @@
+# Configuration file for carbon
+
+# CONFIG=/etc/carbon/carbon.conf
+# LOG_DIR=/var/log/carbon
diff --git a/sources b/sources
index e69de29..5b91871 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+053b2df1c928250f59518e9bb9f35ad5 carbon-0.9.10.tar.gz
More information about the scm-commits
mailing list