This patch introduces a feature whereby rrdcached will disallow updates
[rrdtool.git] / rrdtool.spec
index 9e94a90..9b57611 100644 (file)
@@ -2,26 +2,33 @@
 %define with_php %{?_without_php: 0} %{?!_without_php: 1}
 %define with_tcl %{?_without_tcl: 0} %{?!_without_tcl: 1}
 %define with_ruby %{?_without_ruby: 0} %{?!_without_ruby: 1}
-%define php_rrd_svn 839
 %define php_extdir %(php-config --extension-dir 2>/dev/null || echo %{_libdir}/php4)
+%define svnrev r1190
+#define pretag 1.2.99908020600
+%define rrdcached_user rrdcached
 
 Summary: Round Robin Database Tool to store and display time-series data
 Name: rrdtool
-Version: 1.3rc7
-Release: 0.1%{?dist}
-License: GPL
+Version: 1.3.99908093000
+Release: 0.20%{?dist}
+License: GPLv2+ with exceptions
 Group: Applications/Databases
 URL: http://oss.oetiker.ch/rrdtool/
 #Source0: http://oss.oetiker.ch/%{name}/pub/%{name}-%{version}.tar.gz
-Source0: http://oss.oetiker.ch/rrdtool/pub/beta/rrdtool-trunk-svn-snap.tar.gz
-Source1: php4-svn%{php_rrd_svn}.tar.gz
-Patch0: rrdtool-1.2.13-php.patch
+Source0: http://oss.oetiker.ch/rrdtool/pub/beta/%{name}-%{version}.tar.gz
+%if %{with_php}
+Source1: php4-%{svnrev}.tar.gz
+Patch1: rrdtool-1.3.0-beta4-fix-rrd_update-in-php-bindings.patch
+%endif
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Requires: dejavu-lgc-fonts
 BuildRequires: gcc-c++, openssl-devel, freetype-devel
-BuildRequires: libpng-devel, zlib-devel, cairo-devel
-BuildRequires: perl-ExtUtils-MakeMaker
-%if "%{?fedora}" >= "7"
-BuildRequires: perl-devel
+BuildRequires: libpng-devel, zlib-devel, intltool >= 0.35.0
+BuildRequires: cairo-devel >= 1.2, pango-devel >= 1.14
+BuildRequires: libtool, groff
+BuildRequires: gettext, libxml2-devel
+%if 0%{?fedora} >= 7
+BuildRequires: perl-ExtUtils-MakeMaker perl-devel
 %endif
 
 %description
@@ -93,8 +100,15 @@ Group: Development/Languages
 BuildRequires: php-devel >= 4.0
 Requires: php >= 4.0
 Requires: %{name} = %{version}-%{release}
+%if 0%{?php_zend_api}
+Requires: php(zend-abi) = %{php_zend_api}
+Requires: php(api) = %{php_core_api}
+%else
+Requires: php-api = %{php_apiver}
+%endif
 Obsoletes: php-%{name} < %{version}-%{release}
 Provides: php-%{name} = %{version}-%{release}
+Provides: php-pecl(rrdtool)
 
 %description php
 The %{name}-php package includes a dynamic shared object (DSO) that adds
@@ -129,14 +143,24 @@ Requires: %{name} = %{version}-%{release}
 The %{name}-ruby package includes RRDtool bindings for Ruby.
 %endif
 
+%package cached
+Summary: Data caching daemon for RRDtool
+Group: Applications/Databases
+Requires: %{name} = %{version}-%{release}
+
+%description cached
+rrdcached is a daemon that receives updates to existing RRD files,
+accumulates them and, if enough have been received or a defined time has
+passed, writes the updates to the RRD file.  The daemon was written with
+big setups in mind which usually runs into I/O related problems.  This
+daemon was written to alleviate these problems.
+
 %prep
-#setup -q
-%setup -q -n %{name}-%{version}
-%setup -q -T -D -a 1
-# Patch based on http://oss.oetiker.ch/rrdtool/pub/contrib/php_rrdtool.tgz
 %if %{with_php}
-%patch0 -p0 -b .php
-%{__perl} -pi -e 's|../config.h|../rrd_config.h|g' php4/rrdtool.c
+%setup -q -n %{name}-%{version} -a 1
+%patch1 -p1
+%else
+%setup -q -n %{name}-%{version}
 %endif
 
 # Fix to find correct python dir on lib64
@@ -144,17 +168,27 @@ The %{name}-ruby package includes RRDtool bindings for Ruby.
     configure
 
 # Most edits shouldn't be necessary when using --libdir, but
-# w/o, some introduce hardcoded rpaths where they shouldn't,
-%{__perl} -pi.orig -e 's|/lib\b|/%{_lib}|g' \
-    configure Makefile.in php4/configure php4/ltconfig*
+# w/o, some introduce hardcoded rpaths where they shouldn't
+%{__perl} -pi.orig -e 's|/lib\b|/%{_lib}|g' configure Makefile.in*
+%if %{with_php}
+%{__perl} -pi.orig -e 's|/lib\b|/%{_lib}|g' php4/configure php4/ltconfig*
+%endif
+
+# Perl 5.10 seems to not like long version strings, hack around it
+%{__perl} -pi.orig -e 's|1.299907080300|1.29990708|' \
+    bindings/perl-shared/RRDs.pm bindings/perl-piped/RRDp.pm
+
+#
+# fix config files for php4 bindings
+# workaround needed due to https://bugzilla.redhat.com/show_bug.cgi?id=211069
+%if %{with_php}
+cp -p /usr/lib/rpm/config.{guess,sub} php4/
+%endif
+
 
 %build
