Import python-carbon-1.1.10

This commit is contained in:
Sofia Boldyreva 2023-08-25 18:11:00 +02:00
commit 6c40e1584f
18 changed files with 1022 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/python-carbon-1.1.10.tar.gz

1
.python-carbon.metadata Normal file
View File

@ -0,0 +1 @@
ea38f4e5ad9070c90dc9b68a4804164c9d4a3092 SOURCES/python-carbon-1.1.10.tar.gz

View File

@ -0,0 +1,56 @@
.TH CARBON-AGGREGATOR 1
.SH NAME
carbon-aggregator \- buffer metrics over time before reporting to carbon-cache
.SH SYNOPSYS
.nf
.fam C
\fbcarbon-aggregator\fP [options] start
.fam T
.fi
.SH DESCRIPTION
carbon-aggregator can be run in front of carbon-cache to buffer metrics over
time before reporting them into whisper.
.PP
The options are described below.
.SH OPTIONS
.TP
.B
\-h, \-\-help
Show the embedded help.
.TP
.B
\-\-debug
Run in the foreground, log to stdout
.TP
.B
\-\-profile=PROFILE
Record performance profile data to the given file
.TP
.B
\-\-pidfile=PIDFILE
Write pid to the given file
.TP
.B
\-\-config=CONFIG
Use the given config file
.TP
.B
\-\-logdir=LOGDIR
Write logs in the given directory
.TP
.B
\-\-instance=INSTANCE
Manage a specific carbon instance
.TP
.B
\-\-rules=RULES
Use the given aggregation rules file.
.TP
.B
\-\-rewrite-rules=REWRITE_RULES
Use the given rewrite rules file.
.SH AUTHOR
\fBcarbon-aggregator\fP, created by Chris Davis.
.PP
This manual page was written by Jonas Genannt <jonas.genannt@capi2name.de, for
the Debian project (but may be used by others).

View File

@ -0,0 +1,14 @@
[Unit]
Description=Graphite Carbon Aggregator
After=network.target
[Service]
Type=forking
StandardOutput=syslog
StandardError=syslog
ExecStart=/usr/bin/carbon-aggregator --config=/etc/carbon/carbon.conf --pidfile=/var/run/carbon-aggregator.pid start
ExecReload=/bin/kill -USR1 $MAINPID
PIDFile=/var/run/carbon-aggregator.pid
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,15 @@
[Unit]
Description=Graphite Carbon Aggregator Instance %I
After=network.target
[Service]
Type=forking
StandardOutput=syslog
StandardError=syslog
ExecStart=/usr/bin/carbon-aggregator --config=/etc/carbon/carbon.conf --pidfile=/var/run/carbon-aggregator-%i.pid --instance=%i start
ExecReload=/bin/kill -USR1 $MAINPID
PIDFile=/var/run/carbon-aggregator-%i.pid
[Install]
WantedBy=multi-user.target
DefaultInstance=a

50
SOURCES/carbon-cache.1 Normal file
View File

@ -0,0 +1,50 @@
.TH CARBON-CACHE 1
.SH NAME
carbon-cache \- accepts metrics over various protocols and writes them to disk
.SH SYNOPSYS
.nf
.fam C
\fbcarbon-cache\fP [options] start
.fam T
.fi
.SH DESCRIPTION
carbon-cache accepts metrics over various protocols and writes them to disk as
efficiently as possible. This requires caching metric values in RAM as they are
received, and flushing them to disk on an interval using the underlying
whisper library.
.PP
The options are described below.
.SH OPTIONS
.TP
.B
\-h, \-\-help
Show the embedded help.
.TP
.B
\-\-debug
Run in the foreground, log to stdout
.TP
.B
\-\-profile=PROFILE
Record performance profile data to the given file
.TP
.B
\-\-pidfile=PIDFILE
Write pid to the given file
.TP
.B
\-\-config=CONFIG
Use the given config file
.TP
.B
\-\-logdir=LOGDIR
Write logs in the given directory
.TP
.B
\-\-instance=INSTANCE
Manage a specific carbon instance
.SH AUTHOR
\fBcarbon-cache\fP, created by Chris Davis.
.PP
This manual page was written by Jonas Genannt <jonas.genannt@capi2name.de, for
the Debian project (but may be used by others).

View File

@ -0,0 +1,14 @@
[Unit]
Description=Graphite Carbon Cache
After=network.target
[Service]
Type=forking
StandardOutput=syslog
StandardError=syslog
ExecStart=/usr/bin/carbon-cache --config=/etc/carbon/carbon.conf --pidfile=/var/run/carbon-cache.pid start
ExecReload=/bin/kill -USR1 $MAINPID
PIDFile=/var/run/carbon-cache.pid
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,15 @@
[Unit]
Description=Graphite Carbon Cache Instance %I
After=network.target
[Service]
Type=forking
StandardOutput=syslog
StandardError=syslog
ExecStart=/usr/bin/carbon-cache --config=/etc/carbon/carbon.conf --pidfile=/var/run/carbon-cache-%i.pid --instance=%i start
ExecReload=/bin/kill -USR1 $MAINPID
PIDFile=/var/run/carbon-cache-%i.pid
[Install]
WantedBy=multi-user.target
DefaultInstance=a

