Browse files

Make it easier to build an RPM from source.

Add an `rpm' target to the Makefile that creates a tarball of the
current sources, and uses it to build an RPM.  Also fix various
issues to be able to build on Fedora and neuter various RPM macros
that are sometimes overridden and make life unnecessarily painful.
  • Loading branch information...
1 parent 9728359 commit 617cf00a03d23fdcc66c4c03e85d33bb7049a37a @tsuna tsuna committed Feb 7, 2013
Showing with 48 additions and 17 deletions.
  1. +17 −1
  2. +31 −16
@@ -130,6 +130,7 @@ EXTRA_DIST = $(tsdb_SRC) $(test_SRC) \
$(httpui_SRC) $(httpui_DEPS) \
tools/check_tsd \
tools/ \
+ opentsdb.spec \
bootstrap build-aux/ $(builddata_SRC)
GWTC_JVM_ARGS = # add jvmarg -Xss16M or similar if you see a StackOverflowError
@@ -392,5 +393,20 @@ pom.xml: Makefile
} >$@-t
mv $@-t ../$@
-.PHONY: jar doc check gwtc gwtdev printdeps staticroot gwttsd
+RPM := opentsdb-$(PACKAGE_VERSION)-$(RPM_REVISION).noarch.rpm
+rpm: $(RPM)
+$(RPM): opentsdb.spec
+ rpmbuild --target=noarch --buildroot=`pwd`/rpmbuildroot -bb $<
+ test -f $@ || for rpm in $(RPM_TARGET)/$@ \
+ `awk '$$1=="Name:"{print $$2}' $<`.`awk '$$1=="BuildArch:"{print $$2}' $<`.rpm; do \
+ test -f "$$rpm" && mv "$$rpm" $@ && break; \
+ done
+ if test -d noarch; then rmdir noarch; fi
+.PHONY: jar doc check gwtc gwtdev printdeps staticroot gwttsd rpm
include third_party/
@@ -1,19 +1,37 @@
+# Put the RPM in the current directory.
+%define _rpmdir .
+# Find the tarball produced by `make dist' in the current directory.
+%define _sourcedir %(echo $PWD)
Version: @VERSION@
Release: 1
Summary: A scalable, distributed Time Series Database
BuildArch: noarch
-ExclusiveArch: noarch
-ExclusiveOS: linux
-Group: Service/Management
-License: GNU Lesser GPL
+Group: Service/Monitoring
+License: LGPLv2.1+
-BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+Source: @PACKAGE@-@VERSION@.tar.gz
Requires: gnuplot
+# Disable the stupid stuff rpm distros include in the build process by
+# default:
+# Disable any prep shell actions. replace them with simply 'true'
+%define __spec_prep_pre true
+%define __spec_prep_post true
+# Disable any build shell actions. replace them with simply 'true'
+%define __spec_build_pre cd %{_builddir}
+%define __spec_build_post true
+# Disable any install shell actions. replace them with simply 'true'
+%define __spec_install_pre cd %{_builddir}
+%define __spec_install_post true
+# Disable any clean shell actions. replace them with simply 'true'
+%define __spec_clean_pre cd %{_builddir}
+%define __spec_clean_post true
OpenTSDB is a distributed, scalable Time Series Database (TSDB) written on top of HBase. OpenTSDB was written to address a common need: store, index and serve metrics collected from computer systems (network gear, operating systems, applications) at a large scale, and make this data easily accessible and graphable.
Thanks to HBase's scalability, OpenTSDB allows you to collect many thousands of metrics from thousands of hosts and applications, at a high rate (every few seconds). OpenTSDB will never delete or downsample data and can easily store billions of data points. As a matter of fact, StumbleUpon uses it to keep track of hundred of thousands of time series and collects over 1 billion data points per day in their main production datacenter. Other sites such as Box or Tumblr are pushing tens of billions of data points per day.
@@ -26,13 +44,11 @@ Imagine having the ability to quickly plot a graph showing the number of DELETE
-cd $RPM_BUILD_DIR/%{name}-%{version}
rm -rf %{buildroot}
-cd $RPM_BUILD_DIR/%{name}-%{version}/build
make install DESTDIR=%{buildroot}
mkdir -p %{buildroot}/var/cache/opentsdb
@@ -43,13 +59,12 @@ rm -rf %{buildroot}
-%attr(0755,root,root) /usr/local/bin/*
-%attr(0755,root,root) /usr/local/share/opentsdb/*.sh
+%attr(0755,root,root) %{_bindir}/*
+%attr(0755,root,root) %{_datarootdir}/opentsdb/*.sh
-%dir /var/cache/opentsdb
+%dir %{_localstatedir}/cache/opentsdb

0 comments on commit 617cf00

Please sign in to comment.