9c01893
# Needed for el5
9c01893
%{!?_initddir: %global _initddir %{_sysconfdir}/rc.d/init.d}
9c01893
91fb2de
%global _hardened_build 1
1a24fdd
6c5f868
%ifarch %{nodejs_arches}
6c5f868
%global build_manpage 1
6c5f868
%endif
6c5f868
25557cc
%global commit0 b785959ecd5c16289856f9a598876a2f41218c82
1a24fdd
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
91fb2de
91fb2de
Name:               carbon-c-relay
25557cc
Version:            3.2
fe2a128
Release:            3%{?dist}
91fb2de
Summary:            Enhanced C implementation of Carbon relay, aggregator and rewriter
91fb2de
License:            ASL 2.0
9c01893
Group:              System Environment/Daemons
91fb2de
URL:                https://github.com/grobian/carbon-c-relay
1a24fdd
Source0:            https://github.com/grobian/%{name}/archive/%{commit0}.tar.gz#/%{name}-%{shortcommit0}.tar.gz
91fb2de
Source1:            carbon-c-relay.service
91fb2de
Source2:            carbon-c-relay.init
91fb2de
Source3:            carbon-c-relay.logrotate
9bc62c7
Source4:            carbon-c-relay.sysconfig.sysv
91313cb
Source5:            carbon-c-relay.conf
9bc62c7
Source6:            carbon-c-relay.sysconfig.systemd
05d9c79
Source7:            carbon-c-relay.limits.systemd
91fb2de
6d30524
Patch0:             Makefile.am.patch
af35d0d
Patch1:             Makefile.in.patch
6d30524
403bdad
BuildRequires:      gcc
403bdad
BuildRequires:      make
626f135
BuildRequires:      bison
626f135
BuildRequires:      flex
6c5f868
6c5f868
# use nodejs-ronn instead of ruby ronn because of availability on epel 6 & 7
6c5f868
%if 0%{?build_manpage}
b11dfd4
BuildRequires:      nodejs-ronn
6c5f868
%endif
403bdad
91fb2de
Requires(pre):      shadow-utils
91fb2de
9c01893
%if 0%{?rhel} && 0%{?rhel} <= 6
91fb2de
Requires(post):     chkconfig
91fb2de
Requires(preun):    chkconfig
91fb2de
Requires(postun):   initscripts
91fb2de
%else
91fb2de
BuildRequires:      systemd
91fb2de
Requires(post):     systemd
91fb2de
Requires(preun):    systemd
91fb2de
Requires(postun):   systemd
91fb2de
%endif
91fb2de
5374787
# carbon-c-relay ships a bundled md5 library for which an exception exists
5374787
# see: https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries
5374787
Provides:           bundled(md5-peslyak)
5374787
fce1037
# Needed for el5
fce1037
%{?el5:BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)}
91fb2de
64a9515
# Does not build on old 32bit architectures (el5)
64a9515
# https://github.com/grobian/carbon-c-relay/issues/100
64a9515
ExcludeArch:        i386 ppc
64a9515
64a9515
91fb2de
%description
91fb2de
Carbon-like Graphite line mode relay. This project aims to be a replacement of 
91fb2de
the original Carbon relay. The main reason to build a replacement is 
91fb2de
performance and configurability. Carbon is single threaded, and sending 
91fb2de
metrics to multiple consistent-hash clusters requires chaining of relays. This 
91fb2de
project provides a multithreaded relay which can address multiple targets and 
91fb2de
clusters for each and every metric based on pattern matches.
91fb2de
91fb2de
91fb2de
%prep
6d30524
%autosetup -n %{name}-%{commit0}
91fb2de
626f135
# remove pregenerated bison and flex files
626f135
rm conffile.tab.c conffile.tab.h conffile.yy.c
626f135
91fb2de
91fb2de
%build
7d48987
%configure
7d48987
%make_build LDFLAGS="%{?__global_ldflags}" CFLAGS="%{optflags}"
7d48987
6c5f868
%if 0%{?build_manpage}
6c5f868
ronn-nodejs --roff carbon-c-relay.md > carbon-c-relay.1
6c5f868
%endif
91fb2de
91fb2de
91fb2de
%install
fce1037
%if 0%{?el5}
91fb2de
rm -rf %{buildroot}
fce1037
%endif
fce1037
05d9c79
install -Dp -m0755 relay %{buildroot}%{_bindir}/%{name}
05d9c79
install -Dp -m0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/%{name}.conf
91fb2de
1888645
%if 0%{?build_manpage}
1888645
install -Dp -m0644 carbon-c-relay.1 %{buildroot}%{_mandir}/man1/carbon-c-relay.1
1888645
%endif
1888645
9c01893
%if 0%{?rhel} && 0%{?rhel} <= 6
05d9c79
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
05d9c79
mkdir -p %{buildroot}%{_localstatedir}/run/%{name}
91fb2de
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
91fb2de
install -Dp -m0755 %{SOURCE2} %{buildroot}%{_initddir}/%{name}
91fb2de
install -Dp -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
05d9c79
install -Dp -m0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
91fb2de
%else
91fb2de
install -Dp -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
05d9c79
install -Dp -m0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
05d9c79
install -Dp -m0644 %{SOURCE7} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/limits.conf
91fb2de
%endif
91fb2de
fe5d9cc
%check
fe5d9cc
make test
91fb2de
fce1037
%if 0%{?el5}
fce1037
%clean
fce1037
rm -rf %{buildroot}
fce1037
%endif
fce1037
fce1037
91fb2de
%pre
91fb2de
getent group carbon-c-relay >/dev/null || groupadd -r carbon-c-relay
91fb2de
getent passwd carbon-c-relay >/dev/null || \
91fb2de
    useradd -r -g carbon-c-relay -d / -s /sbin/nologin \