-intltoolize --automake -c -f
-aclocal
-autoheader
-autoconf
-automake -a -c -f
 %configure \
+    CFLAGS="-g -O0" \
     --with-perl-options='INSTALLDIRS="vendor"' \
 %if %{with_tcl}
     --enable-tcl-site \
@@ -184,7 +218,8 @@ pushd bindings/perl-piped/
 %{__perl} -pi.orig -e 's|/lib/perl|/%{_lib}/perl|g' Makefile
 popd
 
-%{__make} %{?_smp_mflags}
+#{__make} %{?_smp_mflags}
+make
 
 # Build the php module, the tmp install is required
 %if %{with_php}
@@ -194,7 +229,8 @@ pushd php4/
 %configure \
     --with-rrdtool="%{rrdtmp}%{_prefix}" \
     --disable-static
-%{__make} %{?_smp_mflags}
+#{__make} %{?_smp_mflags}
+make
 popd
 %{__rm} -rf %{rrdtmp}
 %endif
@@ -226,6 +262,9 @@ __EOF__
 # Pesky RRDp.pm...
 %{__mv} $RPM_BUILD_ROOT%{perl_vendorarch}/../RRDp.pm $RPM_BUILD_ROOT%{perl_vendorarch}/
 
+# Dunno why this is getting installed here...
+%{__rm} -f $RPM_BUILD_ROOT%{perl_vendorarch}/../leaktest.pl
+
 # We only want .txt and .html files for the main documentation
 %{__mkdir_p} doc2/html doc2/txt
 %{__cp} -a doc/*.txt doc2/txt/
@@ -242,35 +281,61 @@ __EOF__
 find examples/ -type f -exec chmod 0644 {} \;
 
 # Clean up the buildroot
-%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}/{txt,html}/ \
+%{__rm} -rf $RPM_BUILD_ROOT%{_docdir}/%{name}-* \
        $RPM_BUILD_ROOT%{perl_vendorarch}/ntmake.pl \
        $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod \
         $RPM_BUILD_ROOT%{_datadir}/%{name}/examples \
         $RPM_BUILD_ROOT%{perl_vendorarch}/auto/*/{.packlist,*.bs}
 
+# Set up rrdcached
+%__install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/default
+%__install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d
+%__install -m 0644 etc/rrdcached-default $RPM_BUILD_ROOT/%{_sysconfdir}/default/rrdcached
+%__install -m 0755 etc/rrdcached-init $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d/rrdcached
+%__install -d -m 0755 -o nobody -g nobody $RPM_BUILD_ROOT/%{_localstatedir}/run/rrdcached
+
 %clean
 %{__rm} -rf $RPM_BUILD_ROOT
 
+%pre cached
+/usr/sbin/groupadd %rrdcached_user &>/dev/null ||:
+/usr/sbin/useradd -s /sbin/nologin -g %rrdcached_user -c %rrdcached_user -d %{_localstatedir}/run/rrdcached  %rrdcached_user &>/dev/null || :
+
 %post -p /sbin/ldconfig
 
+%post cached
+/sbin/chkconfig --add rrdcached
+/sbin/service rrdcached start
+
+%preun cached
+/sbin/service rrdcached stop
+
 %postun -p /sbin/ldconfig
 
