From 9369db1dfd92d4eb76284cfb68b1ffb9d22c9b06 Mon Sep 17 00:00:00 2001 From: Michael Shuler Date: Wed, 21 Jun 2017 13:57:40 -0500 Subject: [PATCH] Prepare 2.1.18 release - release debian/changelog - backport RPM packaging fixes from cassandra-2.2 branch for CASSANDRA-13046, CASSANDRA-13434, CASSANDRA-13435, CASSANDRA-13433, and CASSANDRA-13493 --- debian/changelog | 4 ++-- redhat/README.md | 19 ++++++++++--------- redhat/cassandra | 38 ++++++++++++++++++++++++++++++++------ redhat/cassandra.spec | 7 +++++-- 4 files changed, 49 insertions(+), 19 deletions(-) diff --git a/debian/changelog b/debian/changelog index 48ed24b41e..a0ee85035d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -cassandra (2.1.18) UNRELEASED; urgency=medium +cassandra (2.1.18) unstable; urgency=medium * New release - -- Michael Shuler Tue, 21 Feb 2017 13:59:40 -0600 + -- Michael Shuler Wed, 21 Jun 2017 13:57:08 -0500 cassandra (2.1.17) unstable; urgency=medium diff --git a/redhat/README.md b/redhat/README.md index 0b2ab0df8b..cab42a752e 100644 --- a/redhat/README.md +++ b/redhat/README.md @@ -7,25 +7,26 @@ ### Step 1: - Build and copy sources to build tree: ``` -ant artifacts -cp build/apache-cassandra-*-src.tar.gz $RPM_BUILD_DIR/SOURCES/ +ant artifacts -Drelease=true ``` ### Step 2: - Since there is no version specified in the SPEC file, one needs to be passed at `rpmbuild` time (example with 4.0): ``` -rpmbuild --define="version 4.0" -ba redhat/cassandra.spec +mkdir -p build/rpmbuild/{BUILD,RPMS,SPECS,SRPMS} +rpmbuild --define="version 4.0" \ + --define="revision $(date +"%Y%m%d")git$(git rev-parse --short HEAD)%{?dist}" \ + --define "_topdir $(pwd)/build/rpmbuild" \ + --define "_sourcedir $(pwd)/build" \ + -ba redhat/cassandra.spec ``` +Use revision value in the example above for git based snapshots. Change to `--define="revision 1"` for non-snapshot releases. + - RPM files can be found in their respective build tree directories: ``` -ls -l $RPM_BUILD_DIR/{SRPMS,RPMS}/ +ls -l build/rpmbuild/{SRPMS,RPMS}/ ``` ### Hint: - Don't build packages as root.. -``` -# this makes your RPM_BUILD_DIR = ~/rpmbuild -mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} -echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros -``` diff --git a/redhat/cassandra b/redhat/cassandra index 3e59534ce3..677ff8c7ff 100644 --- a/redhat/cassandra +++ b/redhat/cassandra @@ -3,9 +3,23 @@ # /etc/init.d/cassandra # # Startup script for Cassandra -# -# chkconfig: 2345 20 80 +# +# chkconfig: 2345 80 20 # description: Starts and stops Cassandra +# pidfile: /var/run/cassandra/cassandra.pid + +### BEGIN INIT INFO +# Provides: cassandra +# Required-Start: $remote_fs $network $named $time +# Required-Stop: $remote_fs $network $named $time +# Should-Start: ntp mdadm +# Should-Stop: ntp mdadm +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: distributed storage system for structured data +# Description: Cassandra is a distributed (peer-to-peer) system for +# the management and storage of structured data. +### END INIT INFO . /etc/rc.d/init.d/functions @@ -53,6 +67,8 @@ case "$1" in start) # Cassandra startup echo -n "Starting Cassandra: " + [ -d `dirname "$pid_file"` ] || \ + install -m 755 -o $CASSANDRA_OWNR -g $CASSANDRA_OWNR -d `dirname $pid_file` su $CASSANDRA_OWNR -c "$CASSANDRA_PROG -p $pid_file" > $log_file 2>&1 retval=$? [ $retval -eq 0 ] && touch $lock_file @@ -64,16 +80,26 @@ case "$1" in su $CASSANDRA_OWNR -c "kill `cat $pid_file`" retval=$? [ $retval -eq 0 ] && rm -f $lock_file - for t in `seq 40`; do $0 status > /dev/null 2>&1 && sleep 0.5 || break; done + for t in `seq 40`; do + status -p $pid_file cassandra > /dev/null 2>&1 + retval=$? + if [ $retval -eq 3 ]; then + echo "OK" + exit 0 + else + sleep 0.5 + fi; + done # Adding a sleep here to give jmx time to wind down (CASSANDRA-4483). Not ideal... # Adam Holmberg suggests this, but that would break if the jmx port is changed # for t in `seq 40`; do netstat -tnlp | grep "0.0.0.0:7199" > /dev/null 2>&1 && sleep 0.1 || break; done sleep 5 - STATUS=`$0 status` - if [[ $STATUS == "$NAME is stopped" ]]; then + status -p $pid_file cassandra > /dev/null 2>&1 + retval=$? + if [ $retval -eq 3 ]; then echo "OK" else - echo "ERROR: could not stop $NAME: $STATUS" + echo "ERROR: could not stop $NAME" exit 1 fi ;; diff --git a/redhat/cassandra.spec b/redhat/cassandra.spec index e43238ece5..d87f760f3e 100644 --- a/redhat/cassandra.spec +++ b/redhat/cassandra.spec @@ -2,10 +2,13 @@ # Turn off the brp-python-bytecompile script %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') +# rpmbuild should not barf when it spots we ship +# binary executable files in our 'noarch' package +%define _binaries_in_noarch_packages_terminate_build 0 + %global username cassandra %define relname apache-cassandra-%{version} -%define revision 1 Name: cassandra Version: %{version} @@ -18,7 +21,7 @@ URL: http://cassandra.apache.org/ Source0: %{relname}-src.tar.gz BuildRoot: %{_tmppath}/%{relname}root-%(%{__id_u} -n) -BuildRequires: ant +BuildRequires: ant >= 1.9 Requires: jre >= 1.7.0 Requires: python(abi) >= 2.7