diff options
Diffstat (limited to 'dev-cpp/prometheus-cpp')
4 files changed, 151 insertions, 0 deletions
diff --git a/dev-cpp/prometheus-cpp/Manifest b/dev-cpp/prometheus-cpp/Manifest new file mode 100644 index 000000000000..00abfdad79b7 --- /dev/null +++ b/dev-cpp/prometheus-cpp/Manifest @@ -0,0 +1,4 @@ +AUX prometheus-cpp-0.9.0-core-Skip-serialization-test-if-locale-is-not-availa.patch 2180 BLAKE2B cd864a68def30f4bf64eb56afc2666ebe7e56a645da1df7e143d7874ae36ea8ecc82a2d5f8aeba5939866b67baeb6a457937355d275375c3bd93b1340bf00ac7 SHA512 3f1dbd41a953e897a1e18a97ef239b73ee1a00475d210406ada3b17686ebd52698c125670a217bb2fd75bf43437640426d48d1c5216ed313c2aceee6bc9fed68 +DIST prometheus-cpp-0.9.0.tar.gz 43924 BLAKE2B e2b26b257e44c63ae5bc2a703d0ee9247fd8f093ef58a3b00dec022af9cb56b18d20b74ccdb91899e2385b036c332b62d9959b9258082ca420fecf48926139d5 SHA512 d9d5fbbd8c8aad5dd6a5e872275324d689a0c57199e4158d74e13ea62b286fa71dee01bb4197b906b79792bf1ca4e67a46b5c04621d7070241ac32876f6de891 +EBUILD prometheus-cpp-0.9.0.ebuild 861 BLAKE2B 5646744ffc35576379efda8660d4766dd5a31f34688e1e1ae8ed203c78741c2a3081ac17d08ecd42bb470c473494f382fd7be520ec7fb272f0eab8fa0b86fd8a SHA512 173615b28f1d1d73f871b22c6fbc8d787cecce06529ce39a5e9bb03dc4ca9672d74ec2a71666b627b445fd104606ef7d2c5e5fc187e645fc227525f58c98e876 +MISC metadata.xml 957 BLAKE2B e5ad4d542af4a50bfe542f810c937f79065d7a77f5733bd9e3ce356da4dac599eacf980ad5650e91da3a64c9a050f08dfd24acead0538884fbe01253cb008130 SHA512 06444b55464c8301512b2f6c25f8d0e0071cab367cca4111bd21891b66ab7432b7e637f4ed46803c189cc657677ed35a8c351a11e440f8f1ccd48c9a5d636626 diff --git a/dev-cpp/prometheus-cpp/files/prometheus-cpp-0.9.0-core-Skip-serialization-test-if-locale-is-not-availa.patch b/dev-cpp/prometheus-cpp/files/prometheus-cpp-0.9.0-core-Skip-serialization-test-if-locale-is-not-availa.patch new file mode 100644 index 000000000000..ced0b80e83e9 --- /dev/null +++ b/dev-cpp/prometheus-cpp/files/prometheus-cpp-0.9.0-core-Skip-serialization-test-if-locale-is-not-availa.patch @@ -0,0 +1,80 @@ +From bf6e2ce56abe2a710181f0365a21ca2dafd2a8f5 Mon Sep 17 00:00:00 2001 +From: Gregor Jasny <gjasny@googlemail.com> +Date: Fri, 13 Mar 2020 13:16:56 +0100 +Subject: [PATCH] core: Skip serialization test if locale is not available + +Closes: #345 +--- + core/tests/raii_locale.h | 15 +++++++++++++++ + core/tests/serializer_test.cc | 21 ++++++++++++++------- + 2 files changed, 29 insertions(+), 7 deletions(-) + create mode 100644 core/tests/raii_locale.h + +diff --git a/core/tests/raii_locale.h b/core/tests/raii_locale.h +new file mode 100644 +index 0000000..592d74f +--- /dev/null ++++ b/core/tests/raii_locale.h +@@ -0,0 +1,15 @@ ++#pragma once ++ ++#include <locale> ++ ++class RAIILocale { ++ public: ++ RAIILocale(const char* name) : savedLocale_(std::locale::classic()) { ++ std::locale::global(std::locale(name)); ++ } ++ ++ ~RAIILocale() { std::locale::global(savedLocale_); } ++ ++ private: ++ const std::locale savedLocale_; ++}; +diff --git a/core/tests/serializer_test.cc b/core/tests/serializer_test.cc +index f935a3b..6cb8f0e 100644 +--- a/core/tests/serializer_test.cc ++++ b/core/tests/serializer_test.cc +@@ -1,9 +1,13 @@ + #include "prometheus/counter.h" ++#include "prometheus/detail/future_std.h" + #include "prometheus/family.h" + #include "prometheus/text_serializer.h" + ++#include "raii_locale.h" ++ + #include <gmock/gmock.h> +-#include <locale> ++ ++#include <memory> + #include <sstream> + + namespace prometheus { +@@ -25,15 +29,18 @@ class SerializerTest : public testing::Test { + + #ifndef _WIN32 + TEST_F(SerializerTest, shouldSerializeLocaleIndependent) { +- // save and change locale +- const std::locale oldLocale = std::locale::classic(); +- std::locale::global(std::locale("de_DE.UTF-8")); ++ std::unique_ptr<RAIILocale> localeWithCommaDecimalSeparator; ++ ++ // ignore missing locale and skip test if setup fails ++ try { ++ localeWithCommaDecimalSeparator = ++ detail::make_unique<RAIILocale>("de_DE.UTF-8"); ++ } catch (std::runtime_error&) { ++ GTEST_SKIP(); ++ } + + const auto serialized = textSerializer.Serialize(collected); + EXPECT_THAT(serialized, testing::HasSubstr("1.0")); +- +- // restore locale +- std::locale::global(oldLocale); + } + #endif + +-- +2.28.0 + diff --git a/dev-cpp/prometheus-cpp/metadata.xml b/dev-cpp/prometheus-cpp/metadata.xml new file mode 100644 index 000000000000..ece2117d6db5 --- /dev/null +++ b/dev-cpp/prometheus-cpp/metadata.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <longdescription lang="en"> + This library aims to enable Metrics-Driven Development for C++ services. + It implements the Prometheus Data Model, a powerful abstraction on which + to collect and expose metrics. We offer the possibility for metrics to + be collected by Prometheus, but other push/pull collections can be added + as plugins. + </longdescription> + <maintainer type="person"> + <email>vilhelm.gray@gmail.com</email> + <name>William Breathitt Gray</name> + </maintainer> + <maintainer type="project"> + <email>proxy-maint@gentoo.org</email> + <name>Proxy Maintainers</name> + </maintainer> + <upstream> + <bugs-to>https://github.com/jupp0r/prometheus-cpp/issues</bugs-to> + <doc lang="en">https://jupp0r.github.io/prometheus-cpp/</doc> + <remote-id type="github">jupp0r/prometheus-cpp</remote-id> + </upstream> +</pkgmetadata> diff --git a/dev-cpp/prometheus-cpp/prometheus-cpp-0.9.0.ebuild b/dev-cpp/prometheus-cpp/prometheus-cpp-0.9.0.ebuild new file mode 100644 index 000000000000..75d66bcbc3d2 --- /dev/null +++ b/dev-cpp/prometheus-cpp/prometheus-cpp-0.9.0.ebuild @@ -0,0 +1,43 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit cmake + +DESCRIPTION="Prometheus Client Library for Modern C++" +HOMEPAGE="https://github.com/jupp0r/prometheus-cpp" +SRC_URI="https://github.com/jupp0r/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="test zlib" +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-libs/cppcodec + net-misc/curl + sys-libs/zlib + www-servers/civetweb[cxx]" +DEPEND="${RDEPEND} + test? ( + dev-cpp/benchmark + dev-cpp/gtest + )" + +PATCHES=( + "${FILESDIR}/${P}-core-Skip-serialization-test-if-locale-is-not-availa.patch" +) + +src_configure() { + local mycmakeargs=( + -DENABLE_PULL=yes + -DENABLE_PUSH=yes + -DENABLE_COMPRESSION=$(usex zlib) + -DENABLE_TESTING=$(usex test) + -DUSE_THIRDPARTY_LIBRARIES=OFF + ) + + cmake_src_configure +} |