Skip to content
Browse files

RPM packaging spec. Patch by Daniel Lundin, Ted Zlatnov, Stu Hood, Pe…

…ter Halliday, and Nick Bailey, reviewed by brandonwilliams for CASSANDRA-786.

git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@1000082 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent df57aee commit cbc1f651408d8d1004e3df8419cd1c66646efab3 @driftx driftx committed Sep 22, 2010
Showing with 112 additions and 0 deletions.
  1. +1 −0 CHANGES.txt
  2. +111 −0 redhat/apache-cassandra.spec
View
1 CHANGES.txt
@@ -85,6 +85,7 @@
exception rather than the ExecutionException wrapper (CASSANDRA-1226)
* remove Clock from the Thrift (and Avro) API (CASSANDRA-1501)
* Close intra-node sockets when connection is broken (CASSANDRA-1528)
+ * RPM packaging spec file (CASSANDRA-786)
0.7-beta1
View
111 redhat/apache-cassandra.spec
@@ -0,0 +1,111 @@
+%define __jar_repack %{nil}
+
+%global username cassandra
+
+Name: apache-cassandra
+Version: 0.7.0
+Release: 1%{?dist}
+Summary: Cassandra is a highly scalable, eventually consistent, distributed, structured key-value store.
+
+Group: Development/Libraries
+License: BSD
+URL: http://cassandra.apache.org/
+Source0: http://www.ibiblio.org/pub/mirrors/apache/%{username}/%{version}/%{name}-%{version}-src.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildRequires: java-devel
+BuildRequires: jpackage-utils
+BuildRequires: ant
+BuildRequires: ant-nodeps
+
+Requires: java >= 1.6.0
+Requires: jpackage-utils
+Requires(pre): user(cassandra)
+Requires(pre): group(cassandra)
+Requires(pre): shadow-utils
+Provides: user(cassandra)
+Provides: group(cassandra)
+
+BuildArch: noarch
+
+%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.
+
+For more information see http://incubator.apache.org/cassandra
+
+%prep
+%setup -q -n %{name}-%{version}-src
+
+%build
+ant clean jar -Drelease=true
+
+%install
+%{__rm} -rf %{buildroot}
+mkdir -p %{buildroot}%{_sysconfdir}/%{username}/
+mkdir -p %{buildroot}/usr/share/%{username}
+mkdir -p %{buildroot}/usr/share/%{username}/lib
+mkdir -p %{buildroot}/usr/share/%{username}/default.conf
+mkdir -p %{buildroot}/etc/%{username}/default.conf
+mkdir -p %{buildroot}/etc/rc.d/init.d/
+mkdir -p %{buildroot}/usr/sbin
+mkdir -p %{buildroot}/usr/bin
+cp -p conf/* %{buildroot}/etc/%{username}/default.conf
+cp -p conf/* %{buildroot}/usr/share/%{username}/default.conf
+cp -p contrib/redhat/%{username} %{buildroot}/etc/rc.d/init.d/
+cp -p lib/*.jar %{buildroot}/usr/share/%{username}/lib
+mv bin/cassandra.in.sh %{buildroot}/usr/share/%{username}
+mv bin/cassandra %{buildroot}/usr/sbin
+rm bin/*.bat
+cp -p bin/* %{buildroot}/usr/bin
+cp build/%{name}-%{version}.jar %{buildroot}/usr/share/%{username}/lib
+mkdir -p %{buildroot}/var/lib/%{username}/commitlog
+mkdir -p %{buildroot}/var/lib/%{username}/data
+mkdir -p %{buildroot}/var/run/%{username}
+mkdir -p %{buildroot}/var/log/%{username}
+
+%clean
+%{__rm} -rf %{buildroot}
+
+%pre
+getent group %{username} >/dev/null || groupadd -r %{username}
+getent passwd %{username} >/dev/null || \
+useradd -d /usr/share/%{username} -g %{username} -M -r %{username}
+exit 0
+
+%preun
+# only delete user on removal, not upgrade
+if [ "$1" = "0" ]; then
+ userdel %{username}
+fi
+
+%files
+%defattr(-,root,root,0755)
+%doc CHANGES.txt LICENSE.txt README.txt NEWS.txt NOTICE.txt
+%attr(755,root,root) %{_bindir}/*
+%attr(755,root,root) %{_sbindir}/cassandra
+%attr(755,root,root) /etc/rc.d/init.d/%{username}
+%attr(755,%{username},%{username}) /usr/share/%{username}*
+%attr(755,%{username},%{username}) %config(noreplace) /%{_sysconfdir}/%{username}
+%attr(755,%{username},%{username}) %config(noreplace) /var/lib/%{username}/*
+%attr(755,%{username},%{username}) /var/log/%{username}*
+%attr(755,%{username},%{username}) /var/run/%{username}*
+
+%post
+alternatives --install /etc/%{username}/conf %{username} /etc/%{username}/default.conf/ 0
+exit 0
+
+%postun
+# only delete alternative on removal, not upgrade
+if [ "$1" = "0" ]; then
+ alternatives --remove %{username} /etc/%{username}/default.conf/
+fi
+exit 0
+
+%changelog
+* Tue Aug 03 2010 Nick Bailey <nicholas.bailey@rackpace.com> - 0.7.0-1
+- Updated to make configuration easier and changed package name.
+* Mon Jul 05 2010 Peter Halliday <phalliday@excelsiorsystems.net> - 0.6.3-1
+- Initial package

0 comments on commit cbc1f65

Please sign in to comment.
Something went wrong with that request. Please try again.