3fab847
%global srcname carbon
e0a274f
%global commit0 62a17219be5b33911e683a89cde85197c02bbe6e
3fab847
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
30eb18f
%global sum Back-end data caching and persistence daemon for Graphite
f876fbb
c473bf7
30eb18f
Name:           python-%{srcname}
e0a274f
Version:        1.1.4
c583ac4
Release:        1%{?dist}.1
7df2f32
30eb18f
Summary:        %{sum}
62ab5f9
License:        ASL 2.0
200281f
URL:            https://github.com/graphite-project/carbon
7df2f32
3fab847
Source0:        https://github.com/graphite-project/%{srcname}/archive/%{commit0}.tar.gz#/%{srcname}-%{shortcommit0}.tar.gz
d45531d
Source10:       carbon-aggregator.1
d45531d
Source11:       carbon-cache.1
d45531d
Source12:       carbon-client.1
d45531d
Source13:       carbon-relay.1
d45531d
Source14:       validate-storage-schemas.1
c473bf7
Source20:       %{name}.logrotate
a22b616
7ee660c
Source30:       carbon-aggregator.service
7ee660c
Source31:       carbon-cache.service
7ee660c
Source32:       carbon-relay.service
b373a60
Source33:       carbon-aggregator@.service
b373a60
Source34:       carbon-cache@.service
b373a60
Source35:       carbon-relay@.service
a22b616
a22b616
Source43:       %{name}.sysconfig
a22b616
200281f
# Set sane default filesystem paths.
7752864
Patch1:         %{name}-0.10.0-Set-sane-defaults.patch
200281f
# Fix path to storage-schemas.conf.
b9b939a
Patch2:         %{name}-0.9.13-Fix-path-to-storage-schemas.conf.patch
62ab5f9
62ab5f9
BuildArch:      noarch
774d8f9
e0a274f
BuildRequires:  python2-cachetools
a38a83f
BuildRequires:  python2-twisted
a4ea313
BuildRequires:  python2-setuptools
30eb18f
BuildRequires:  python2-configparser
30eb18f
BuildRequires:  python2-devel
a4ea313
BuildRequires:  python2-mock
a4ea313
BuildRequires:  python2-protobuf
0fc9e0a
BuildRequires:  python2-six
a4ea313
BuildRequires:  python2-whisper
a22b616
a5d540c
BuildRequires:  python3-cachetools
a5d540c
BuildRequires:  python3-devel
a5d540c
BuildRequires:  python3-mock
a5d540c
BuildRequires:  python3-protobuf
a5d540c
BuildRequires:  python3-twisted
a5d540c
BuildRequires:  python3-whisper
a5d540c
a22b616
BuildRequires:    systemd
62ab5f9
62ab5f9
62ab5f9
%description
d5bb1fe
Carbon is one of the components of Graphite, and is responsible for
d5bb1fe
receiving metrics over the network and writing them down to disk using
d5bb1fe
a storage back-end.
62ab5f9
62ab5f9
30eb18f
%package -n python2-%{srcname}
30eb18f
Summary:        %{sum}
81e780a
Requires:       python-cachetools
a38a83f
Requires:       python2-twisted
a4ea313
Requires:       python2-configparser
a4ea313
Requires:       python2-protobuf
a4ea313
Requires:       python2-six
774d8f9
Requires:       python2-whisper >= %{version}
774d8f9
Requires(pre):  shadow-utils
30eb18f
774d8f9
%{?python_provide:%python_provide python2-%{srcname}}
30eb18f
30eb18f
%description -n python2-%{srcname}
30eb18f
Carbon is one of the components of Graphite, and is responsible for
30eb18f
receiving metrics over the network and writing them down to disk using
30eb18f
a storage back-end.
30eb18f
30eb18f
81e780a
81e780a
%package -n python3-%{srcname}
81e780a
Summary:        %{sum}
81e780a
Requires:       python3-cachetools
81e780a
Requires:       python3-twisted
81e780a
Requires:       python3-configparser
81e780a
Requires:       python3-protobuf
81e780a
Requires:       python3-six
81e780a
Requires:       python3-whisper >= %{version}
81e780a
Requires(pre):  shadow-utils
81e780a
81e780a
Requires(post):   systemd
81e780a
Requires(preun):  systemd
81e780a
Requires(postun): systemd
81e780a
81e780a
%{?python_provide:%python_provide python3-%{srcname}}
81e780a
81e780a
81e780a
%description -n python3-%{srcname}
81e780a
Carbon is one of the components of Graphite, and is responsible for
81e780a
receiving metrics over the network and writing them down to disk using
81e780a
a storage back-end.
81e780a
81e780a
81e780a
62ab5f9
%prep
200281f
%autosetup -p1 -n %{srcname}-%{commit0}
f8899e7
e0a274f
sed -i '1s|^#!/usr/bin/env python|#!/usr/bin/python|' lib/carbon/amqp_listener.py
e0a274f
sed -i '1s|^#!/usr/bin/env python|#!/usr/bin/python|' lib/carbon/amqp_publisher.py
ce81c6e
81e780a
# disable tests which use mmh3 hash
81e780a
sed -i "s|plugin == 'rules'|plugin == 'rules' or plugin.startswith('fast-')|" lib/carbon/tests/test_routers.py
81e780a
c473bf7
# Disable internal log rotation.
c473bf7
sed -i -e 's/ENABLE_LOGROTATION.*/ENABLE_LOGROTATION = False/g' \
c473bf7
    conf/carbon.conf.example
