From 786c95fae1e329a916949c890d024f1b2aeb6f00bacdd913a6f0f3b636a2f326 Mon Sep 17 00:00:00 2001 From: Denisart Benjamin Date: Thu, 3 Oct 2013 14:16:18 +0000 Subject: [PATCH 1/2] Accepting request 201898 from home:jsjhb:branches:devel:languages:python - add rrdtools-cached package including systemd service - add full documentation (txt, html) - clean up the ruby header workaround using site install OBS-URL: https://build.opensuse.org/request/show/201898 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/rrdtool?expand=0&rev=43 --- rrdcached-systemd-pre | 45 ++++++++++++++ rrdcached.init | 133 ++++++++++++++++++++++++++++++++++++++++++ rrdcached.service | 25 ++++++++ rrdtool.changes | 5 ++ rrdtool.spec | 99 ++++++++++++++++++++++++++++++- sysconfig.rrdcached | 104 +++++++++++++++++++++++++++++++++ 6 files changed, 408 insertions(+), 3 deletions(-) create mode 100644 rrdcached-systemd-pre create mode 100644 rrdcached.init create mode 100644 rrdcached.service create mode 100644 sysconfig.rrdcached diff --git a/rrdcached-systemd-pre b/rrdcached-systemd-pre new file mode 100644 index 0000000..46541b0 --- /dev/null +++ b/rrdcached-systemd-pre @@ -0,0 +1,45 @@ +#!/bin/sh +# +# script to create the file system environment for rrdcached +# from rrdtool package. This is needed, as openSUSE >= 13.1 +# enforces use of systemd, and does not allow the old-style +# init.d script. +# Hence, the content here is shamelessly ripped from the +# init.d script. +# + +# Check for existence of needed config file and read it +RRDCACHED_CONFIG='/etc/sysconfig/rrdcached' +test -r $RRDCACHED_CONFIG || { echo "$RRDCACHED_CONFIG not existing"; + if [ "$1" = "stop" ]; then exit 0; + else exit 6; fi; } + +RRDCACHED_PID='/var/lib/rrdtool/rrdcached/rrdcached.pid' + +# Read config +. $RRDCACHED_CONFIG + +function check_and_create_dir(){ + local DIR=$1 + test -d "$DIR" || mkdir -p "$DIR" +} + +check_and_create_dir "$(dirname $RRDCACHED_PID)" +chown $RRDCACHED_USER:$RRDCACHED_GROUP "$(dirname $RRDCACHED_PID)" +case "$RRDCACHED_ADDRESS" in + ^unix:) + SOCKETDIR=$(dirname ${RRDCACHED_ADDRESS/unix:/}) + check_and_create_dir "$SOCKETDIR" + chgrp $RRDCACHED_GROUP "$SOCKETDIR" + ;; +esac +case "$RRDCACHED_CHROOT_DIR" in + /tmp) + echo "Warning: starting with chroot dir $RRDCACHED_CHROOT_DIR" >&2 + ;; + *) + check_and_create_dir "$RRDCACHED_CHROOT_DIR" + chown $RRDCACHED_USER:$RRDCACHED_GROUP "$RRDCACHED_CHROOT_DIR" + ;; +esac + diff --git a/rrdcached.init b/rrdcached.init new file mode 100644 index 0000000..ac86114 --- /dev/null +++ b/rrdcached.init @@ -0,0 +1,133 @@ +#!/bin/sh +# +# /etc/init.d/rrdcached +# and its symbolic link +# /(usr/)sbin/rcrrdcached +# +### BEGIN INIT INFO +# Provides: rrdcached +# Required-Start: $local_fs $syslog $remote_fs +# Should-Start: $time +# Required-Stop: $local_fs $syslog $remote_fs +# Should-Stop: $null +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Start and stop rrdtool caching daemon +# Description: rrdcached is a caching daemon to aggregate +# updates to rrd files +### END INIT INFO + +RRDCACHED_BIN='/usr/bin/rrdcached' +test -x $RRDCACHED_BIN || { echo "$RRDCACHED_BIN not installed"; + if [ "$1" = "stop" ]; then exit 0; + else exit 5; fi; } + +# Check for existence of needed config file and read it +RRDCACHED_CONFIG='/etc/sysconfig/rrdcached' +test -r $RRDCACHED_CONFIG || { echo "$RRDCACHED_CONFIG not existing"; + if [ "$1" = "stop" ]; then exit 0; + else exit 6; fi; } + +RRDCACHED_PID='/var/lib/rrdtool/rrdcached/rrdcached.pid' + +# Read config +. $RRDCACHED_CONFIG + +# Source LSB init functions +. /etc/rc.status + +# Reset status of this service +rc_reset + +function check_and_create_dir(){ + local DIR=$1 + test -d "$DIR" || mkdir -p "$DIR" +} + +case "$1" in + start) + echo -n "Starting rrdcached " + check_and_create_dir "$(dirname $RRDCACHED_PID)" + chown $RRDCACHED_USER:$RRDCACHED_GROUP "$(dirname $RRDCACHED_PID)" + case "$RRDCACHED_ADDRESS" in + ^unix:) + SOCKETDIR=$(dirname ${RRDCACHED_ADDRESS/unix:/}) + check_and_create_dir "$SOCKETDIR" + chgrp $RRDCACHED_GROUP "$SOCKETDIR" + ;; + esac + case "$RRDCACHED_CHROOT_DIR" in + /tmp) + echo "Warning: starting with chroot dir $RRDCACHED_CHROOT_DIR" >&2 + ;; + *) + check_and_create_dir "$RRDCACHED_CHROOT_DIR" + chown $RRDCACHED_USER:$RRDCACHED_GROUP "$RRDCACHED_CHROOT_DIR" + ;; + esac + /sbin/startproc -u $RRDCACHED_USER $RRDCACHED_BIN \ + -s $RRDCACHED_GROUP \ + -b "$RRDCACHED_CHROOT_DIR" \ + -p "$RRDCACHED_PID" \ + -l $RRDCACHED_ADDRESS \ + -m $RRDCACHED_SOCKET_MASK \ + -w $RRDCACHED_DISKWRITE \ + -z $RRDCACHED_DELAY \ + -t $RRDCACHED_WRITE_THREADS \ + $RRDCACHED_OPTIONS + # workaround for wrong socket ownership and permission after stArt + case "$RRDCACHED_ADDRESS" in + ^unix:) + SOCKET=${RRDCACHED_ADDRESS/unix:/} + chown $RRDCACHED_USER:$RRDCACHED_GROUP "$SOCKET" + chmod $RRDCACHED_SOCKET_MASK "$SOCKET" + ;; + esac + rc_status -v + ;; + stop) + echo -n "Shutting down rrdcached " + /sbin/killproc -p $RRDCACHED_PID -t 10 $RRDCACHED_BIN + rc_status -v + ;; + try-restart|condrestart) + if test "$1" = "condrestart"; then + echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" + fi + $0 status + if test $? = 0; then + $0 restart + else + rc_reset # Not running is not a failure. + fi + rc_status + ;; + restart) + $0 stop + $0 start + rc_status + ;; + force-reload) + echo -n "Reload service rrdcached " + /sbin/killproc -p $RRDCACHED_PID -HUP $RRDCACHED_BIN + rc_status -v + ;; + reload) + echo -n "Reload service rrdcached " + /sbin/killproc -p $RRDCACHED_PID -HUP $RRDCACHED_BIN + rc_status -v + ;; + status) + echo -n "Checking for service rrdcached " + /sbin/checkproc $RRDCACHED_BIN + rc_status -v + ;; + probe) + test $RRDCACHED_CONFIG -nt $RRDCACHED_PID && echo reload + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" + exit 1 + ;; +esac +rc_exit diff --git a/rrdcached.service b/rrdcached.service new file mode 100644 index 0000000..6257ca5 --- /dev/null +++ b/rrdcached.service @@ -0,0 +1,25 @@ +# This file is part of package rrdtool. +# +# Description: +# +# Used to start rrdcached Data caching daemon for rrdtool +# + +[Unit] +Description=RRDcached RRD Data Caching Service +Requires=var-run.mount +Wants=network.target +After=network.target + +[Service] +ExecStartPre=-/bin/echo 'Starting RRD data caching service (rrdtools - rrdcached)' +ExecStartPre=/bin/sh -c "/usr/share/rrdcached/rrdcached-systemd-pre" +EnvironmentFile=-/etc/sysconfig/rrdcached +ExecStart=/usr/bin/rrdcached -s $RRDCACHED_GROUP -b "$RRDCACHED_CHROOT_DIR" -p "$RRDCACHED_PID" -l $RRDCACHED_ADDRESS -m $RRDCACHED_SOCKET_MASK -w $RRDCACHED_DISKWRITE -z $RRDCACHED_DELAY -t $RRDCACHED_WRITE_THREADS $RRDCACHED_OPTIONS +Restart=always +RestartSec=1 +PIDFile="$RRDCACHED_PID" +TimeoutStopSec=10 + +[Install] +WantedBy=multi-user.target diff --git a/rrdtool.changes b/rrdtool.changes index dd496a4..bf0a708 100644 --- a/rrdtool.changes +++ b/rrdtool.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Oct 2 13:40:14 UTC 2013 - obs@botter.cc + +- add systemd service for rrdcached + ------------------------------------------------------------------- Wed Jul 10 15:02:53 UTC 2013 - dvaleev@suse.com diff --git a/rrdtool.spec b/rrdtool.spec index 870b9bf..0f56210 100644 --- a/rrdtool.spec +++ b/rrdtool.spec @@ -43,6 +43,9 @@ BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool BuildRequires: tcpd-devel +%if 0%{?suse_version} >= 1210 +BuildRequires: systemd +%endif Requires: perl = %{perl_version} Version: 1.4.7 Release: 0 @@ -53,12 +56,17 @@ Patch2: rrdtool-tclversion.patch Patch3: rrdtool-tclsegfault.patch Source1: http://www.infodrom.org/projects/cgilib/download/cgilib-%{cgilib_version}.tar.gz Patch11: cgilib-fix_automake.patch +Source2: sysconfig.rrdcached +Source3: rrdcached.init +Source4: rrdcached-systemd-pre +Source5: rrdcached.service Url: http://oss.oetiker.ch/rrdtool/ BuildRoot: %{_tmppath}/%{name}-%{version}-build Summary: A tool for data logging and analysis License: GPL-2.0+ Group: Productivity/Scientific/Math Requires: dejavu +Requires(pre): pwdutils %description A tool to log and analyze data gathered from all kinds of data sources. @@ -102,8 +110,12 @@ if [ ! -d m4 ]; then mkdir m4; fi #autoreconf -i -f export LDFLAGS="-L`pwd`/lb/lib" CPPFLAGS="-I`pwd`/lb/include" \ %configure --disable-static --with-pic --enable-shared \ + --enable-tcl-site \ --with-tcllib=%{_libdir} \ --with-gnu-ld \ + --enable-python \ + --enable-ruby \ + --enable-ruby-site-install \ --disable-rpath \ --with-rrd-default-font="monospace" make %{?jobs:-j %jobs} V=1 @@ -119,8 +131,6 @@ make \ examplesdir=%{_docdir}/%{name}/examples/ \ libdir=%{_libdir} \ pkglibdir=%tcl_archdir/tclrrd%version \ - hdrdir=%{_includedir}/ruby-2.0.0 \ - rubyhdrdir=%{_includedir}/ruby-2.0.0 \ install # we install this later again rm -r $RPM_BUILD_ROOT%{_prefix}/lib/perl @@ -142,8 +152,32 @@ popd #sed 's/[[:space:]]*-L\/usr\/src\/packages\/BUILD\/%{name}-%{version}\/lb\/lib[[:space:]]*/ /' $RPM_BUILD_ROOT/%{_libdir}/librrd_th.la > tmp #mv tmp $RPM_BUILD_ROOT/%{_libdir}/librrd_th.la find "%{buildroot}" -type f -name '*.la' -exec %__rm {} \; +# install ruby bindings +pushd bindings/ruby +make DESTDIR=%{buildroot} install +popd # documentation install -m 644 CHANGES CONTRIBUTORS COPYING COPYRIGHT README TODO $RPM_BUILD_ROOT/%{_docdir}/%{name} +pushd doc +mkdir txt +mkdir html +mv *.txt txt/ +mv *.html html/ +popd +rm examples/rrdcached/Makefile* +chmod -x examples/* +chmod +x examples/rrdcached +# install rrdcached specials +install -Dm644 %{SOURCE2} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.rrdcached +install -Dm755 %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/rrdcached +%if 0%{?suse_version} >= 1210 +# install systemd specific files +install -Dm755 %{SOURCE4} %{buildroot}%{_datadir}/rrdcached/rrdcached-systemd-pre +install -Dm644 %{SOURCE5} %{buildroot}%{_unitdir}/rrdcached.service +%endif +mkdir -p %{buildroot}%{_sbindir} +ln -s %{_sysconfdir}/init.d/rrdcached %{buildroot}%{_sbindir}/rcrrdcached +mkdir -p %{buildroot}%{_localstatedir}/lib/rrdtool/rrdcached %clean rm -rf $RPM_BUILD_ROOT @@ -157,6 +191,7 @@ rm -rf $RPM_BUILD_ROOT %doc %{_docdir}/rrdtool %doc %{_mandir}/*/* /usr/bin/* +%exclude %{_bindir}/rrdcached %{_libdir}/librrd.so.* %{_libdir}/librrd_th.so.* %{perl_vendorlib}/RRDp.pm @@ -243,6 +278,7 @@ This package contains the Tcl bindings %{tcl_archdir}/* %{_libdir}/tclrrd*.so +#%{!?rb_sitearchdir: %define rb_sitearchdir %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitearchdir"]')} %package -n ruby-rrdtool Summary: Ruby bindings for rrdtool Group: Productivity/Scientific/Math @@ -258,6 +294,63 @@ This package contains the Ruby bindings %files -n ruby-rrdtool %defattr(-, root, root) -%{rb_archdir}/RRD.so +%{rb_sitearchdir}/RRD.so + +%package cached +Summary: Data caching daemon for RRDtool +Group: Productivity/Scientific/Math +Requires: %{name} = %{version} +Requires(pre): %insserv_prereq +Requires(pre): %fillup_prereq +%define rrdcached_user rrdcached +%define rrdcached_group rrdcached + +%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. + +%files cached +%defattr(-, root, root) +%{_bindir}/rrdcached +%{_sysconfdir}/init.d/rrdcached +%{_sbindir}/rcrrdcached +%{_localstatedir}/adm/fillup-templates/sysconfig.rrdcached +%dir %{_localstatedir}/lib/rrdtool +%attr(-,%rrdcached_user,%rrdcached_group) %dir %{_localstatedir}/lib/rrdtool/rrdcached +%if 0%{?suse_version} >= 1210 +%{_datadir}/rrdcached +%{_datadir}/rrdcached/rrdcached-systemd-pre +%{_unitdir}/rrdcached.service +%endif + +%pre cached +getent group %rrdcached_group >/dev/null || groupadd %rrdcached_group +getent passwd %rrdcached_user >/dev/null || useradd -s /sbin/nologin -g %rrdcached_group -c %rrdcached_user -d %{_localstatedir}/lib %rrdcached_user +%if 0%{?suse_version} >= 1210 +%service_add_pre rrdcached.service +%endif + +%post cached +%fillup_and_insserv rrdcached +%restart_on_update rrdcached +%if 0%{?suse_version} >= 1210 +%service_add_post rrdcached.service +%endif + +%preun cached +%stop_on_removal rrdcached +%if 0%{?suse_version} >= 1210 +%service_del_preun rrdcached.service +%endif + +%postun cached +%restart_on_update +%insserv_cleanup +%if 0%{?suse_version} >= 1210 +%service_del_postun rrdcached.service +%endif %changelog diff --git a/sysconfig.rrdcached b/sysconfig.rrdcached new file mode 100644 index 0000000..0de1375 --- /dev/null +++ b/sysconfig.rrdcached @@ -0,0 +1,104 @@ +# Settings for rrdcached +#OPTIONS="-l unix:/var/rrdtool/rrdcached/rrdcached.sock -s rrdcached -m 664 -b /var/rrdtool/rrdcached" +#OPTIONS="-w 1800 -z 1800 -p /tmp/rrdcached.pid -j /tmp -s nagios -m 0660 -l unix:/tmp/rrdcached.sock" +## Path: Network/WWW/RRDCached +## Description: Start parameters for RRDCached +## Type: string +## Default: "rrdcached" +## Config: rrdcached +## ServiceRestart: rrdcached +# +# username rrdcached should run as +# +RRDCACHED_USER="nagios" + + +## Type: string +## Default: "rrdcached" +## Config: rrdcached +## ServiceRestart: rrdcached +# +# group rrdcached should be run as +# +RRDCACHED_GROUP="nagios" + + +## Type: string +## Default: "unix:/var/rrdtool/rrdcached/rrdcached.sock" +## Config: rrdcached +## ServiceRestart: rrdcached +# +# Bind to address and accept incoming connections on that socket. +# +# If address begins with "unix:", everything following that prefix is +# interpreted as the path to a UNIX domain socket. +# +# If the address is an IPv4 address or a fully qualified domain name +# the square brackets can be omitted, resulting in the (simpler) +# "address:port" pattern. +# +# The default port is 42217/tcp. +# +RRDCACHED_ADDRESS="unix:/tmp/rrdcached.sock" + + +## Type: integer +## Default: 0664 +## Config: rrdcached +## ServiceRestart: rrdcached +# +# File permissions of a UNIX domain socket, if given via +# RRDCACHED_ADDRESS="unix:/" +# +RRDCACHED_SOCKET_MASK="0660" + + +## Type: integer +## Default: 300 +## Config: rrdcached +## ServiceRestart: rrdcached +# +# How often should data be written to disk +# in seconds. +# +RRDCACHED_DISKWRITE="300" + + +## Type: integer +## Default: 300 +## Config: rrdcached +## ServiceRestart: rrdcached +# +# Delay writing of each RRD for a random number of +# seconds in the range [0,delay) +# +RRDCACHED_DELAY="300" + + +## Type: integer +## Default: 4 +## Config: rrdcached +## ServiceRestart: rrdcached +# +# Number of threads used for writing RRD files. +# +RRDCACHED_WRITE_THREADS="4" + +## Type: string +## Default: "/var/rrdtool/rrdcached" +## Config: rrdcached +## ServiceRestart: rrdcached +# +# Change into a specific directory at startup. +# If not given the default, "/tmp", will be used. +# +RRDCACHED_CHROOT_DIR="/tmp" + +## Type: string +## Default: "" +## Config: rrdcached +## ServiceRestart: rrdcached +# +# Other options - see man 1 rrdcached +# +RRDCACHED_OPTIONS="" From c2cf875cf9d5c47f2c351f5ead8641004d882eaa55b7bd913bdf46d9c8dab155 Mon Sep 17 00:00:00 2001 From: Denisart Benjamin Date: Thu, 3 Oct 2013 14:55:51 +0000 Subject: [PATCH 2/2] Accepting request 202049 from home:posophe:branches:devel:languages:python Remove sysvinit support OBS-URL: https://build.opensuse.org/request/show/202049 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/rrdtool?expand=0&rev=44 --- rrdcached.init | 133 ------------------------------- rrdtool.changes | 7 ++ rrdtool.spec | 207 ++++++++++++++++++++---------------------------- 3 files changed, 91 insertions(+), 256 deletions(-) delete mode 100644 rrdcached.init diff --git a/rrdcached.init b/rrdcached.init deleted file mode 100644 index ac86114..0000000 --- a/rrdcached.init +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/sh -# -# /etc/init.d/rrdcached -# and its symbolic link -# /(usr/)sbin/rcrrdcached -# -### BEGIN INIT INFO -# Provides: rrdcached -# Required-Start: $local_fs $syslog $remote_fs -# Should-Start: $time -# Required-Stop: $local_fs $syslog $remote_fs -# Should-Stop: $null -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Start and stop rrdtool caching daemon -# Description: rrdcached is a caching daemon to aggregate -# updates to rrd files -### END INIT INFO - -RRDCACHED_BIN='/usr/bin/rrdcached' -test -x $RRDCACHED_BIN || { echo "$RRDCACHED_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -# Check for existence of needed config file and read it -RRDCACHED_CONFIG='/etc/sysconfig/rrdcached' -test -r $RRDCACHED_CONFIG || { echo "$RRDCACHED_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - -RRDCACHED_PID='/var/lib/rrdtool/rrdcached/rrdcached.pid' - -# Read config -. $RRDCACHED_CONFIG - -# Source LSB init functions -. /etc/rc.status - -# Reset status of this service -rc_reset - -function check_and_create_dir(){ - local DIR=$1 - test -d "$DIR" || mkdir -p "$DIR" -} - -case "$1" in - start) - echo -n "Starting rrdcached " - check_and_create_dir "$(dirname $RRDCACHED_PID)" - chown $RRDCACHED_USER:$RRDCACHED_GROUP "$(dirname $RRDCACHED_PID)" - case "$RRDCACHED_ADDRESS" in - ^unix:) - SOCKETDIR=$(dirname ${RRDCACHED_ADDRESS/unix:/}) - check_and_create_dir "$SOCKETDIR" - chgrp $RRDCACHED_GROUP "$SOCKETDIR" - ;; - esac - case "$RRDCACHED_CHROOT_DIR" in - /tmp) - echo "Warning: starting with chroot dir $RRDCACHED_CHROOT_DIR" >&2 - ;; - *) - check_and_create_dir "$RRDCACHED_CHROOT_DIR" - chown $RRDCACHED_USER:$RRDCACHED_GROUP "$RRDCACHED_CHROOT_DIR" - ;; - esac - /sbin/startproc -u $RRDCACHED_USER $RRDCACHED_BIN \ - -s $RRDCACHED_GROUP \ - -b "$RRDCACHED_CHROOT_DIR" \ - -p "$RRDCACHED_PID" \ - -l $RRDCACHED_ADDRESS \ - -m $RRDCACHED_SOCKET_MASK \ - -w $RRDCACHED_DISKWRITE \ - -z $RRDCACHED_DELAY \ - -t $RRDCACHED_WRITE_THREADS \ - $RRDCACHED_OPTIONS - # workaround for wrong socket ownership and permission after stArt - case "$RRDCACHED_ADDRESS" in - ^unix:) - SOCKET=${RRDCACHED_ADDRESS/unix:/} - chown $RRDCACHED_USER:$RRDCACHED_GROUP "$SOCKET" - chmod $RRDCACHED_SOCKET_MASK "$SOCKET" - ;; - esac - rc_status -v - ;; - stop) - echo -n "Shutting down rrdcached " - /sbin/killproc -p $RRDCACHED_PID -t 10 $RRDCACHED_BIN - rc_status -v - ;; - try-restart|condrestart) - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - rc_status - ;; - restart) - $0 stop - $0 start - rc_status - ;; - force-reload) - echo -n "Reload service rrdcached " - /sbin/killproc -p $RRDCACHED_PID -HUP $RRDCACHED_BIN - rc_status -v - ;; - reload) - echo -n "Reload service rrdcached " - /sbin/killproc -p $RRDCACHED_PID -HUP $RRDCACHED_BIN - rc_status -v - ;; - status) - echo -n "Checking for service rrdcached " - /sbin/checkproc $RRDCACHED_BIN - rc_status -v - ;; - probe) - test $RRDCACHED_CONFIG -nt $RRDCACHED_PID && echo reload - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" - exit 1 - ;; -esac -rc_exit diff --git a/rrdtool.changes b/rrdtool.changes index bf0a708..ebfebe3 100644 --- a/rrdtool.changes +++ b/rrdtool.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Oct 3 14:41:37 UTC 2013 - p.drouand@gmail.com + +- Build is disable for SLE; remove sysvinit support +- CLean obsolete conditionnal macros +- Fix devel package Group; it have to be Development/Libraries + ------------------------------------------------------------------- Wed Oct 2 13:40:14 UTC 2013 - obs@botter.cc diff --git a/rrdtool.spec b/rrdtool.spec index 0f56210..8e9062c 100644 --- a/rrdtool.spec +++ b/rrdtool.spec @@ -28,24 +28,14 @@ BuildRequires: libxml2-devel BuildRequires: pango-devel BuildRequires: python-devel BuildRequires: tcl-devel -%if 0%{?suse_version} >= 1100 BuildRequires: gettext-tools -%else -BuildRequires: gettext -%endif BuildRequires: ruby-devel -%if 0%{?suse_version} > 1210 BuildRequires: lua51-devel -%else -BuildRequires: lua-devel -%endif BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool BuildRequires: tcpd-devel -%if 0%{?suse_version} >= 1210 BuildRequires: systemd -%endif Requires: perl = %{perl_version} Version: 1.4.7 Release: 0 @@ -57,11 +47,9 @@ Patch3: rrdtool-tclsegfault.patch Source1: http://www.infodrom.org/projects/cgilib/download/cgilib-%{cgilib_version}.tar.gz Patch11: cgilib-fix_automake.patch Source2: sysconfig.rrdcached -Source3: rrdcached.init Source4: rrdcached-systemd-pre Source5: rrdcached.service Url: http://oss.oetiker.ch/rrdtool/ -BuildRoot: %{_tmppath}/%{name}-%{version}-build Summary: A tool for data logging and analysis License: GPL-2.0+ Group: Productivity/Scientific/Math @@ -74,6 +62,87 @@ The data analysis part of RRDtool is based on the ability to quickly generate graphical representations of the data values collected over a definable time period. +%package devel +Summary: A tool for data logging and analysis - Development files +Group: Development/Libraries/Other +Requires: %name = %version + +%description devel +A tool to log and analyze data gathered from all kinds of data sources. +The data analysis part of RRDtool is based on the ability to quickly +generate graphical representations of the data values collected over a +definable time period. + +%package -n python-rrdtool +Summary: Python bindings for rrdtool +Group: Productivity/Scientific/Math +Requires: %name = %version +%py_requires + +%description -n python-rrdtool +A tool to log and analyze data gathered from all kinds of data sources. +The data analysis part of RRDtool is based on the ability to quickly +generate graphical representations of the data values collected over a +definable time period. + +This package contains the Python bindings + + +%package -n lua-rrdtool +Summary: Lua bindings for rrdtool +Group: Productivity/Scientific/Math +Requires: %name = %version + +%description -n lua-rrdtool +A tool to log and analyze data gathered from all kinds of data sources. +The data analysis part of RRDtool is based on the ability to quickly +generate graphical representations of the data values collected over a +definable time period. + +This package contains the Lua bindings + +%package -n ruby-rrdtool +Summary: Ruby bindings for rrdtool +Group: Productivity/Scientific/Math +Requires: ruby + +%description -n ruby-rrdtool +A tool to log and analyze data gathered from all kinds of data sources. +The data analysis part of RRDtool is based on the ability to quickly +generate graphical representations of the data values collected over a +definable time period. + +This package contains the Ruby bindings + +%package -n tcl-rrdtool +Summary: Tcl bindings for rrdtool +Group: Productivity/Scientific/Math +Requires: tcl + +%description -n tcl-rrdtool +A tool to log and analyze data gathered from all kinds of data sources. +The data analysis part of RRDtool is based on the ability to quickly +generate graphical representations of the data values collected over a +definable time period. + +This package contains the Tcl bindings + +%package cached +Summary: Data caching daemon for RRDtool +Group: Productivity/Scientific/Math +Requires: %{name} = %{version} +Requires(pre): %fillup_prereq +%{?systemd_requires} +%define rrdcached_user rrdcached +%define rrdcached_group rrdcached + +%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 -a1 %if %{_lib}==lib64 @@ -92,9 +161,7 @@ echo -n > NEWS aclocal --force autoreconf -fiv CGILIB_CFLAGS="%{optflags} -fPIC -I." -%if 0%{?suse_version} >= 1130 CGILIB_CFLAGS="$CGILIB_CFLAGS -fexcess-precision=fast" -%endif CFLAGS="$CGILIB_CFLAGS" \ %configure make %{?jobs:-j %jobs} @@ -169,18 +236,11 @@ chmod -x examples/* chmod +x examples/rrdcached # install rrdcached specials install -Dm644 %{SOURCE2} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.rrdcached -install -Dm755 %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/rrdcached -%if 0%{?suse_version} >= 1210 # install systemd specific files install -Dm755 %{SOURCE4} %{buildroot}%{_datadir}/rrdcached/rrdcached-systemd-pre install -Dm644 %{SOURCE5} %{buildroot}%{_unitdir}/rrdcached.service -%endif -mkdir -p %{buildroot}%{_sbindir} -ln -s %{_sysconfdir}/init.d/rrdcached %{buildroot}%{_sbindir}/rcrrdcached mkdir -p %{buildroot}%{_localstatedir}/lib/rrdtool/rrdcached -%clean -rm -rf $RPM_BUILD_ROOT %post -p /sbin/ldconfig @@ -190,7 +250,7 @@ rm -rf $RPM_BUILD_ROOT %defattr(-, root, root) %doc %{_docdir}/rrdtool %doc %{_mandir}/*/* -/usr/bin/* +%{_bindir}/* %exclude %{_bindir}/rrdcached %{_libdir}/librrd.so.* %{_libdir}/librrd_th.so.* @@ -198,61 +258,19 @@ rm -rf $RPM_BUILD_ROOT %{perl_vendorarch}/RRDs.pm #%{perl_vendorarch}/ntmake.pl %{perl_vendorarch}/auto/* -%if %suse_version < 1140 -/var/adm/perl-modules/rrdtool -%endif #%{_datadir}/%{name} -%package devel -Summary: A tool for data logging and analysis - Development files -Group: Productivity/Scientific/Math -Requires: %name = %version - -%description devel -A tool to log and analyze data gathered from all kinds of data sources. -The data analysis part of RRDtool is based on the ability to quickly -generate graphical representations of the data values collected over a -definable time period. - - %files devel %defattr(-, root, root) -/usr/include/* +%{_includedir}/* %{_libdir}/librrd_th.so %{_libdir}/librrd.so %{_libdir}/pkgconfig/librrd.pc -%package -n python-rrdtool -Summary: Python bindings for rrdtool -Group: Productivity/Scientific/Math -Requires: %name = %version -%py_requires - -%description -n python-rrdtool -A tool to log and analyze data gathered from all kinds of data sources. -The data analysis part of RRDtool is based on the ability to quickly -generate graphical representations of the data values collected over a -definable time period. - -This package contains the Python bindings - %files -n python-rrdtool %defattr(-, root, root) %{py_sitedir}/* -%package -n lua-rrdtool -Summary: Lua bindings for rrdtool -Group: Productivity/Scientific/Math -Requires: %name = %version - -%description -n lua-rrdtool -A tool to log and analyze data gathered from all kinds of data sources. -The data analysis part of RRDtool is based on the ability to quickly -generate graphical representations of the data values collected over a -definable time period. - -This package contains the Lua bindings - %files -n lua-rrdtool %defattr(-, root, root) %dir %{_libdir}/lua @@ -260,97 +278,40 @@ This package contains the Lua bindings %{_libdir}/lua/*/rrd.so %{_libdir}/lua/*/rrd.so.* -%package -n tcl-rrdtool -Summary: Tcl bindings for rrdtool -Group: Productivity/Scientific/Math -Requires: tcl - -%description -n tcl-rrdtool -A tool to log and analyze data gathered from all kinds of data sources. -The data analysis part of RRDtool is based on the ability to quickly -generate graphical representations of the data values collected over a -definable time period. - -This package contains the Tcl bindings - %files -n tcl-rrdtool %defattr(-, root, root) %{tcl_archdir}/* %{_libdir}/tclrrd*.so #%{!?rb_sitearchdir: %define rb_sitearchdir %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitearchdir"]')} -%package -n ruby-rrdtool -Summary: Ruby bindings for rrdtool -Group: Productivity/Scientific/Math -Requires: ruby - -%description -n ruby-rrdtool -A tool to log and analyze data gathered from all kinds of data sources. -The data analysis part of RRDtool is based on the ability to quickly -generate graphical representations of the data values collected over a -definable time period. - -This package contains the Ruby bindings %files -n ruby-rrdtool %defattr(-, root, root) %{rb_sitearchdir}/RRD.so -%package cached -Summary: Data caching daemon for RRDtool -Group: Productivity/Scientific/Math -Requires: %{name} = %{version} -Requires(pre): %insserv_prereq -Requires(pre): %fillup_prereq -%define rrdcached_user rrdcached -%define rrdcached_group rrdcached - -%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. - %files cached %defattr(-, root, root) %{_bindir}/rrdcached -%{_sysconfdir}/init.d/rrdcached -%{_sbindir}/rcrrdcached %{_localstatedir}/adm/fillup-templates/sysconfig.rrdcached %dir %{_localstatedir}/lib/rrdtool %attr(-,%rrdcached_user,%rrdcached_group) %dir %{_localstatedir}/lib/rrdtool/rrdcached -%if 0%{?suse_version} >= 1210 %{_datadir}/rrdcached %{_datadir}/rrdcached/rrdcached-systemd-pre %{_unitdir}/rrdcached.service -%endif %pre cached getent group %rrdcached_group >/dev/null || groupadd %rrdcached_group getent passwd %rrdcached_user >/dev/null || useradd -s /sbin/nologin -g %rrdcached_group -c %rrdcached_user -d %{_localstatedir}/lib %rrdcached_user -%if 0%{?suse_version} >= 1210 %service_add_pre rrdcached.service -%endif %post cached -%fillup_and_insserv rrdcached -%restart_on_update rrdcached -%if 0%{?suse_version} >= 1210 %service_add_post rrdcached.service -%endif +%fillup_only rrdcached %preun cached -%stop_on_removal rrdcached -%if 0%{?suse_version} >= 1210 %service_del_preun rrdcached.service -%endif %postun cached -%restart_on_update -%insserv_cleanup -%if 0%{?suse_version} >= 1210 %service_del_postun rrdcached.service -%endif %changelog