From cc9fdf625335e99622d73a8e9792e5a7fed17e5c Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: May 26 2009 10:47:06 +0000 Subject: Initial commit of rabbitmq-server package to devel branch --- diff --git a/.cvsignore b/.cvsignore index e69de29..8c856ff 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +rabbitmq-server-1.5.5.tar.gz diff --git a/import.log b/import.log new file mode 100644 index 0000000..11bb74d --- /dev/null +++ b/import.log @@ -0,0 +1 @@ +rabbitmq-server-1_5_5-1:HEAD:rabbitmq-server-1.5.5-1.src.rpm:1243334529 diff --git a/rabbitmq-script-wrapper b/rabbitmq-script-wrapper new file mode 100644 index 0000000..296a77d --- /dev/null +++ b/rabbitmq-script-wrapper @@ -0,0 +1,23 @@ +#!/bin/bash +# Escape spaces and quotes, because shell is revolting. +for arg in "$@" ; do + # Escape quotes in parameters, so that they're passed through cleanly. + arg=$(sed -e 's/"/\\"/' <<-END + $arg + END + ) + CMDLINE="${CMDLINE} \"${arg}\"" +done + +cd /var/lib/rabbitmq + +SCRIPT=`basename $0` + +if [ `id -u` = 0 ] ; then + su rabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/${SCRIPT} ${CMDLINE}" +else + /usr/lib/rabbitmq/bin/${SCRIPT} + echo -e "\nOnly root should run ${SCRIPT}\n" + exit 1 +fi + diff --git a/rabbitmq-server.init b/rabbitmq-server.init new file mode 100644 index 0000000..77a6a89 --- /dev/null +++ b/rabbitmq-server.init @@ -0,0 +1,138 @@ +#!/bin/sh +# +# rabbitmq-server RabbitMQ broker +# +# chkconfig: - 80 05 +# description: Enable AMQP service provided by RabbitMQ +# + +### BEGIN INIT INFO +# Provides: rabbitmq-server +# Default-Start: +# Default-Stop: +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Description: RabbitMQ broker +# Short-Description: Enable AMQP service provided by RabbitMQ broker +### END INIT INFO + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DAEMON=/usr/sbin/rabbitmq-multi +NAME=rabbitmq-server +DESC=rabbitmq-server +USER=rabbitmq +NODE_COUNT=1 +ROTATE_SUFFIX= + +LOCK_FILE=/var/lock/subsys/$NAME + +test -x $DAEMON || exit 0 + +# Include rabbitmq defaults if available +if [ -f /etc/sysconfig/rabbitmq ] ; then + . /etc/sysconfig/rabbitmq +fi + +RETVAL=0 +set -e + +start_rabbitmq () { + set +e + $DAEMON start_all ${NODE_COUNT} > /var/log/rabbitmq/startup_log 2> /var/log/rabbitmq/startup_err + case "$?" in + 0) + echo SUCCESS && touch $LOCK_FILE + RETVAL=0 + ;; + 1) + echo TIMEOUT - check /var/log/rabbitmq/startup_\{log,err\} + RETVAL=1 + ;; + *) + echo FAILED - check /var/log/rabbitmq/startup_log, _err + RETVAL=1 + ;; + esac + set -e +} + +stop_rabbitmq () { + set +e + status_rabbitmq quiet + if [ $RETVAL = 0 ] ; then + $DAEMON stop_all > /var/log/rabbitmq/shutdown_log 2> /var/log/rabbitmq/shutdown_err + RETVAL=$? + if [ $RETVAL != 0 ] ; then + echo FAILED - check /var/log/rabbitmq/shutdown_log, _err + else + rm -rf $LOCK_FILE + fi + else + echo No nodes running + RETVAL=0 + fi + set -e +} + +status_rabbitmq() { + set +e + if [ "$1" != "quiet" ] ; then + $DAEMON status 2>&1 + else + $DAEMON status > /dev/null 2>&1 + fi + if [ $? != 0 ] ; then + RETVAL=1 + fi + set -e +} + +rotate_logs_rabbitmq() { + set +e + $DAEMON rotate_logs ${ROTATE_SUFFIX} + if [ $? != 0 ] ; then + RETVAL=1 + fi + set -e +} + +restart_rabbitmq() { + stop_rabbitmq + start_rabbitmq +} + +case "$1" in + start) + echo -n "Starting $DESC: " + start_rabbitmq + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + stop_rabbitmq + echo "$NAME." + ;; + status) + status_rabbitmq + ;; + rotate-logs) + echo -n "Rotating log files for $DESC: " + rotate_logs_rabbitmq + ;; + force-reload|reload|restart) + echo -n "Restarting $DESC: " + restart_rabbitmq + echo "$NAME." + ;; + condrestart|try-restart) + echo -n "Restarting $DESC: " + restart_rabbitmq + echo "$NAME." + ;; + *) + echo "Usage: $0 {start|stop|status|rotate-logs|restart|condrestart|try-restart|reload|force-reload}" >&2 + RETVAL=2 + ;; +esac + +exit $RETVAL diff --git a/rabbitmq-server.logrotate b/rabbitmq-server.logrotate new file mode 100644 index 0000000..6b65761 --- /dev/null +++ b/rabbitmq-server.logrotate @@ -0,0 +1,12 @@ +/var/log/rabbitmq/*.log { + weekly + missingok + rotate 20 + compress + delaycompress + notifempty + sharedscripts + postrotate + /sbin/service rabbitmq-server rotate-logs > /dev/null + endscript +} diff --git a/rabbitmq-server.spec b/rabbitmq-server.spec new file mode 100644 index 0000000..9b95f68 --- /dev/null +++ b/rabbitmq-server.spec @@ -0,0 +1,157 @@ +%define debug_package %{nil} + +Name: rabbitmq-server +Version: 1.5.5 +Release: 1 +License: MPLv1.1 +Group: Development/Libraries +Source: http://www.rabbitmq.com/releases/rabbitmq-server/v%{version}/%{name}-%{version}.tar.gz +Source1: rabbitmq-server.init +Source2: rabbitmq-script-wrapper +Source3: rabbitmq-server.logrotate +URL: http://www.rabbitmq.com/ +BuildRequires: erlang, python-simplejson +Requires: erlang, logrotate +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%{_arch}-root +Summary: The RabbitMQ server +Requires(post): chkconfig initscripts +Requires(pre): chkconfig initscripts + +%description +RabbitMQ is an implementation of AMQP, the emerging standard for high +performance enterprise messaging. The RabbitMQ server is a robust and +scalable implementation of an AMQP broker. + +%define _rabbit_erllibdir %{_libdir}/erlang/lib/rabbitmq_server-%{version} +%define _rabbit_libdir %{_libdir}/rabbitmq +%define _rabbit_wrapper %{_builddir}/`basename %{S:2}` + +%define _maindir %{buildroot}%{_rabbit_erllibdir} + +%prep +%setup -q + +%build +cp %{S:2} %{_rabbit_wrapper} +sed -i 's|/usr/lib/|%{_libdir}/|' %{_rabbit_wrapper} + +# The rabbitmq build needs escript, which is missing from /usr/bin in +# some versions of the erlang RPM. See +# +PATH=%{_libdir}/erlang/bin:$PATH make %{?_smp_mflags} + +%install +rm -rf %{buildroot} + +make install TARGET_DIR=%{_maindir} \ + SBIN_DIR=%{buildroot}%{_rabbit_libdir}/bin \ + MAN_DIR=%{buildroot}%{_mandir} + +mkdir -p %{buildroot}%{_localstatedir}/lib/rabbitmq/mnesia +mkdir -p %{buildroot}%{_localstatedir}/log/rabbitmq + +#Copy all necessary lib files etc. +install -p -D -m 0755 %{S:1} %{buildroot}%{_initrddir}/rabbitmq-server +install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmqctl +install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmq-server +install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmq-multi + +install -p -D -m 0644 %{S:3} %{buildroot}%{_sysconfdir}/logrotate.d/rabbitmq-server + +mkdir -p %{buildroot}%{_sysconfdir}/rabbitmq + +rm %{_maindir}/LICENSE %{_maindir}/LICENSE-MPL-RabbitMQ %{_maindir}/INSTALL + +#Build the list of files +rm -f %{_builddir}/filelist.%{name}.rpm +echo '%defattr(-,root,root, -)' >> %{_builddir}/filelist.%{name}.rpm +(cd %{buildroot}; \ + find . -type f ! -regex '\.%{_sysconfdir}.*' \ + ! -regex '\.\(%{_rabbit_erllibdir}\|%{_rabbit_libdir}\).*' \ + | sed -e 's/^\.//' >> %{_builddir}/filelist.%{name}.rpm) + +%pre + +if [ $1 -gt 1 ]; then + #Upgrade - stop and remove previous instance of rabbitmq-server init.d script + /sbin/service rabbitmq-server stop + /sbin/chkconfig --del rabbitmq-server +fi + +# create rabbitmq group +if ! getent group rabbitmq >/dev/null; then + groupadd -r rabbitmq +fi + +# create rabbitmq user +if ! getent passwd rabbitmq >/dev/null; then + useradd -r -g rabbitmq -d %{_localstatedir}/lib/rabbitmq rabbitmq \ + -c "RabbitMQ messaging server" +fi + +%post +/sbin/chkconfig --add %{name} + +%preun +if [ $1 = 0 ]; then + #Complete uninstall + /sbin/service rabbitmq-server stop + /sbin/chkconfig --del rabbitmq-server + + # We do not remove /var/log and /var/lib directories + # Leave rabbitmq user and group +fi + +%files -f ../filelist.%{name}.rpm +%defattr(-,root,root,-) +%attr(0750, rabbitmq, rabbitmq) %dir %{_localstatedir}/lib/rabbitmq +%attr(0750, rabbitmq, rabbitmq) %dir %{_localstatedir}/log/rabbitmq +%dir %{_sysconfdir}/rabbitmq +%{_rabbit_erllibdir} +%{_rabbit_libdir} +%{_initrddir}/rabbitmq-server +%config(noreplace) %{_sysconfdir}/logrotate.d/rabbitmq-server +%doc LICENSE LICENSE-MPL-RabbitMQ + +%clean +rm -rf %{buildroot} + +%changelog +* Tue May 19 2009 Matthias Radestock 1.5.5-1 +- Maintenance release for the 1.5.x series + +* Mon Apr 6 2009 Matthias Radestock 1.5.4-1 +- Maintenance release for the 1.5.x series + +* Tue Feb 24 2009 Tony Garnock-Jones 1.5.3-1 +- Maintenance release for the 1.5.x series + +* Mon Feb 23 2009 Tony Garnock-Jones 1.5.2-1 +- Maintenance release for the 1.5.x series + +* Mon Jan 19 2009 Ben Hood <0x6e6562@gmail.com> 1.5.1-1 +- Maintenance release for the 1.5.x series + +* Wed Dec 17 2008 Matthias Radestock 1.5.0-1 +- New upstream release + +* Thu Jul 24 2008 Tony Garnock-Jones 1.4.0-1 +- New upstream release + +* Mon Mar 3 2008 Adrien Pierard 1.3.0-1 +- New upstream release + +* Wed Sep 26 2007 Simon MacMullen 1.2.0-1 +- New upstream release + +* Wed Aug 29 2007 Simon MacMullen 1.1.1-1 +- New upstream release + +* Mon Jul 30 2007 Simon MacMullen 1.1.0-1.alpha +- New upstream release + +* Tue Jun 12 2007 Hubert Plociniczak 1.0.0-1.20070607 +- Building from source tarball, added starting script, stopping + +* Mon May 21 2007 Hubert Plociniczak 1.0.0-1.alpha +- Initial build of server library of RabbitMQ package diff --git a/sources b/sources index e69de29..fe9c0f0 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +1dceb98bb57cd6acef90f58e96a7fce4 rabbitmq-server-1.5.5.tar.gz