51
SOURCES/carbon-relay.1 Normal file
View File

@ -0,0 +1,51 @@
.TH CARBON-RELAY 1
.SH NAME
carbon-relay \- replication and sharding data
.SH SYNOPSYS
.nf
.fam C
\fbcarbon-relay\fP [options] start
.fam T
.fi
.SH DESCRIPTION
carbon-relay serves two distinct purposes: replication and sharding.
.PP
The options are described below.
.SH OPTIONS
.TP
.B
\-h, \-\-help
Show the embedded help.
.TP
.B
\-\-debug
Run in the foreground, log to stdout
.TP
.B
\-\-profile=PROFILE
Record performance profile data to the given file
.TP
.B
\-\-pidfile=PIDFILE
Write pid to the given file
.TP
.B
\-\-config=CONFIG
Use the given config file
.TP
.B
\-\-logdir=LOGDIR
Write logs in the given directory
.TP
.B
\-\-instance=INSTANCE
Manage a specific carbon instance
.TP
.B
\-\-rules=RULES
se the given relay rules file.
.SH AUTHOR
\fBcarbon-relay\fP, created by Chris Davis.
.PP
This manual page was written by Jonas Genannt <jonas.genannt@capi2name.de, for
the Debian project (but may be used by others).

View File

@ -0,0 +1,14 @@
[Unit]
Description=Graphite Carbon Relay
After=network.target
[Service]
Type=forking
StandardOutput=syslog
StandardError=syslog
ExecStart=/usr/bin/carbon-relay --config=/etc/carbon/carbon.conf --pidfile=/var/run/carbon-relay.pid start
ExecReload=/bin/kill -USR1 $MAINPID
PIDFile=/var/run/carbon-relay.pid
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,15 @@
[Unit]
Description=Graphite Carbon Relay Instance %I
After=network.target
[Service]
Type=forking
StandardOutput=syslog
StandardError=syslog
ExecStart=/usr/bin/carbon-relay --config=/etc/carbon/carbon.conf --pidfile=/var/run/carbon-relay-%i.pid --instance=%i start
ExecReload=/bin/kill -USR1 $MAINPID
PIDFile=/var/run/carbon-relay-%i.pid
[Install]
WantedBy=multi-user.target
DefaultInstance=a

View File

@ -0,0 +1,25 @@
--- carbon-6a016c2533716d7bf6f44f4459c43976421bf650.orig/conf/carbon.conf.example 2016-09-13 22:44:40.000000000 +0200
+++ carbon-6a016c2533716d7bf6f44f4459c43976421bf650/conf/carbon.conf.example 2016-09-18 22:11:02.358319492 +0200
@@ -30,6 +30,13 @@
#
#LOCAL_DATA_DIR = /opt/graphite/storage/whisper/
+STORAGE_DIR = /var/lib/carbon/
+LOCAL_DATA_DIR = /var/lib/carbon/whisper/
+WHITELISTS_DIR = /var/lib/carbon/lists/
+CONF_DIR = /etc/carbon/
+LOG_DIR = /var/log/carbon/
+PID_DIR = /var/run/
+
# Specify the database library used to store metric data on disk. Each database
# may have configurable options to change the behaviour of how it writes to
# persistent storage.
@@ -41,7 +48,7 @@
# Specify the user to drop privileges to
# If this is blank carbon-cache runs as the user that invokes it
# This user must have write access to the local data directory
-USER =
+USER = carbon
# Limit the size of the cache to avoid swapping or becoming CPU bound.
# Sorts and serving cache queries gets more expensive as the cache grows.

View File

@ -0,0 +1,25 @@
From c0f5af17e7e789166af627175f03739b0cf7cce1 Mon Sep 17 00:00:00 2001
From: Jamie Nguyen <j@jamielinux.com>
Date: Sun, 28 Sep 2014 12:51:12 +0100
Subject: [PATCH] Fix path to storage-schemas.conf
---
bin/validate-storage-schemas.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/validate-storage-schemas.py b/bin/validate-storage-schemas.py
index 51a1108..5797593 100755
--- a/bin/validate-storage-schemas.py
+++ b/bin/validate-storage-schemas.py
@@ -22,7 +22,7 @@ if len(sys.argv) == 2:
SCHEMAS_FILE = sys.argv[1]
print("Loading storage-schemas configuration from: '%s'" % SCHEMAS_FILE)
else:
- SCHEMAS_FILE = realpath(join(dirname(__file__), '..', 'conf', 'storage-schemas.conf'))
+ SCHEMAS_FILE = '/etc/carbon/storage-schemas.conf'
print("Loading storage-schemas configuration from default location at: '%s'" % SCHEMAS_FILE)
config_parser = ConfigParser()
--
1.9.3

View File