c473bf7
a4ea313
# Skip Ceres database test. Ceres is not packaged yet.
a4ea313
rm lib/carbon/tests/test_database.py
a4ea313
62ab5f9
62ab5f9
%build
200281f
%py2_build
81e780a
%py3_build
62ab5f9
62ab5f9
62ab5f9
%install
200281f
%py2_install \
bd470d8
    --install-data=%{_localstatedir}/lib/carbon \
30eb18f
    --install-lib=%{python2_sitelib} \
bd470d8
    --install-scripts=%{_bindir}
62ab5f9
81e780a
%py3_install \
81e780a
    --install-data=%{_localstatedir}/lib/carbon \
81e780a
    --install-lib=%{python3_sitelib} \
81e780a
    --install-scripts=%{_bindir}
81e780a
c6d7495
rm -rf %{buildroot}%{_localstatedir}/lib/carbon/*
c6d7495
mkdir -p %{buildroot}%{_localstatedir}/lib/carbon/lists
c6d7495
mkdir -p %{buildroot}%{_localstatedir}/lib/carbon/rrd
c6d7495
mkdir -p %{buildroot}%{_localstatedir}/lib/carbon/whisper
1a2e51f
1a2e51f
# default config
1a2e51f
mkdir -p %{buildroot}%{_sysconfdir}/carbon
1a2e51f
install -D -p -m0644 conf/carbon.conf.example \
1a2e51f
    %{buildroot}%{_sysconfdir}/carbon/carbon.conf
77bd135
install -D -p -m0644 conf/storage-aggregation.conf.example \
77bd135
    %{buildroot}%{_sysconfdir}/carbon/storage-aggregation.conf
1a2e51f
install -D -p -m0644 conf/storage-schemas.conf.example \
1a2e51f
    %{buildroot}%{_sysconfdir}/carbon/storage-schemas.conf
62ab5f9
d45531d
# man pages
d45531d
mkdir -p %{buildroot}%{_mandir}/man1
d45531d
install -D -p -m0644 %{SOURCE10} %{buildroot}%{_mandir}/man1
d45531d
install -D -p -m0644 %{SOURCE11} %{buildroot}%{_mandir}/man1
d45531d
install -D -p -m0644 %{SOURCE12} %{buildroot}%{_mandir}/man1
d45531d
install -D -p -m0644 %{SOURCE13} %{buildroot}%{_mandir}/man1
d45531d
install -D -p -m0644 %{SOURCE14} %{buildroot}%{_mandir}/man1
d45531d
c473bf7
# log files
c473bf7
mkdir -p %{buildroot}%{_localstatedir}/log/carbon
c473bf7
install -D -p -m0644 %{SOURCE20} \
8e525d1
    %{buildroot}%{_sysconfdir}/logrotate.d/python3-%{srcname}
c473bf7
a22b616
# init scripts
a22b616
install -D -p -m0644 %{SOURCE30} \
7ee660c
    %{buildroot}%{_unitdir}/carbon-aggregator.service
7ee660c
install -D -p -m0644 %{SOURCE31} \
a22b616
    %{buildroot}%{_unitdir}/carbon-cache.service
7ee660c
install -D -p -m0644 %{SOURCE32} \
7ee660c
    %{buildroot}%{_unitdir}/carbon-relay.service
b373a60
install -D -p -m0644 %{SOURCE33} \
b373a60
    %{buildroot}%{_unitdir}/carbon-aggregator@.service
b373a60
install -D -p -m0644 %{SOURCE34} \
b373a60
    %{buildroot}%{_unitdir}/carbon-cache@.service
b373a60
install -D -p -m0644 %{SOURCE35} \
b373a60
    %{buildroot}%{_unitdir}/carbon-relay@.service
a22b616
f2d0354
# remove .py suffix
f2d0354
for i in %{buildroot}%{_bindir}/*.py; do
f2d0354
    mv ${i} ${i%%.py}
f2d0354
done
f2d0354
79cbf96
# fix permissions
e0a274f
chmod 755 %{buildroot}%{python2_sitelib}/carbon/amqp_listener.py
e0a274f
chmod 755 %{buildroot}%{python2_sitelib}/carbon/amqp_publisher.py
e0a274f
chmod 755 %{buildroot}%{python3_sitelib}/carbon/amqp_listener.py
e0a274f
chmod 755 %{buildroot}%{python3_sitelib}/carbon/amqp_publisher.py
79cbf96
62ab5f9
81e780a
81e780a
%pre -n python3-%{srcname}
81e780a
getent group carbon >/dev/null || groupadd -r carbon
81e780a
getent passwd carbon >/dev/null || \
81e780a
    useradd -r -g carbon -d %{_localstatedir}/lib/carbon \
81e780a
    -s /sbin/nologin -c "Carbon cache daemon" carbon
81e780a
8e525d1
81e780a
%post -n python3-%{srcname}
81e780a
%systemd_post carbon-aggregator.service
81e780a
%systemd_post carbon-cache.service
81e780a
%systemd_post carbon-relay.service
81e780a
8e525d1
81e780a
%preun -n python3-%{srcname}
81e780a
%systemd_preun carbon-aggregator.service
81e780a
%systemd_preun carbon-cache.service
81e780a
%systemd_preun carbon-relay.service
81e780a
8e525d1
81e780a
%postun -n python3-%{srcname}
81e780a
%systemd_postun_with_restart carbon-aggregator.service
81e780a
%systemd_postun_with_restart carbon-cache.service
81e780a
%systemd_postun_with_restart carbon-relay.service
81e780a
81e780a
81e780a
a4ea313
%check
81e780a
PYTHONPATH=lib trial-3 carbon
a4ea313
a4ea313
30eb18f
%files -n python2-%{srcname}
3fab847
%license LICENSE
3fab847
%doc README.md
8e525d1
8e525d1
%{python2_sitelib}/carbon
8e525d1
%{python2_sitelib}/twisted/plugins/*
8e525d1
%{python2_sitelib}/carbon-*-py?.?.egg-info
8e525d1
8e525d1
8e525d1
%files -n python3-%{srcname}
8e525d1
%license LICENSE
8e525d1
%doc README.md
df78127
%doc conf/ examples/ distro/redhat/init.d/
be09234
8e525d1
%{python3_sitelib}/carbon
8e525d1
%{python3_sitelib}/carbon-*-py?.?.egg-info
8e525d1
%{python3_sitelib}/twisted/plugins/*
8e525d1
79cbf96
%dir %{_sysconfdir}/carbon
79cbf96
%config(noreplace) %{_sysconfdir}/carbon/carbon.conf
77bd135
%config(noreplace) %{_sysconfdir}/carbon/storage-aggregation.conf
79cbf96
%config(noreplace) %{_sysconfdir}/carbon/storage-schemas.conf
62ab5f9
8e525d1
%config(noreplace) %{_sysconfdir}/logrotate.d/python3-%{srcname}
c473bf7
79cbf96
%attr(0755,carbon,carbon) %dir %{_localstatedir}/lib/carbon
79cbf96
%attr(0755,carbon,carbon) %dir %{_localstatedir}/lib/carbon/lists
79cbf96
%attr(0755,carbon,carbon) %dir %{_localstatedir}/lib/carbon/rrd
79cbf96
%attr(0755,carbon,carbon) %dir %{_localstatedir}/lib/carbon/whisper
79cbf96
%attr(0755,carbon,carbon) %dir %{_localstatedir}/log/carbon
79cbf96
79cbf96
%{_bindir}/carbon-aggregator
56dfa5a
%{_bindir}/carbon-aggregator-cache
79cbf96
%{_bindir}/carbon-cache
79cbf96
%{_bindir}/carbon-client
79cbf96
%{_bindir}/carbon-relay
79cbf96
%{_bindir}/validate-storage-schemas
79cbf96
d45531d
%{_mandir}/man1/carbon-aggregator.1*
d45531d
%{_mandir}/man1/carbon-cache.1*
d45531d
%{_mandir}/man1/carbon-client.1*
d45531d
%{_mandir}/man1/carbon-relay.1*
d45531d
%{_mandir}/man1/validate-storage-schemas.1*
d45531d
4b4b6de
7ee660c
%{_unitdir}/carbon-aggregator.service
a22b616
%{_unitdir}/carbon-cache.service
7ee660c
%{_unitdir}/carbon-relay.service
b373a60
%{_unitdir}/carbon-aggregator@.service
b373a60
%{_unitdir}/carbon-cache@.service
b373a60
%{_unitdir}/carbon-relay@.service
a5d540c
a5d540c
62ab5f9
%changelog
c583ac4
* Sat Dec 22 2018 Piotr Popieluch <piotr1212@gmail.com> - 1.1.4-1.1
c583ac4
- Rebuild
c583ac4
e0a274f
* Sat Sep 15 2018 Piotr Popieluch <piotr1212@gmail.com> - 1.1.4-1
e0a274f
- Update to 1.1.4
e0a274f
e848bd1
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.3-3
aca284b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
aca284b
8e525d1
* Mon Apr 09 2018 Piotr Popieluch <piotr1212@gmail.com> - 1.1.3-2
8e525d1
- Switch to Python 3 by default
8e525d1
- Remove sys-v init
8e525d1
fa5f4d6
* Mon Apr 09 2018 Piotr Popieluch <piotr1212@gmail.com> - 1.1.3-1
fa5f4d6
- Update to 1.1.3
fa5f4d6
81e780a
* Wed Feb 28 2018 Piotr Popieluch <piotr1212@gmail.com> - 1.1.2-1
81e780a
- Update to 1.1.2
a5d540c
- Build python3-carbon
81e780a
a38a83f
* Wed Feb 21 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.1.1-4
a38a83f
- Update Python 2 dependency declarations to new packaging standards
a38a83f
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
a38a83f
d467cfa
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.1-3
d467cfa
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
d467cfa
b2e6521
* Wed Dec 27 2017 Piotr Popieluch <piotr1212@gmail.com> - 1.1.1-2
a4ea313
- Add tests
a4ea313
- Add missing Requires
56dfa5a
b2e6521
* Tue Dec 26 2017 Piotr Popieluch <piotr1212@gmail.com> - 1.1.1-1
b2e6521
- Update to 1.1.1
b2e6521
f3130fc
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.0-0.4.rc1
f3130fc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
f3130fc
c6caa45
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.0-0.3.rc1
c6caa45
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
c6caa45
774d8f9
* Wed Jan 25 2017 piotr1212@gmail.com - 0.10.0-0.2.rc1
774d8f9
- Fix requires
774d8f9
- Fix logrotate name
774d8f9
30eb18f
* Thu Sep 22 2016 Piotr Popieluch <piotr1212@gmail.com> - 0.10.0-0.1.rc1
30eb18f
- Update to 0.10.0-rc1
30eb18f
c7e1499
* Sun Sep 18 2016 Piotr Popieluch <piotr1212@gmail.com> - - 0.9.15-6
ce81c6e
- Set correct interpreter for amqp listener and publiser
c7e1499
c7e1499
* Sun Sep 18 2016 Piotr Popieluch <piotr1212@gmail.com> - 0.9.15-5
df78127
- Add example init script to upstream, rhbz#1360469
b553d95
- Enable logrotate by default, fixes rhbz#1285727
b553d95
- Add storage-aggregation.conf, fixes rhbz#1285725
77bd135
- Update to newer package guidelines
77bd135
- Remove el5 support
77bd135
- Remove obsoleted macros
77bd135
- Update URL
77bd135
b373a60
* Wed Aug 03 2016 Piotr Popieluch <piotr1212@gmail.com> - 0.9.15-4
b373a60
- Add systemd unit files with instances
b373a60
7bddbdc
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.15-3
7bddbdc
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
7bddbdc
eada4c1
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.15-2
eada4c1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
eada4c1
6210c5f
* Sat Nov 28 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.9.15-1
6210c5f
- Update to new version
6210c5f
3fab847
* Sun Nov 08 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.9.14-1
3fab847
- Update to new version
3fab847
78cd72e
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.13-0.2.pre1
78cd72e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
78cd72e
b9b939a
* Mon Jan 19 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.9.13-0.1.pre1
b9b939a
- update to 0.9.13-pre1
b9b939a
f8899e7
* Mon Nov 24 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.9.12-7
f8899e7
- patch setup.py to prevent installation of upstream init scripts
f8899e7
00cd1d4
* Fri Nov 14 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.9.12-6
00cd1d4
- conditionally define macros for EPEL 6 and below
00cd1d4
daf6ec1
* Wed Oct 01 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.9.12-5
daf6ec1
- update URL
daf6ec1
- improve description
daf6ec1
- use commit hash for Source URL
daf6ec1
- use loop to rename files
daf6ec1
- include README.md and examples/
daf6ec1
- amend patch for filesystem default paths
daf6ec1
- fix path to storage-schemas.conf
daf6ec1
- add man pages from Debian
daf6ec1
- disable internal log rotation and include logrotate configuration
daf6ec1
  for Fedora >= 21 and EPEL >= 7
daf6ec1
- be more explicit in %%files
daf6ec1
- include python egg
daf6ec1
- migrate to systemd on Fedora >= 21 and EPEL >= 7
daf6ec1
1fd9ebb
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.12-4
1fd9ebb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
1fd9ebb
5047fa5
* Mon Sep 30 2013 Jonathan Steffan <jsteffan@fedoraproject.org> - 0.9.12-3
5047fa5
- Update default runtime user to carbon for carbon-aggregator and
5047fa5
  carbon-relay (RHBZ#1013813)
5047fa5
50a28e0
* Tue Sep 24 2013 Jonathan Steffan <jsteffan@fedoraproject.org> - 0.9.12-2
50a28e0
- Add strict python-whisper Requires (RHBZ#1010432)
50a28e0
- Don't cleanup user and user data on package remove (RHBZ#1010430)
50a28e0
14a8753
* Mon Sep 02 2013 Jonathan Steffan <jsteffan@fedoraproject.org> - 0.9.12-1
14a8753
- Update to 0.9.12
14a8753
524e134
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.10-4
524e134
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
524e134
bcabd8f
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.10-3
bcabd8f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
bcabd8f
b793e8b
* Sat Nov 24 2012 Jonathan Steffan <jsteffan@fedoraproject.org> - 0.9.10-2
b793e8b
- Update spec to build on el5
b793e8b
- Fix python_sitelib definition
b793e8b
14a8753
* Wed May 30 2012 Jonathan Steffan <jsteffan@fedoraproject.org> - 0.9.10-1
62ab5f9
- Initial Package