packages: cassandra-bin/cassandra-bin.spec (NEW), cassandra-bin/cassandra.i...
matkor
matkor at pld-linux.org
Tue Dec 28 16:40:41 CET 2010
Author: matkor Date: Tue Dec 28 15:40:41 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- Initial. NFY. Needs some polishing.
---- Files affected:
packages/cassandra-bin:
cassandra-bin.spec (NONE -> 1.1) (NEW), cassandra.init (NONE -> 1.1) (NEW), cassandra.in.sh (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/cassandra-bin/cassandra-bin.spec
diff -u /dev/null packages/cassandra-bin/cassandra-bin.spec:1.1
--- /dev/null Tue Dec 28 16:40:41 2010
+++ packages/cassandra-bin/cassandra-bin.spec Tue Dec 28 16:40:36 2010
@@ -0,0 +1,130 @@
+%include /usr/lib/rpm/macros.java
+# TODO: Fix .init cassandra status does not work now.
+
+Summary: Cassandra database binary package.
+Summary(pl.UTF-8): Baza danych Cassandra wersja binarna
+Name: cassandra-bin
+%define shname cassandra
+Version: 0.7.0
+%define rccode rc3
+Release: 0.%{rccode}.0.1
+License: ASF
+Group: Applications/Databases
+Source0: http://mirror.nyi.net/apache//cassandra/%{version}/apache-cassandra-%{version}-%{rccode}-bin.tar.gz
+# Source0-md5: 8e5cfc07178cd57e05ef81cad18ef170
+Source1: cassandra.in.sh
+Source2: %{shname}.init
+URL: http://cassandra.apache.org/
+BuildRequires: rpm-javaprov
+BuildRequires: rpmbuild(macros) >= 1.300
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Cassandra brings together the distributed systems technologies from Dynamo
+and the data model from Google's BigTable. Like Dynamo, Cassandra is
+eventually consistent. Like BigTable, Cassandra provides a ColumnFamily-based
+data model richer than typical key/value systems.
+
+%description -l pl.UTF-8
+TODO
+
+%prep
+%setup -q -n apache-cassandra-%{version}-%{rccode}
+
+%build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_javadir}
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{shname}/
+mkdir -p $RPM_BUILD_ROOT/usr/share/%{shname}
+# /usr/share/%{shname}/conf -> /etc/%{shname}/ - We do not want that , lets be ale to use many instances of cassandra like we do with postgresql
+# TODO: /usr/share/%{shname}/conf -> /var/lib/cassandra/conf
+# TODO: root:cassandra conf/*
+# mkdir -p $RPM_BUILD_ROOT/usr/share/%{shname}/conf
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
+cp -p %{SOURCE1} $RPM_BUILD_ROOT/usr/share/%{shname}
+# cp -p contrib/redhat/%{name} $RPM_BUILD_ROOT/etc/rc.d/init.d/
+cp -p lib/*.jar $RPM_BUILD_ROOT/usr/share/%{shname}
+mkdir -p $RPM_BUILD_ROOT/usr/sbin
+cp -p bin/cassandra $RPM_BUILD_ROOT/usr/sbin
+mkdir -p $RPM_BUILD_ROOT/usr/bin
+cp -p bin/cassandra-cli $RPM_BUILD_ROOT/usr/bin
+cp -p bin/nodetool $RPM_BUILD_ROOT/usr/bin
+cp -p bin/clustertool $RPM_BUILD_ROOT/usr/bin
+cp -p bin/json2sstable $RPM_BUILD_ROOT/usr/bin
+cp -p bin/sstable2json $RPM_BUILD_ROOT/usr/bin
+cp -p bin/schematool $RPM_BUILD_ROOT/usr/bin
+cp -p bin/config-converter $RPM_BUILD_ROOT/usr/bin
+cp -p bin/sstablekeys $RPM_BUILD_ROOT/usr/bin
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/cassandra
+mkdir -p $RPM_BUILD_ROOT/var/lib/%{shname}/commitlog
+mkdir -p $RPM_BUILD_ROOT/var/lib/%{shname}/data
+mkdir -p $RPM_BUILD_ROOT/var/lib/%{shname}/saved_caches
+mkdir -p $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/log4j-server.properties $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/cassandra.yaml $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/cassandra-env.sh $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/access.properties $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/passwd.properties $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/cassandra-topology.properties $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/README.txt $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+mkdir -p $RPM_BUILD_ROOT/var/run/%{shname}
+mkdir -p $RPM_BUILD_ROOT/var/log/%{shname}
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+# TODO:
+%groupadd -g 259 -r cassandra
+%useradd -M -o -r -u 259 -d /var/lib/%{shname} -s /bin/sh -g cassandra -c "Cassandra Server" cassandra
+
+# TODO:
+%preun
+if [ "$1" = "0" ]; then
+ %service cassandra stop
+ /sbin/chkconfig --del cassandra
+fi
+
+# %post upstart
+# %upstart_post cassandra
+
+# %postun upstart
+# %upstart_postun cassandra
+
+
+
+%files
+%defattr(644,root,root,755)
+%doc CHANGES.txt LICENSE.txt README.txt NEWS.txt NOTICE.txt
+%attr(754,root,root) /etc/rc.d/init.d/cassandra
+%attr(755,root,root) %{_bindir}/cassandra-cli
+%attr(755,root,root) %{_bindir}/nodetool
+%attr(755,root,root) %{_bindir}/clustertool
+%attr(755,root,root) %{_bindir}/json2sstable
+%attr(755,root,root) %{_bindir}/sstable2json
+%attr(755,root,root) %{_bindir}/schematool
+%attr(755,root,root) %{_bindir}/config-converter
+%attr(755,root,root) %{_bindir}/sstablekeys
+%attr(755,root,root) %{_sbindir}/cassandra
+# %attr(755,root,root) /etc/rc.d/init.d/%{name}
+# %attr(754,root,root) /etc/rc.d/init.d/postgresql
+# %attr(755,root,root)
+/usr/share/%{shname}
+%attr(750,cassandra,cassandra) %dir /var/lib/%{shname}
+%attr(750,root,cassandra) %dir /var/lib/%{shname}/conf
+%attr(640,root,cassandra) /var/lib/%{shname}/conf/*.yaml
+%attr(640,root,cassandra) /var/lib/%{shname}/conf/*.txt
+%attr(640,root,cassandra) /var/lib/%{shname}/conf/*.properties
+%attr(755,root,cassandra) /var/lib/%{shname}/conf/*.sh
+%attr(750,cassandra,cassandra) %dir /var/run/%{shname}
+%attr(750,cassandra,cassandra) %dir /var/log/%{shname}
+
+%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
================================================================
Index: packages/cassandra-bin/cassandra.init
diff -u /dev/null packages/cassandra-bin/cassandra.init:1.1
--- /dev/null Tue Dec 28 16:40:41 2010
+++ packages/cassandra-bin/cassandra.init Tue Dec 28 16:40:36 2010
@@ -0,0 +1,95 @@
+#!/bin/sh
+#
+# glusterfsd Cassandra
+#
+# chkconfig: 345 14 89
+#
+# description: Cassandra database node
+#
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+
+# Get service config - may override defaults
+# [ -f /etc/sysconfig/cassandra ] && . /etc/sysconfig/cassandra
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+ msg_network_down cassandra
+ exit 1
+ fi
+else
+ exit 0
+fi
+
+test -x /usr/sbin/cassandra || exit 0
+
+start() {
+ # Check if the service is already running?
+ if [ ! -f /var/lock/subsys/cassandra ]; then
+ msg_starting cassandra
+ daemon /usr/sbin/cassandra -p /var/run/cassandra.pid
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cassandra
+ else
+ msg_already_running cassandra
+ fi
+}
+
+
+stop() {
+ if [ -f /var/lock/subsys/cassandra ]; then
+ # Stop daemons.
+ msg_stopping cassandra
+ killproc --pidfile /var/run/cassandra.pid cassandra -TERM
+ rm -f /var/lock/subsys/cassandra
+ else
+ msg_not_running cassandra
+ fi
+}
+
+condrestart() {
+ if [ -f /var/lock/subsys/cassandra ]; then
+ stop
+ start
+ else
+ msg_not_running cassandra
+ RETVAL=$1
+ fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ try-restart)
+ condrestart 0
+ ;;
+ force-reload)
+ condrestart 7
+ ;;
+ status)
+ # Does not work with /usr/sbin/cassandra for some reason
+ status cassandra
+ ;;
+ *)
+ # msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+ msg_usage "$0 {start|stop|restart|try-restart|force-reload}"
+ exit 3
+esac
+
+exit $RETVAL
================================================================
Index: packages/cassandra-bin/cassandra.in.sh
diff -u /dev/null packages/cassandra-bin/cassandra.in.sh:1.1
--- /dev/null Tue Dec 28 16:40:41 2010
+++ packages/cassandra-bin/cassandra.in.sh Tue Dec 28 16:40:36 2010
@@ -0,0 +1,54 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# File modified for PLD Linux.
+# Sets minimal configs necessary to run cassandra and cassandra CLI from
+# /usr/share/cassandra/*.jar
+# Should easily allow to run multibple cassandra instaces by only providing
+# $CASSANDRA_HOME
+
+if [ "x$CASSANDRA_HOME" = "x" ]; then
+ CASSANDRA_HOME=/var/lib/cassandra
+fi
+
+# The directory where Cassandra's configs live (required)
+if [ "x$CASSANDRA_CONF" = "x" ]; then
+ CASSANDRA_CONF=$CASSANDRA_HOME/conf
+fi
+
+# This can be the path to a jar file, or a directory containing the
+# compiled classes. NOTE: This isn't needed by the startup script,
+# it's just used here in constructing the classpath.
+# cassandra_bin=$CASSANDRA_HOME/build/classes
+# cassandra_bin=/usr/share/cassandra
+
+# JAVA_HOME can optionally be set here
+#JAVA_HOME=/usr/local/jdk6
+
+# The java classpath (required)
+CLASSPATH=$CASSANDRA_CONF # :$cassandra_bin
+
+# for jar in $CASSANDRA_HOME/lib/*.jar; do
+# CLASSPATH=$CLASSPATH:$jar
+# done
+
+
+# for jar in /usr/share/cassandra/*.jar; do
+# CLASSPATH=$CLASSPATH:$jar
+# done
+CLASSPATH=$CLASSPATH:/usr/share/cassandra/*
+print "DEBUG: CLASSPATH: $CLASSPATH"
+
================================================================
More information about the pld-cvs-commit
mailing list