%define username statsdpl %define groupname statsdpl %define daemon statsd-perl Name: perl-Net-Statsd-Server Version: 0.17 Release: 1%{?dist} Summary: Library for the Perl port of Flickr/Etsy's statsd metrics daemon License: GPL+ or Artistic Group: Development/Libraries URL: http://search.cpan.org/dist/Net-Statsd-Server/ Source0: http://www.cpan.org/modules/by-module/Net/Net-Statsd-Server-%{version}.tar.gz Source1: %{daemon}.service Source2: %{daemon}.js Source3: %{daemon}.logrotate Patch1: net_statsd_server_makefile.patch BuildArch: noarch BuildRequires: perl BuildRequires: perl(AnyEvent) BuildRequires: perl(AnyEvent::Handle) BuildRequires: perl(AnyEvent::Handle::UDP) BuildRequires: perl(AnyEvent::Log) BuildRequires: perl(AnyEvent::Socket) BuildRequires: perl(AnyEvent::Strict) BuildRequires: perl(base) BuildRequires: perl(Carp) BuildRequires: perl(constant) BuildRequires: perl(Data::Dumper) BuildRequires: perl(ExtUtils::MakeMaker) >= 6.30 BuildRequires: perl(FindBin) BuildRequires: perl(IO::Socket::INET) BuildRequires: perl(JSON::XS) BuildRequires: perl(lib) BuildRequires: perl(Socket) BuildRequires: perl(strict) BuildRequires: perl(Test::More) BuildRequires: perl(Time::HiRes) BuildRequires: perl(warnings) Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) %description Net::Statsd::Server is the server component of statsd. It implements a daemon that listens on a given host/port for incoming UDP packets and dispatches them to whatever you want, including Graphite or your console. Look into the Net::Statsd::Server::Backend::* namespace to know all the possibilities, or write a backend yourself. %prep %setup -q -n Net-Statsd-Server-%{version} %patch1 -p1 mv bin/statsd bin/%{daemon} mv bin/localConfig.js localConfig.js mv bin/exampleConfig.js exampleConfig.js %build %{__perl} Makefile.PL INSTALLDIRS=vendor make %{?_smp_mflags} %install make pure_install DESTDIR=$RPM_BUILD_ROOT install -Dp -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{daemon}.service install -Dp -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{daemon}.js install -Dp -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{daemon} mkdir -p -m 750 $RPM_BUILD_ROOT%{_localstatedir}/log/%{daemon} find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \; %{_fixperms} $RPM_BUILD_ROOT/* %check STATSD_BINARY=$RPM_BUILD_ROOT/usr/bin/%{daemon} make test %files %doc Changes LICENSE README TODO %{perl_vendorlib}/* %{_mandir}/man3/* %package -n statsd-perl Summary: A Perl port of Flickr/Etsy's statsd metrics daemon BuildRequires: systemd-units Requires(post): systemd Requires(preun): systemd Requires(postun): systemd Requires(pre): shadow-utils Provides: statsd %description -n statsd-perl Implements a daemon that listens on a given host/port for incoming UDP packets and dispatches them to whatever you want, including Graphite or your console. Look into the Net::Statsd::Server::Backend::* namespace to know all the possibilities, or write a backend yourself. %pre -n statsd-perl getent group %{groupname} >/dev/null || groupadd -r %{groupname} getent passwd %{username} >/dev/null || \ useradd -r -g %{groupname} -d /run/%{daemon} \ -s /sbin/nologin -c "Perl Statsd" %{username} exit 0 %post -n statsd-perl %systemd_post %{daemon}.service %preun -n statsd-perl %systemd_preun %{daemon}.service %postun -n statsd-perl %systemd_postun_with_restart %{daemon}.service %files -n statsd-perl %doc README exampleConfig.js localConfig.js %{_mandir}/man1/* %{_bindir}/* %config(noreplace) %{_sysconfdir}/%{daemon}.js %config(noreplace) %{_sysconfdir}/logrotate.d/%{daemon} %{_unitdir}/%{daemon}.service %attr(750, %{username}, %{groupname}) %{_localstatedir}/log/%{daemon} %changelog * Sat Jun 14 2014 David Dick - 0.17-1 - Initial release