SHA256
1
0
forked from pool/rrdtool

Accepting request 202050 from devel:languages:python

Remove sysvinit support (forwarded request 202049 from posophe)

OBS-URL: https://build.opensuse.org/request/show/202050
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rrdtool?expand=0&rev=50
This commit is contained in:
Tomáš Chvátal 2013-10-04 08:28:11 +00:00 committed by Git OBS Bridge
commit eb84139fe7
5 changed files with 325 additions and 85 deletions

45
rrdcached-systemd-pre Normal file
View File

@ -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

25
rrdcached.service Normal file
View File

@ -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

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
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
- add systemd service for rrdcached
-------------------------------------------------------------------
Wed Jul 10 15:02:53 UTC 2013 - dvaleev@suse.com

View File

@ -28,21 +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
BuildRequires: systemd
Requires: perl = %{perl_version}
Version: 1.4.7
Release: 0
@ -53,12 +46,15 @@ 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
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.
@ -66,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
@ -84,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}
@ -102,8 +177,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 +198,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,11 +219,28 @@ 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 systemd specific files
install -Dm755 %{SOURCE4} %{buildroot}%{_datadir}/rrdcached/rrdcached-systemd-pre
install -Dm644 %{SOURCE5} %{buildroot}%{_unitdir}/rrdcached.service
mkdir -p %{buildroot}%{_localstatedir}/lib/rrdtool/rrdcached
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
@ -156,68 +250,27 @@ 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.*
%{perl_vendorlib}/RRDp.pm
%{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
@ -225,39 +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
%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
#%{!?rb_sitearchdir: %define rb_sitearchdir %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitearchdir"]')}
%files -n ruby-rrdtool
%defattr(-, root, root)
%{rb_archdir}/RRD.so
%{rb_sitearchdir}/RRD.so
%files cached
%defattr(-, root, root)
%{_bindir}/rrdcached
%{_localstatedir}/adm/fillup-templates/sysconfig.rrdcached
%dir %{_localstatedir}/lib/rrdtool
%attr(-,%rrdcached_user,%rrdcached_group) %dir %{_localstatedir}/lib/rrdtool/rrdcached
%{_datadir}/rrdcached
%{_datadir}/rrdcached/rrdcached-systemd-pre
%{_unitdir}/rrdcached.service
%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
%service_add_pre rrdcached.service
%post cached
%service_add_post rrdcached.service
%fillup_only rrdcached
%preun cached
%service_del_preun rrdcached.service
%postun cached
%service_del_postun rrdcached.service
%changelog

104
sysconfig.rrdcached Normal file
View File

@ -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=""