@ -0,0 +1,258 @@
diff -up carbon-1.1.10/lib/carbon/routers.py.orig carbon-1.1.10/lib/carbon/routers.py
--- carbon-1.1.10/lib/carbon/routers.py.orig 2022-05-22 11:58:01.000000000 -0600
+++ carbon-1.1.10/lib/carbon/routers.py 2023-08-02 19:34:36.065846924 -0600
@@ -1,4 +1,3 @@
-import imp
from carbon.hashing import ConsistentHashRing, carbonHash
from carbon.util import PluginRegistrar
from six import with_metaclass
@@ -125,17 +124,6 @@ class ConsistentHashingRouter(DatapointR
def getKey(self, metric):
return metric
- def setKeyFunction(self, func):
- self.getKey = func
-
- def setKeyFunctionFromModule(self, keyfunc_spec):
- module_path, func_name = keyfunc_spec.rsplit(':', 1)
- module_file = open(module_path, 'U')
- description = ('.py', 'U', imp.PY_SOURCE)
- module = imp.load_module('keyfunc_module', module_file, module_path, description)
- keyfunc = getattr(module, func_name)
- self.setKeyFunction(keyfunc)
-
class AggregatedConsistentHashingRouter(DatapointRouter):
plugin_name = 'aggregated-consistent-hashing'
diff -up carbon-1.1.10/lib/carbon/tests/test_log.py.orig carbon-1.1.10/lib/carbon/tests/test_log.py
--- carbon-1.1.10/lib/carbon/tests/test_log.py.orig 2022-05-22 11:58:01.000000000 -0600
+++ carbon-1.1.10/lib/carbon/tests/test_log.py 2023-08-02 19:33:17.940175832 -0600
@@ -23,4 +23,4 @@ class CarbonLogFileTest(TestCase):
with open(path.join(tmpdir, 'creates.log')) as logfile:
read_line = logfile.readline()
- self.assertRegexpMatches(read_line, '.*😀😀😀😀 test !!!!')
+ self.assertRegex(read_line, '.*😀😀😀😀 test !!!!')
diff -up carbon-1.1.10/lib/carbon/tests/test_protocols.py.orig carbon-1.1.10/lib/carbon/tests/test_protocols.py
--- carbon-1.1.10/lib/carbon/tests/test_protocols.py.orig 2022-05-22 11:58:01.000000000 -0600
+++ carbon-1.1.10/lib/carbon/tests/test_protocols.py 2023-08-02 19:33:17.941175827 -0600
@@ -34,7 +34,7 @@ class TestMetricReceiversHandler(TestCas
expected_plugins = sorted(expected_plugins)
plugins = sorted(MetricReceiver.plugins.keys())
- self.assertEquals(expected_plugins, plugins)
+ self.assertEqual(expected_plugins, plugins)
class _FakeService(object):
def addService(_, __):
@@ -244,19 +244,19 @@ class TestMetricPickleReceiver(TestCase)
self.receiver.stringReceived(b"i")
# ImportError
self.receiver.stringReceived(b"iii")
- MetricReceiver.metricReceived.not_called()
+ MetricReceiver.metricReceived.assert_not_called()
def test_decode_pickle(self):
""" Missing timestamp/value should not call metricReceived """
metrics = [('foo.bar', 1)]
self.receiver.stringReceived(pickle.dumps(metrics))
- MetricReceiver.metricReceived.not_called()
+ MetricReceiver.metricReceived.assert_not_called()
def test_invalid_types(self):
""" Timestamp/value in wrong type should not call metricReceived """
metrics = [('foo.bar', ('a', 'b'))]
self.receiver.stringReceived(pickle.dumps(metrics))
- MetricReceiver.metricReceived.not_called()
+ MetricReceiver.metricReceived.assert_not_called()
def test_py2_unicode_to_string_conversion(self):
""" Metricname in python2 unicode type should be transformed to str """
@@ -339,7 +339,7 @@ class TestCacheManagementHandler(TestCas
def test_cache_query_returns_empty_if_no_match(self):
self.send_request('cache-query', metric='carbon.foo')
- self.assertEquals({'datapoints': []}, self.response)
+ self.assertEqual({'datapoints': []}, self.response)
def test_cache_query_returns_cached_datapoints_if_matches(self):
self.cache.store('carbon.foo', (600, 1.0))
@@ -356,7 +356,7 @@ class TestCacheManagementHandler(TestCas
def test_cache_bulk_query_response_returns_empty_if_no_match(self):
self.send_request('cache-query-bulk', metrics=[])
- self.assertEquals({'datapointsByMetric': {}}, self.response)
+ self.assertEqual({'datapointsByMetric': {}}, self.response)
def test_cache_bulk_query_response(self):
self.cache.store('carbon.foo', (600, 1.0))
@@ -364,4 +364,4 @@ class TestCacheManagementHandler(TestCas
expected_response = {'carbon.foo': [(600, 1.0)], 'carbon.bar': [(600, 2.0)]}
self.send_request('cache-query-bulk', metrics=['carbon.foo', 'carbon.bar'])
- self.assertEquals({'datapointsByMetric': expected_response}, self.response)
+ self.assertEqual({'datapointsByMetric': expected_response}, self.response)
diff -up carbon-1.1.10/lib/carbon/tests/test_routers.py.orig carbon-1.1.10/lib/carbon/tests/test_routers.py
--- carbon-1.1.10/lib/carbon/tests/test_routers.py.orig 2022-05-22 11:58:01.000000000 -0600
+++ carbon-1.1.10/lib/carbon/tests/test_routers.py 2023-08-02 19:33:17.941175827 -0600
@@ -36,7 +36,7 @@ class TestRelayRulesRouter(unittest.Test
router = routers.RelayRulesRouter(createSettings())
for destination in DESTINATIONS:
router.addDestination(parseDestination(destination))
- self.assertEquals(len(list(router.getDestinations('foo.bar'))), 1)
+ self.assertEqual(len(list(router.getDestinations('foo.bar'))), 1)
class TestOtherRouters(unittest.TestCase):
@@ -48,9 +48,9 @@ class TestOtherRouters(unittest.TestCase
continue
router = routers.DatapointRouter.plugins[plugin](settings)
- self.assertEquals(len(list(router.getDestinations('foo.bar'))), 0)
+ self.assertEqual(len(list(router.getDestinations('foo.bar'))), 0)
for destination in DESTINATIONS:
router.addDestination(parseDestination(destination))
- self.assertEquals(len(list(router.getDestinations('foo.bar'))),
+ self.assertEqual(len(list(router.getDestinations('foo.bar'))),
settings['REPLICATION_FACTOR'])
diff -up carbon-1.1.10/lib/carbon/tests/test_storage.py.orig carbon-1.1.10/lib/carbon/tests/test_storage.py
--- carbon-1.1.10/lib/carbon/tests/test_storage.py.orig 2022-05-22 11:58:01.000000000 -0600
+++ carbon-1.1.10/lib/carbon/tests/test_storage.py 2023-08-02 19:33:17.941175827 -0600
@@ -21,9 +21,9 @@ from carbon.database import WhisperDatab
# def test_loadAggregationSchemas_load_default_schema(self):
# from carbon.storage import loadAggregationSchemas, defaultAggregation
# schema_list = loadAggregationSchemas()
-# self.assertEquals(len(schema_list), 1)
+# self.assertEqual(len(schema_list), 1)
# schema = schema_list[0]
-# self.assertEquals(schema, defaultAggregation)
+# self.assertEqual(schema, defaultAggregation)
# def test_loadStorageSchemas_raise_CarbonConfigException(self):
# from carbon.storage import loadStorageSchemas
@@ -51,28 +51,28 @@ class ExistingConfigSchemaLoadingTest(Te
def test_loadStorageSchemas_return_schemas(self):
from carbon.storage import loadStorageSchemas, PatternSchema, Archive
schema_list = loadStorageSchemas()
- self.assertEquals(len(schema_list), 3)
+ self.assertEqual(len(schema_list), 3)
expected = [
PatternSchema('carbon', r'^carbon\.', [Archive.fromString('60:90d')]),
PatternSchema('default_1min_for_1day', '.*', [Archive.fromString('60s:1d')])
]
for schema, expected_schema in zip(schema_list[:-1], expected):
- self.assertEquals(schema.name, expected_schema.name)
- self.assertEquals(schema.pattern, expected_schema.pattern)
+ self.assertEqual(schema.name, expected_schema.name)
+ self.assertEqual(schema.pattern, expected_schema.pattern)
for (archive, expected_archive) in zip(schema.archives, expected_schema.archives):
- self.assertEquals(archive.getTuple(), expected_archive.getTuple())
+ self.assertEqual(archive.getTuple(), expected_archive.getTuple())
def test_loadStorageSchemas_return_the_default_schema_last(self):
from carbon.storage import loadStorageSchemas, defaultSchema
schema_list = loadStorageSchemas()
last_schema = schema_list[-1]
- self.assertEquals(last_schema.name, defaultSchema.name)
- self.assertEquals(last_schema.archives, defaultSchema.archives)
+ self.assertEqual(last_schema.name, defaultSchema.name)
+ self.assertEqual(last_schema.archives, defaultSchema.archives)
def test_loadAggregationSchemas_return_schemas(self):
from carbon.storage import loadAggregationSchemas, PatternSchema
schema_list = loadAggregationSchemas()
- self.assertEquals(len(schema_list), 5)
+ self.assertEqual(len(schema_list), 5)
expected = [
PatternSchema('min', r'\.min$', (0.1, 'min')),
PatternSchema('max', r'\.max$', (0.1, 'max')),
@@ -80,12 +80,12 @@ class ExistingConfigSchemaLoadingTest(Te
PatternSchema('default_average', '.*', (0.5, 'average'))
]
for schema, expected_schema in zip(schema_list[:-1], expected):
- self.assertEquals(schema.name, expected_schema.name)
- self.assertEquals(schema.pattern, expected_schema.pattern)
- self.assertEquals(schema.archives, expected_schema.archives)
+ self.assertEqual(schema.name, expected_schema.name)
+ self.assertEqual(schema.pattern, expected_schema.pattern)
+ self.assertEqual(schema.archives, expected_schema.archives)
def test_loadAggregationSchema_return_the_default_schema_last(self):
from carbon.storage import loadAggregationSchemas, defaultAggregation
schema_list = loadAggregationSchemas()
last_schema = schema_list[-1]
- self.assertEquals(last_schema, defaultAggregation)
+ self.assertEqual(last_schema, defaultAggregation)
diff -up carbon-1.1.10/lib/carbon/tests/test_util.py.orig carbon-1.1.10/lib/carbon/tests/test_util.py
--- carbon-1.1.10/lib/carbon/tests/test_util.py.orig 2022-05-22 11:58:01.000000000 -0600
+++ carbon-1.1.10/lib/carbon/tests/test_util.py 2023-08-02 19:33:17.942175823 -0600
@@ -21,7 +21,7 @@ class UtilTest(unittest.TestCase):
s.setsockopt(socket.SOL_TCP, socket.SO_KEEPALIVE, value)
enableTcpKeepAlive(_Transport(), True, None)
- self.assertEquals(s.getsockopt(socket.SOL_TCP, socket.SO_KEEPALIVE), 1)
+ self.assertEqual(s.getsockopt(socket.SOL_TCP, socket.SO_KEEPALIVE), 1)
def test_sanitizing_name_as_tag_value(self):
test_cases = [
@@ -61,7 +61,7 @@ class UtilTest(unittest.TestCase):
)
else:
result = TaggedSeries.sanitize_name_as_tag_value(test_case['original'])
- self.assertEquals(result, test_case['expected'])
+ self.assertEqual(result, test_case['expected'])
def test_validate_tag_key_and_value(self):
# assert that it raises exception when sanitized name is still not valid
@@ -114,10 +114,10 @@ class ParseDestinationsTest(unittest.Tes
]
actual = parseDestinations(dests)
- self.assertEquals(len(expected), len(actual))
+ self.assertEqual(len(expected), len(actual))
for exp, act in zip(expected, actual):
- self.assertEquals(exp, act)
+ self.assertEqual(exp, act)
def test_valid_dest_bracketed(self):
# Tests valid destinations in the bracketed form of <host>.
@@ -136,10 +136,10 @@ class ParseDestinationsTest(unittest.Tes
]
actual = parseDestinations(dests)
- self.assertEquals(len(expected), len(actual))
+ self.assertEqual(len(expected), len(actual))
for exp, act in zip(expected, actual):
- self.assertEquals(exp, act)
+ self.assertEqual(exp, act)
def test_valid_dest_without_instance(self):
# Tests destinations without instance specified.
@@ -160,10 +160,10 @@ class ParseDestinationsTest(unittest.Tes
]
actual = parseDestinations(dests)
- self.assertEquals(len(expected), len(actual))
+ self.assertEqual(len(expected), len(actual))
for exp, act in zip(expected, actual):
- self.assertEquals(exp, act)
+ self.assertEqual(exp, act)
def test_wrong_dest(self):
# Some cases of invalid input, e.g. invalid/missing port.
diff -up carbon-1.1.10/setup.py.orig carbon-1.1.10/setup.py
--- carbon-1.1.10/setup.py.orig 2022-05-22 11:58:01.000000000 -0600
+++ carbon-1.1.10/setup.py 2023-08-02 19:33:17.942175823 -0600
@@ -24,7 +24,7 @@ cf = ConfigParser()
with open('setup.cfg', 'r') as f:
orig_setup_cfg = f.read()
f.seek(0)
- cf.readfp(f, 'setup.cfg')
+ cf.read_file(f, 'setup.cfg')
if os.environ.get('GRAPHITE_NO_PREFIX'):
cf.remove_section('install')

View File

@ -0,0 +1,10 @@
/var/log/carbon/*.log {
weekly
missingok
rotate 7
compress
delaycompress
notifempty
sharedscripts
nocreate
}

View File

@ -0,0 +1,4 @@
# Configuration file for carbon
# CONFIG=/etc/carbon/carbon.conf
# LOG_DIR=/var/log/carbon

View File

@ -0,0 +1,17 @@
.TH VALIDATE-STORAGE-SCHEMAS 1
.SH NAME
validate-storage-schemas \- validates the storage schemas
.SH SYNOPSYS
.nf
.fam C
\fbvalidate-storage-schemas\fP
.fam T
.fi
.SH DESCRIPTION
validates the storage schemas from the configuration
file /etc/carbon/storage-schemas.conf.
.SH AUTHOR
\fBvalidate-storage-schemas\fP, created by Chris Davis.
.PP
This manual page was written by Jonas Genannt <jonas.genannt@capi2name.de, for
the Debian project (but may be used by others).

437
SPECS/python-carbon.spec Normal file
View File

@ -0,0 +1,437 @@
%global srcname carbon
%global desc %{expand: \
Carbon is one of the components of Graphite, and is responsible for
receiving metrics over the network and writing them down to disk using
a storage back-end.}
Name: python-%{srcname}
Version: 1.1.10
Release: 5%{?dist}
Summary: Back-end data caching and persistence daemon for Graphite
License: ASL 2.0
URL: https://github.com/graphite-project/carbon
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Source10: carbon-aggregator.1
Source11: carbon-cache.1
Source13: carbon-relay.1
Source14: validate-storage-schemas.1
Source20: %{name}.logrotate
Source30: carbon-aggregator.service
Source31: carbon-cache.service
Source32: carbon-relay.service
Source33: carbon-aggregator@.service
Source34: carbon-cache@.service
Source35: carbon-relay@.service
Source43: %{name}.sysconfig
# Set sane default filesystem paths.
Patch1: %{name}-0.10.0-Set-sane-defaults.patch
# Fix path to storage-schemas.conf.
Patch2: %{name}-0.9.13-Fix-path-to-storage-schemas.conf.patch
# Python 3.12 support https://github.com/graphite-project/carbon/issues/946
Patch3: %{name}-1.1.10-Py3.12-support.patch
BuildArch: noarch
BuildRequires: python3-cachetools
BuildRequires: python3-twisted
BuildRequires: python3-urllib3
BuildRequires: python3-cachetools
BuildRequires: python3-twisted
BuildRequires: python3-urllib3
BuildRequires: python3-devel
BuildRequires: python3-pytest
BuildRequires: python3-protobuf
BuildRequires: python3-whisper
BuildRequires: pyproject-rpm-macros
BuildRequires: systemd
%py_provides python3-%{pypi_name}
%description
%{desc}
%package -n python3-%{srcname}
Summary: %{summary}
Requires: logrotate
Requires(pre): shadow-utils
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-%{srcname}
%{desc}
%prep
%autosetup -p1 -n %{srcname}-%{version}
# ugly prefix hack..
export GRAPHITE_NO_PREFIX=True
sed -i -e '/data_files=install_files,/d' setup.py
cat << EOF >> setup.cfg
[install]
install-lib=
EOF
# txAMQP is orphaned in 2020
sed -i "s/, 'txAMQP'//" setup.py
sed -i '/txAMQP/d' requirements.txt
# shebangs shebang..
sed -i '1s|^#!/usr/bin/env python|#!/usr/bin/python3|' lib/carbon/amqp_listener.py
sed -i '1s|^#!/usr/bin/env python|#!/usr/bin/python3|' lib/carbon/amqp_publisher.py
# disable tests which use mmh3 hash
sed -i "s|plugin == 'rules'|plugin == 'rules' or plugin.startswith('fast-')|" lib/carbon/tests/test_routers.py
# Disable internal log rotation.
sed -i -e 's/ENABLE_LOGROTATION.*/ENABLE_LOGROTATION = False/g' conf/carbon.conf.example
# Skip Ceres database test, not actively maintained
rm lib/carbon/tests/test_database.py
# Use the standard library instead of a backport
sed -i -e 's/^import mock/from unittest import mock/' \
-e 's/^from mock import /from unittest.mock import /' \
lib/carbon/tests/*.py
%generate_buildrequires
%pyproject_buildrequires -r
%build
%py3_build
%install
%{py3_install -- \
--install-data=%{_localstatedir}/lib/carbon \
--install-lib=%{python3_sitelib} \
--install-scripts=%{_bindir}}
rm -rf %{buildroot}%{_localstatedir}/lib/carbon/*
mkdir -p %{buildroot}%{_localstatedir}/lib/carbon/lists
mkdir -p %{buildroot}%{_localstatedir}/lib/carbon/rrd
mkdir -p %{buildroot}%{_localstatedir}/lib/carbon/whisper
# default config
mkdir -p %{buildroot}%{_sysconfdir}/carbon
install -D -p -m0644 conf/carbon.conf.example \
%{buildroot}%{_sysconfdir}/carbon/carbon.conf
install -D -p -m0644 conf/storage-aggregation.conf.example \
%{buildroot}%{_sysconfdir}/carbon/storage-aggregation.conf
install -D -p -m0644 conf/storage-schemas.conf.example \
%{buildroot}%{_sysconfdir}/carbon/storage-schemas.conf
# man pages
mkdir -p %{buildroot}%{_mandir}/man1
install -D -p -m0644 %{SOURCE10} %{buildroot}%{_mandir}/man1
install -D -p -m0644 %{SOURCE11} %{buildroot}%{_mandir}/man1
install -D -p -m0644 %{SOURCE13} %{buildroot}%{_mandir}/man1
install -D -p -m0644 %{SOURCE14} %{buildroot}%{_mandir}/man1
# log files
mkdir -p %{buildroot}%{_localstatedir}/log/carbon
install -D -p -m0644 %{SOURCE20} \
%{buildroot}%{_sysconfdir}/logrotate.d/python3-%{srcname}
# init scripts
install -D -p -m0644 %{SOURCE30} \
%{buildroot}%{_unitdir}/carbon-aggregator.service
install -D -p -m0644 %{SOURCE31} \
%{buildroot}%{_unitdir}/carbon-cache.service
install -D -p -m0644 %{SOURCE32} \
%{buildroot}%{_unitdir}/carbon-relay.service
install -D -p -m0644 %{SOURCE33} \
%{buildroot}%{_unitdir}/carbon-aggregator@.service
install -D -p -m0644 %{SOURCE34} \
%{buildroot}%{_unitdir}/carbon-cache@.service
install -D -p -m0644 %{SOURCE35} \
%{buildroot}%{_unitdir}/carbon-relay@.service
# remove .py suffix
for i in %{buildroot}%{_bindir}/*.py; do
mv ${i} ${i%%.py}
done
# fix permissions
chmod 755 %{buildroot}%{python3_sitelib}/carbon/amqp_listener.py
chmod 755 %{buildroot}%{python3_sitelib}/carbon/amqp_publisher.py
%pre -n python3-%{srcname}
getent group carbon >/dev/null || groupadd -r carbon
getent passwd carbon >/dev/null || \
useradd -r -g carbon -d %{_localstatedir}/lib/carbon \
-s /sbin/nologin -c "Carbon cache daemon" carbon
%post -n python3-%{srcname}
%systemd_post carbon-aggregator.service
%systemd_post carbon-cache.service
%systemd_post carbon-relay.service
%preun -n python3-%{srcname}
%systemd_preun carbon-aggregator.service
%systemd_preun carbon-cache.service
%systemd_preun carbon-relay.service
%postun -n python3-%{srcname}
%systemd_postun_with_restart carbon-aggregator.service
%systemd_postun_with_restart carbon-cache.service
%systemd_postun_with_restart carbon-relay.service
%check
%pytest -v
%files -n python3-%{srcname}
%doc README.md
%doc conf/ examples/ distro/redhat/init.d/
%{python3_sitelib}/carbon
%{python3_sitelib}/carbon-*-py%{python3_version}.egg-info
%{python3_sitelib}/twisted/plugins/*
%dir %{_sysconfdir}/carbon
%config(noreplace) %{_sysconfdir}/carbon/carbon.conf
%config(noreplace) %{_sysconfdir}/carbon/storage-aggregation.conf
%config(noreplace) %{_sysconfdir}/carbon/storage-schemas.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/python3-%{srcname}
%attr(0755,carbon,carbon) %dir %{_localstatedir}/lib/carbon
%attr(0755,carbon,carbon) %dir %{_localstatedir}/lib/carbon/lists
%attr(0755,carbon,carbon) %dir %{_localstatedir}/lib/carbon/rrd
%attr(0755,carbon,carbon) %dir %{_localstatedir}/lib/carbon/whisper
%attr(0755,carbon,carbon) %dir %{_localstatedir}/log/carbon
%{_bindir}/carbon-aggregator
%{_bindir}/carbon-aggregator-cache
%{_bindir}/carbon-cache
%{_bindir}/carbon-relay
%{_bindir}/validate-storage-schemas
%{_mandir}/man1/carbon-aggregator.1*
%{_mandir}/man1/carbon-cache.1*
%{_mandir}/man1/carbon-relay.1*
%{_mandir}/man1/validate-storage-schemas.1*
%{_unitdir}/carbon-aggregator.service
%{_unitdir}/carbon-cache.service
%{_unitdir}/carbon-relay.service
%{_unitdir}/carbon-aggregator@.service
%{_unitdir}/carbon-cache@.service
%{_unitdir}/carbon-relay@.service
%changelog
* Fri Aug 25 2023 Sofia Boldyreva <sboldyreva@almalinux.org> - 1.1.10-5
- Added to BuildRequires: python3-cachetools, python3-twisted, python3-urllib3 to be able to build on AlmaLinux
- Replaced %pyproject_wheel with %py3_build in %build to be able to build on AlmaLinux
- Replaced %pyproject_install, %pyproject_save_files %{srcname} twisted with py3_install lines
- Removed -f %{pyproject_files} in %files to be able to build on AlmaLinux
- Added %{python3_sitelib}/carbon, %{python3_sitelib}/carbon-*-py%{python3_version}.egg-info, %{python3_sitelib}/twisted/plugins/* in %files to be able to build on AlmaLinux
* Fri Aug 04 2023 Jonathan Steffan <jsteffan@fedoraproject.org> - 1.1.10-5
- Patch for Python 3.12 (RHBZ#2226168)
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.10-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Jun 28 2023 Python Maint <python-maint@redhat.com> - 1.1.10-3
- Rebuilt for Python 3.12
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Mon Jul 25 2022 Ali Erdinc Koroglu <aekoroglu@fedoraproject.org> - 1.1.10-1
- Update to 1.1.10 (RHBZ #2056668 and #2101243)
* Tue Jun 14 2022 Python Maint <python-maint@redhat.com> - 1.1.6-11
- Rebuilt for Python 3.11
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Jan 12 2022 Miro Hrončok <mhroncok@redhat.com> - 1.1.6-9
- Fix tests for mock 4+
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 1.1.6-7
- Rebuilt for Python 3.10
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.1.6-6
- Rebuilt for updated systemd-rpm-macros
See https://pagure.io/fesco/issue/2583.
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.1.6-3
- Rebuilt for Python 3.9
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Jan 18 2020 Piotr Popieluch <piotr1212@gmail.com> - 1.1.6-1
- Update to 1.1.6
- -- adds options to py3_install after \ #1792050
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.1.5-6
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.1.5-5
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Feb 11 2019 Piotr Popieluch <piotr1212@gmail.com> - 1.1.5-3
- Remove requires on configparser
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Jan 14 2019 Piotr Popieluch <piotr1212@gmail.com> - 1.1.5-1
- Update to 1.1.5
* Thu Sep 27 2018 Piotr Popieluch <piotr1212@gmail.com> - 1.1.4-2
- Remove Python 2 Subpackage
* Sat Sep 15 2018 Piotr Popieluch <piotr1212@gmail.com> - 1.1.4-1
- Update to 1.1.4
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Apr 09 2018 Piotr Popieluch <piotr1212@gmail.com> - 1.1.3-2
- Switch to Python 3 by default
- Remove sys-v init
* Mon Apr 09 2018 Piotr Popieluch <piotr1212@gmail.com> - 1.1.3-1
- Update to 1.1.3
* Wed Feb 28 2018 Piotr Popieluch <piotr1212@gmail.com> - 1.1.2-1
- Update to 1.1.2
- Build python3-carbon
* Wed Feb 21 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.1.1-4
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Dec 27 2017 Piotr Popieluch <piotr1212@gmail.com> - 1.1.1-2
- Add tests
- Add missing Requires
* Tue Dec 26 2017 Piotr Popieluch <piotr1212@gmail.com> - 1.1.1-1
- Update to 1.1.1
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.0-0.4.rc1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.0-0.3.rc1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Jan 25 2017 piotr1212@gmail.com - 0.10.0-0.2.rc1
- Fix requires
- Fix logrotate name
* Thu Sep 22 2016 Piotr Popieluch <piotr1212@gmail.com> - 0.10.0-0.1.rc1
- Update to 0.10.0-rc1
* Sun Sep 18 2016 Piotr Popieluch <piotr1212@gmail.com> - - 0.9.15-6
- Set correct interpreter for amqp listener and publiser
* Sun Sep 18 2016 Piotr Popieluch <piotr1212@gmail.com> - 0.9.15-5
- Add example init script to upstream, rhbz#1360469
- Enable logrotate by default, fixes rhbz#1285727
- Add storage-aggregation.conf, fixes rhbz#1285725
- Update to newer package guidelines
- Remove el5 support
- Remove obsoleted macros
- Update URL
* Wed Aug 03 2016 Piotr Popieluch <piotr1212@gmail.com> - 0.9.15-4
- Add systemd unit files with instances
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.15-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Sat Nov 28 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.9.15-1
- Update to new version
* Sun Nov 08 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.9.14-1
- Update to new version
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.13-0.2.pre1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Mon Jan 19 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.9.13-0.1.pre1
- update to 0.9.13-pre1
* Mon Nov 24 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.9.12-7
- patch setup.py to prevent installation of upstream init scripts
* Fri Nov 14 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.9.12-6
- conditionally define macros for EPEL 6 and below
* Wed Oct 01 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.9.12-5
- update URL
- improve description
- use commit hash for Source URL
- use loop to rename files
- include README.md and examples/
- amend patch for filesystem default paths
- fix path to storage-schemas.conf
- add man pages from Debian
- disable internal log rotation and include logrotate configuration
for Fedora >= 21 and EPEL >= 7
- be more explicit in %%files
- include python egg
- migrate to systemd on Fedora >= 21 and EPEL >= 7
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.12-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Mon Sep 30 2013 Jonathan Steffan <jsteffan@fedoraproject.org> - 0.9.12-3
- Update default runtime user to carbon for carbon-aggregator and
carbon-relay (RHBZ#1013813)
* Tue Sep 24 2013 Jonathan Steffan <jsteffan@fedoraproject.org> - 0.9.12-2
- Add strict python-whisper Requires (RHBZ#1010432)
- Don't cleanup user and user data on package remove (RHBZ#1010430)
* Mon Sep 02 2013 Jonathan Steffan <jsteffan@fedoraproject.org> - 0.9.12-1
- Update to 0.9.12
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.10-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Sat Nov 24 2012 Jonathan Steffan <jsteffan@fedoraproject.org> - 0.9.10-2
- Update spec to build on el5
- Fix python_sitelib definition
* Wed May 30 2012 Jonathan Steffan <jsteffan@fedoraproject.org> - 0.9.10-1
- Initial Package