+%postun cached
+/sbin/chkconfig --del rrdcached
+test "$1" != 0 || /usr/sbin/userdel %rrdcached_user &>/dev/null || :
+#test "$1" != 0 || /usr/sbin/groupdel %rrdcached_user &>/dev/null || :
+
 %files
 %defattr(-,root,root,-)
 %{_bindir}/*
+%exclude %{_bindir}/rrdcached
 %{_libdir}/*.so.*
 %{_datadir}/%{name}
 %{_mandir}/man1/*
+%exclude %{_mandir}/man1/rrdcached*
 
 %files devel
 %defattr(-,root,root,-)
 %{_includedir}/*.h
 %exclude %{_libdir}/*.la
 %{_libdir}/*.so
+%{_libdir}/pkgconfig/librrd.pc
 
 %files doc
 %defattr(-,root,root,-)
-%doc CHANGES CONTRIBUTORS COPYING COPYRIGHT README TODO NEWS THREADS
+%doc CONTRIBUTORS COPYING COPYRIGHT README TODO NEWS THREADS
 %doc examples doc2/html doc2/txt
 
 %files perl
@@ -285,6 +350,7 @@ find examples/ -type f -exec chmod 0644 {} \;
 %defattr(-,root,root,-)
 %doc bindings/python/AUTHORS bindings/python/COPYING bindings/python/README
 %{python_sitearch}/rrdtoolmodule.so
+%{python_sitearch}/py_rrdtool-*.egg-info
 %endif
 
 %if %{with_php}
@@ -310,9 +376,99 @@ find examples/ -type f -exec chmod 0644 {} \;
 %{ruby_sitearch}/RRD.so
 %endif
 
+%files cached
+%{_bindir}/rrdcached
+%config %{_sysconfdir}/default/*
+%config %{_sysconfdir}/rc.d/init.d/*
+%{_mandir}/man1/rrdcached*
+%attr(0775 %rrdcached_user %rrdcached_user) %dir %{_localstatedir}/run/rrdcached
+
 %changelog
-* Fri Jun 15 2007 Jarod Wilson <jwilson@redhat.com> 1.2.999050724000-0.1
-- Update for rrdtool pre-1.3 snapshot
+* Wed Oct 08 2008 Bernard Li <bernard@vanhpc.org>
+- Split rrdcached related files to -cached subpackage
+- Create rrdcached user and make rrdcached related files owned by it
+
+* Tue Oct 07 2008 Bernard Li <bernard@vanhpc.org>
+- Include librrd.pc file in -devel package
+
+* Sun Jun 08 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.20.rc9
+- Update to rrdtool 1.3 rc9
+- Minor spec tweaks to permit building on older EL
+
+* Wed Jun 04 2008 Chris Ricker <kaboom@oobleck.net> 1.3-0.19.rc7
+- Update to rrdtool 1.3 rc7
+
+* Tue May 27 2008 Chris Ricker <kaboom@oobleck.net> 1.3-0.18.rc6
+- Update to rrdtool 1.3 rc6
+
+* Wed May 21 2008 Chris Ricker <kaboom@oobleck.net> 1.3-0.17.rc4
+- Bump version and rebuild
+
+* Wed May 21 2008 Chris Ricker <kaboom@oobleck.net> 1.3-0.16.rc4
+- Fix php bindings compile on x86_64
+
+* Mon May 19 2008 Chris Ricker <kaboom@oobleck.net> 1.3-0.15.rc4
+- Update to rrdtool 1.3 rc4
+
+* Tue May 13 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.15.rc1
+- Update to rrdtool 1.3 rc1
+- Fix versioning in changelog entries, had an extra 0 in there...
+- Drop cairo and python patches, they're in 1.3 rc1
+- Add Requires: gettext and libxml2-devel for new translations
+
+* Wed Apr 30 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.14.beta4
+- Drop some conditional flags, they're not working at the moment...
+
+* Wed Apr 30 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.13.beta4
+- Fix problem with cairo_save/cairo_restore (#444827)
+
+* Wed Apr 23 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.12.beta4
+- Fix python bindings rrdtool info implementation (#435468)
+
+* Tue Apr 08 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.11.beta4
+- Work around apparent version string length issue w/perl 5.10 (#441359)
+
+* Sat Apr 05 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.10.beta4
+- Fix use of rrd_update in php bindings (#437558)
+
+* Mon Mar  3 2008 Tom "spot" Callaway <tcallawa@redhat.com> 1.3-0.9.beta4
+- rebuild for new perl (again)
+
+* Wed Feb 13 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.8.beta4
+- Update to rrdtool 1.3 beta4
+
+* Tue Feb 05 2008 Tom "spot" Callaway <tcallawa@redhat.com> 1.3-0.7.beta3
+- rebuild for new perl (and fix license tag)
+
+* Mon Feb 04 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.6.beta3
+- Plug memory leak (#430879)
+
+* Mon Jan 07 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.5.beta3
+- Fix right-aligned text alignment and scaling (Resolves: #427609)
+
+* Wed Jan 02 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.4.beta3
+- Add newly built python egg to %%files
+
+* Wed Jan 02 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.3.beta3
+- Update to rrdtool 1.3 beta3
+- Return properly from errors in RRDp.pm (Resolves: #427040)
+- Requires: dejavu-lgc-fonts (Resolves: #426935)
+
+* Thu Dec 06 2007 Jarod Wilson <jwilson@redhat.com> 1.3-0.2.beta2
+- Update to rrdtool 1.3 beta2
+
+* Wed Aug 08 2007 Jarod Wilson <jwilson@redhat.com> 1.3-0.1.beta1
+- Update to rrdtool 1.3 beta1
+
+* Tue Jul 10 2007 Jarod Wilson <jwilson@redhat.com> 1.2.999-0.3.r1144
+- Update to latest rrdtool pre-1.3 svn snapshot (svn r1144)
+- Add php abi check (Resolves: #247339)
+
+* Fri Jun 15 2007 Jarod Wilson <jwilson@redhat.com> 1.2.999-0.2.r1127
+- Fix up BuildRequires
+
+* Fri Jun 15 2007 Jarod Wilson <jwilson@redhat.com> 1.2.999-0.1.r1127
+- Update to rrdtool pre-1.3 svn snapshot (svn r1127)
 
 * Mon May 21 2007 Jarod Wilson <jwilson@redhat.com> 1.2.23-5
 - BR: ruby so %%ruby_sitearch gets set