1 |
commit: 7176900df615d6a2fa846736f76cc3df90b51f5c |
2 |
Author: William Breathitt Gray <vilhelm.gray <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Sep 8 13:41:16 2020 +0000 |
4 |
Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 13 06:01:04 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7176900d |
7 |
|
8 |
dev-cpp/prometheus-cpp: Add patch to skip test if locale not available |
9 |
|
10 |
Closes: https://bugs.gentoo.org/741040 |
11 |
Signed-off-by: William Breathitt Gray <vilhelm.gray <AT> gmail.com> |
12 |
Closes: https://github.com/gentoo/gentoo/pull/17466 |
13 |
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org> |
14 |
|
15 |
...erialization-test-if-locale-is-not-availa.patch | 80 ++++++++++++++++++++++ |
16 |
dev-cpp/prometheus-cpp/prometheus-cpp-0.9.0.ebuild | 4 ++ |
17 |
2 files changed, 84 insertions(+) |
18 |
|
19 |
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 |
20 |
new file mode 100644 |
21 |
index 00000000000..ced0b80e83e |
22 |
--- /dev/null |
23 |
+++ b/dev-cpp/prometheus-cpp/files/prometheus-cpp-0.9.0-core-Skip-serialization-test-if-locale-is-not-availa.patch |
24 |
@@ -0,0 +1,80 @@ |
25 |
+From bf6e2ce56abe2a710181f0365a21ca2dafd2a8f5 Mon Sep 17 00:00:00 2001 |
26 |
+From: Gregor Jasny <gjasny@××××××××××.com> |
27 |
+Date: Fri, 13 Mar 2020 13:16:56 +0100 |
28 |
+Subject: [PATCH] core: Skip serialization test if locale is not available |
29 |
+ |
30 |
+Closes: #345 |
31 |
+--- |
32 |
+ core/tests/raii_locale.h | 15 +++++++++++++++ |
33 |
+ core/tests/serializer_test.cc | 21 ++++++++++++++------- |
34 |
+ 2 files changed, 29 insertions(+), 7 deletions(-) |
35 |
+ create mode 100644 core/tests/raii_locale.h |
36 |
+ |
37 |
+diff --git a/core/tests/raii_locale.h b/core/tests/raii_locale.h |
38 |
+new file mode 100644 |
39 |
+index 0000000..592d74f |
40 |
+--- /dev/null |
41 |
++++ b/core/tests/raii_locale.h |
42 |
+@@ -0,0 +1,15 @@ |
43 |
++#pragma once |
44 |
++ |
45 |
++#include <locale> |
46 |
++ |
47 |
++class RAIILocale { |
48 |
++ public: |
49 |
++ RAIILocale(const char* name) : savedLocale_(std::locale::classic()) { |
50 |
++ std::locale::global(std::locale(name)); |
51 |
++ } |
52 |
++ |
53 |
++ ~RAIILocale() { std::locale::global(savedLocale_); } |
54 |
++ |
55 |
++ private: |
56 |
++ const std::locale savedLocale_; |
57 |
++}; |
58 |
+diff --git a/core/tests/serializer_test.cc b/core/tests/serializer_test.cc |
59 |
+index f935a3b..6cb8f0e 100644 |
60 |
+--- a/core/tests/serializer_test.cc |
61 |
++++ b/core/tests/serializer_test.cc |
62 |
+@@ -1,9 +1,13 @@ |
63 |
+ #include "prometheus/counter.h" |
64 |
++#include "prometheus/detail/future_std.h" |
65 |
+ #include "prometheus/family.h" |
66 |
+ #include "prometheus/text_serializer.h" |
67 |
+ |
68 |
++#include "raii_locale.h" |
69 |
++ |
70 |
+ #include <gmock/gmock.h> |
71 |
+-#include <locale> |
72 |
++ |
73 |
++#include <memory> |
74 |
+ #include <sstream> |
75 |
+ |
76 |
+ namespace prometheus { |
77 |
+@@ -25,15 +29,18 @@ class SerializerTest : public testing::Test { |
78 |
+ |
79 |
+ #ifndef _WIN32 |
80 |
+ TEST_F(SerializerTest, shouldSerializeLocaleIndependent) { |
81 |
+- // save and change locale |
82 |
+- const std::locale oldLocale = std::locale::classic(); |
83 |
+- std::locale::global(std::locale("de_DE.UTF-8")); |
84 |
++ std::unique_ptr<RAIILocale> localeWithCommaDecimalSeparator; |
85 |
++ |
86 |
++ // ignore missing locale and skip test if setup fails |
87 |
++ try { |
88 |
++ localeWithCommaDecimalSeparator = |
89 |
++ detail::make_unique<RAIILocale>("de_DE.UTF-8"); |
90 |
++ } catch (std::runtime_error&) { |
91 |
++ GTEST_SKIP(); |
92 |
++ } |
93 |
+ |
94 |
+ const auto serialized = textSerializer.Serialize(collected); |
95 |
+ EXPECT_THAT(serialized, testing::HasSubstr("1.0")); |
96 |
+- |
97 |
+- // restore locale |
98 |
+- std::locale::global(oldLocale); |
99 |
+ } |
100 |
+ #endif |
101 |
+ |
102 |
+-- |
103 |
+2.28.0 |
104 |
+ |
105 |
|
106 |
diff --git a/dev-cpp/prometheus-cpp/prometheus-cpp-0.9.0.ebuild b/dev-cpp/prometheus-cpp/prometheus-cpp-0.9.0.ebuild |
107 |
index 3cd75592159..75d66bcbc3d 100644 |
108 |
--- a/dev-cpp/prometheus-cpp/prometheus-cpp-0.9.0.ebuild |
109 |
+++ b/dev-cpp/prometheus-cpp/prometheus-cpp-0.9.0.ebuild |
110 |
@@ -26,6 +26,10 @@ DEPEND="${RDEPEND} |
111 |
dev-cpp/gtest |
112 |
)" |
113 |
|
114 |
+PATCHES=( |
115 |
+ "${FILESDIR}/${P}-core-Skip-serialization-test-if-locale-is-not-availa.patch" |
116 |
+) |
117 |
+ |
118 |
src_configure() { |
119 |
local mycmakeargs=( |
120 |
-DENABLE_PULL=yes |