Skip to content

Commit

Permalink
patch to use Base64Escape from abseil, not protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed May 27, 2023
1 parent a2bca30 commit 3528fcf
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 2 deletions.
1 change: 1 addition & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ source:
patches:
- patches/0001-cross_compile_grpc_cpp_plugin_path.patch # [build_platform != target_platform]
- patches/0002-add-missing-shared-library-dependencies.patch
- patches/0003-use-Base64Escape-from-abseil.patch # [libprotobuf != "3.21"]

build:
number: 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 863fcc27b2d95b3ba99e166eeebf154d66eea434 Mon Sep 17 00:00:00 2001
From: David Li <li.davidm96@gmail.com>
Date: Tue, 14 Dec 2021 15:47:51 -0500
Subject: [PATCH 1/2] cross_compile_grpc_cpp_plugin_path
Subject: [PATCH 1/3] cross_compile_grpc_cpp_plugin_path

---
cmake/opentelemetry-proto.cmake | 17 +++++++----------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 7333b54233024442aa0cf36b0b9dc0400ccb7a31 Mon Sep 17 00:00:00 2001
From: Will Jones <willjones127@gmail.com>
Date: Tue, 18 Apr 2023 11:52:23 -0700
Subject: [PATCH 2/2] add missing shared library dependencies
Subject: [PATCH 2/3] add missing shared library dependencies

Co-Authored-By: H. Vetinari <h.vetinari@gmx.com>
---
Expand Down
58 changes: 58 additions & 0 deletions recipe/patches/0003-use-Base64Escape-from-abseil.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
From 9ed8306106cffe0c52083778532920a65d25750d Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Sat, 27 May 2023 02:51:30 +1100
Subject: [PATCH 3/3] use Base64Escape from abseil

has been removed from protobuf
---
exporters/otlp/src/otlp_http_client.cc | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/exporters/otlp/src/otlp_http_client.cc b/exporters/otlp/src/otlp_http_client.cc
index 5cbc6595..0362c999 100644
--- a/exporters/otlp/src/otlp_http_client.cc
+++ b/exporters/otlp/src/otlp_http_client.cc
@@ -14,25 +14,11 @@

#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h"

+#include "absl/strings/escaping.h"
#include "google/protobuf/message.h"
#include "google/protobuf/reflection.h"
-#include "google/protobuf/stubs/common.h"
-#include "google/protobuf/stubs/stringpiece.h"
#include "nlohmann/json.hpp"

-#if defined(GOOGLE_PROTOBUF_VERSION) && GOOGLE_PROTOBUF_VERSION >= 3007000
-# include "google/protobuf/stubs/strutil.h"
-#else
-# include "google/protobuf/stubs/port.h"
-namespace google
-{
-namespace protobuf
-{
-LIBPROTOBUF_EXPORT void Base64Escape(StringPiece src, std::string *dest);
-} // namespace protobuf
-} // namespace google
-#endif
-
#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h"

#include "opentelemetry/common/timestamp.h"
@@ -414,14 +400,14 @@ static std::string BytesMapping(const std::string &bytes,
else
{
std::string base64_value;
- google::protobuf::Base64Escape(bytes, &base64_value);
+ absl::Base64Escape(bytes, &base64_value);
return base64_value;
}
}
case JsonBytesMappingKind::kBase64: {
// Base64 is the default bytes mapping of protobuf
std::string base64_value;
- google::protobuf::Base64Escape(bytes, &base64_value);
+ absl::Base64Escape(bytes, &base64_value);
return base64_value;
}
case JsonBytesMappingKind::kHex:

0 comments on commit 3528fcf

Please sign in to comment.