4bee5b8
    -c "Carbon C Relay Daemon" carbon-c-relay
91fb2de
exit 0
91fb2de
91fb2de
91fb2de
%post
9c01893
%if 0%{?rhel} && 0%{?rhel} <= 6
91fb2de
/sbin/chkconfig --add %{name}
91fb2de
%else
91fb2de
%systemd_post %{name}.service
91fb2de
%endif
91fb2de
91fb2de
91fb2de
%preun
9c01893
%if 0%{?rhel} && 0%{?rhel} <= 6
91fb2de
if [ $1 -eq 0 ] ; then
91fb2de
    /sbin/service %{name} stop >/dev/null 2>&1
91fb2de
    /sbin/chkconfig --del %{name}
91fb2de
fi
91fb2de
%else
91fb2de
%systemd_preun %{name}.service
91fb2de
%endif
91fb2de
91fb2de
91fb2de
%postun
9c01893
%if 0%{?rhel} && 0%{?rhel} <= 6
91fb2de
if [ "$1" -ge "1" ] ; then
91fb2de
    /sbin/service %{name} condrestart >/dev/null 2>&1 || :
91fb2de
fi
91fb2de
%else
91fb2de
%systemd_postun_with_restart %{name}.service
91fb2de
%endif
91fb2de
91fb2de
91fb2de
%files
91fb2de
%{!?_licensedir:%global license %%doc}
91fb2de
%license LICENSE.md
6c5f868
%doc carbon-c-relay.md ChangeLog.md
6c5f868
6c5f868
%if 0%{?build_manpage}
a91de0c
%{_mandir}/man1/carbon-c-relay.1*
6c5f868
%endif
6c5f868
6c5f868
%{_bindir}/carbon-c-relay
91fb2de
%config(noreplace) %{_sysconfdir}/carbon-c-relay.conf
91fb2de
%config(noreplace) %{_sysconfdir}/sysconfig/carbon-c-relay
91fb2de
6c5f868
9c01893
%if 0%{?rhel} && 0%{?rhel} <= 6
91fb2de
%{_initddir}/%{name}
91fb2de
%attr(0755,carbon-c-relay,carbon-c-relay) %dir %{_localstatedir}/log/%{name}
91fb2de
%attr(0755,carbon-c-relay,carbon-c-relay) %dir %{_localstatedir}/run/%{name}
91fb2de
%{_sysconfdir}/logrotate.d/%{name}
91fb2de
%else
91fb2de
%{_unitdir}/%{name}.service
05d9c79
%dir %{_sysconfdir}/systemd/system/%{name}.service.d
05d9c79
%config(noreplace) %{_sysconfdir}/systemd/system/%{name}.service.d/limits.conf
91fb2de
%endif
91fb2de
91fb2de
91fb2de
%changelog
fe2a128
* Fri Oct 27 2017 Piotr Popieluch <piotr1212@gmail.com> - 3.2-3
fe2a128
- Ship pregenerated Makefile.in (automake fails on epel7)
fe2a128
6d30524
* Fri Oct 27 2017 Piotr Popieluch <piotr1212@gmail.com> - 3.2-2
6d30524
- Update dependencies in Makefile.am to fix parallell builds
6d30524
25557cc
* Mon Oct 23 2017 Piotr Popieluch <piotr1212@gmail.com> - 3.2-1
25557cc
- Update to 3.2
25557cc
7e3cd03
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-4
7e3cd03
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
7e3cd03
3d81c13
* Sun Jul 30 2017 Florian Weimer <fweimer@redhat.com> - 3.1-3
3d81c13
- Rebuild with binutils fix for ppc64le (#1475636)
3d81c13
a241ec2
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-2
a241ec2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
a241ec2
7d48987
* Tue May 02 2017 Piotr Popieluch <piotr1212@gmail.com> - 3.1-1
7d48987
- Update to 3.1
7d48987
- run ./configure in %%build
7d48987
ecd0d74
* Thu Apr 13 2017 Piotr Popieluch <piotr1212@gmail.com> - 3.0-1
ecd0d74
- Update to 3.0
ecd0d74
05d9c79
* Tue Feb 07 2017 <piotrp@fedoraproject.org> - 2.6-2
05d9c79
- Add example systemd limits configuration
05d9c79
858064e
* Thu Jan 26 2017 piotr1212@gmail.com - 2.6-1
858064e
- Update to 2.6
858064e
b769968
* Wed Jan 11 2017 piotr1212@gmail.com - 2.5-1
b769968
- Update to 2.5
b769968
3998bd6
* Tue Nov 08 2016 Piotr Popieluch <piotr1212@gmail.com> - - 2.3-1
3998bd6
- Update to 2.3
3998bd6
8eb08c2
* Fri Sep 16 2016 Piotr Popieluch <piotr1212@gmail.com> - - 2.2-2
8eb08c2
- Remove braces from systemd service file to correctly interpret arguments
8eb08c2
8741a67
* Sun Sep 11 2016 Piotr Popieluch <piotr1212@gmail.com> - - 2.2-1
8741a67
- Update to 2.2
8741a67
4bee5b8
* Thu Jul 07 2016 Piotr Popieluch <piotr1212@gmail.com> - - 2.1-2
4bee5b8
- Add ExecReload SIGHUP to systemd unit
4bee5b8
e02465c
* Mon Jun 20 2016 Piotr Popieluch <piotr1212@gmail.com> - - 2.1-1
e02465c
- Update to 2.1
e02465c
6c5f868
* Wed Jun 15 2016 Piotr Popieluch <piotr1212@gmail.com> - - 2.0-2
6c5f868
- Disable manpage creation for systems which don't have nodejs
b11dfd4
6c5f868
* Mon Jun 06 2016 Piotr Popieluch <piotr1212@gmail.com> - - 2.0-1
a91de0c
- Update to upstream 2.0
a91de0c
- Generate man file
a91de0c
9bc62c7
* Fri Apr 22 2016 Piotr Popieluch <piotr1212@gmail.com> - 1.11-2
9bc62c7
- Set correct user in systemd unit file
9bc62c7
- Remove logfile in sysconfig on systemd releases
9bc62c7
a2e59ed
* Wed Mar 23 2016 Piotr Popieluch <piotr1212@gmail.com> - 1.11-1
a2e59ed
- Update to upstream 1.11
a2e59ed
9e1047c
* Thu Mar 10 2016 Piotr Popieluch <piotr1212@gmail.com> - 1.10-1
9e1047c
- Update to upstream 1.10
9e1047c
- el5/el6: Use new daemon mode in non systemd systems
9e1047c
fce1037
* Tue Feb 23 2016 Piotr Popieluch <piotr1212@gmail.com> - 1.8-1
fce1037
- Update to upstream 1.8
fce1037
- el5: add clean section and conditionalize all el5 specifics
fce1037
f41d0fb
* Fri Feb 19 2016 Piotr Popieluch <piotr1212@gmail.com> - 1.7-3
403bdad
- Add BR gcc and make https://fedorahosted.org/fpc/ticket/540
403bdad
c3c129b
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.7-2
c3c129b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
c3c129b
60eebc1
* Sun Jan 31 2016 Piotr Popieluch <piotr1212@gmail.com> - 1.7-1
60eebc1
- Update to upstream 1.7
60eebc1
fd22462
* Thu Jan 14 2016 Piotr Popieluch <piotr1212@gmail.com> - 1.5-1
fd22462
- Update to upstream 1.5
fd22462
8fa4353
* Mon Jan 04 2016 Piotr Popieluch <piotr1212@gmail.com> - 1.4-1
8fa4353
- Update to upstream 1.4
8fa4353
af08ea8
* Wed Dec 16 2015 Piotr Popieluch <piotr1212@gmail.com> - 1.3-1
af08ea8
- Update to upstream 1.3
af08ea8
8c00221
* Fri Dec 11 2015 Piotr Popieluch <piotr1212@gmail.com> - 1.2-1
8c00221
- Update to upstream 1.2
8c00221
cf769e8
* Wed Nov 25 2015 Piotr Popieluch <piotr1212@gmail.com> - 1.1-1
cf769e8
- Update to upstream 1.1
cf769e8
1a24fdd
* Sat Nov 07 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.45-1
1a24fdd
- Update to new version
1a24fdd
- Set LDFLAGS to build with PIE
1a24fdd
- Update Source to follow github source guidelines
1a24fdd
64a9515
* Mon Aug 31 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.44-3
64a9515
- Exclude 32 bit arches
64a9515
9c01893
* Sun Aug 30 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.44-2
9c01893
- Add el5 support
9c01893
91313cb
* Fri Aug 14 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.44-1
91313cb
- Update to upstream 0.44
91313cb
- Use own relay.conf
91313cb
5374787
* Mon Jul 27 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.43-2
5374787
- specify copylib 'Provides: bundled(md5-peslyak)'
5374787
76e5461
* Mon Jul 27 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.43-1
76e5461
- Update to upstream 0.43
76e5461
6aa9a74
* Mon Jul 27 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.42-2
6aa9a74
- Removed obsoleted BR: openssl-devel
6aa9a74
da5c85b
* Fri Jul 24 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.42-1
da5c85b
- Update to upstream 0.42
da5c85b
- Remove allow-percent patch, characters are now configurable
da5c85b
- Make characters to allow configurable in sysconfig
da5c85b
d40a574
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.40-2
d40a574
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
d40a574
5115b13
* Tue May 12 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.40-1
5115b13
- update to upstream 0.40
5115b13
- add logfile to sysconfig
5115b13
f6f501a
* Fri May 01 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.39-3
f6f501a
- update to later commit to fix closed udp sockets
f6f501a
- logrotate sighup instead of restart
f6f501a
- allow percent characters in metric names
f6f501a
ccf6200
* Thu Apr 02 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.39-2
ccf6200
- fix filepath in logrotate
ccf6200
91fb2de
* Sat Mar 28 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.39-1
91fb2de
- update to latest upsream 0.39
91fb2de
91fb2de
* Wed Feb  4 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.37-1
91fb2de
- update to upstream 0.37
91fb2de
- rewritten for Fedora and comply with Fedora package guidelines
91fb2de
91fb2de
* Mon Sep 8 2014 Matthew Hollick <matthew@mayan-it.co.uk>
91fb2de
- tidy up for github
91fb2de
- reverted site specific changes
91fb2de
91fb2de
* Fri Aug 8 2014 Matthew Hollick <matthew@mayan-it.co.uk>
91fb2de
- packaged as part of twiki
91fb2de
91fb2de
* Tue Jul 1 2014 Matthew Hollick <matthew@mayan-it.co.uk>
91fb2de
- packaged as part of mdr
91fb2de
- binary renamed from 'relay' to 'cc_relay'
91fb2de
- pagage renamed to reflect function rather than component
91fb2de
- user / group named by function
91fb2de
91fb2de
* Tue May 6 2014 Matthew Hollick <matthew@mayan-it.co.uk>
91fb2de
- Initial package for the BBC