summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongju Chae <dongju.chae@samsung.com>2020-11-27 13:06:36 +0900
committerDongju Chae <dongju.chae@samsung.com>2020-11-27 16:02:41 +0900
commit9b66d922bdade05f9d3e7b135a0cd968caaad83a (patch)
tree8ed34d7ce6bd52e0284f9e773c0015c9cb6b94e2
parent1bfa4ddaa8e39fc6b50f8b8e359aa0c32ef8ced1 (diff)
downloadflatbuffers-9b66d922bdade05f9d3e7b135a0cd968caaad83a.tar.gz
flatbuffers-9b66d922bdade05f9d3e7b135a0cd968caaad83a.tar.bz2
flatbuffers-9b66d922bdade05f9d3e7b135a0cd968caaad83a.zip
This patch fixes out-of-sync in flatbuffer's gRPC support. The inferface between gRPC and flatbuf has been broken since gRPC 1.17. This problem comes from that gRPC decided to hide its internal byte buffer. (e.g., gRPC::ByteBuffer contains grpc_byte_buffer, but not exposed) As the version of gRPC is already 1.20.1 in tizen upstream, I want to directly fix the glue header in flatbuffers by applying this workaround patch. Related issues: - https://github.com/google/flatbuffers/issues/5836 - https://github.com/google/flatbuffers/issues/5096 - https://github.com/grpc/grpc/issues/20594 Change-Id: Ia4149826cc74c690fbc48d07c3141d2221c718f6 Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
-rw-r--r--debian/changelog6
-rw-r--r--debian/control2
-rw-r--r--debian/format1
-rw-r--r--debian/patches/0001-gRPC-Fix-out-of-sync-in-gRPC-support.patch41
-rw-r--r--debian/patches/series1
-rwxr-xr-xdebian/rules2
-rw-r--r--packaging/0001-gRPC-Fix-out-of-sync-in-gRPC-support.patch41
-rw-r--r--packaging/flatbuffers.spec5
8 files changed, 97 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index f7befddd..b3e22e6d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+flatbuffers (1.12.0-4) unstable; urgency=medium
+
+ * Apply the patch file to fix out-of-sync with gRPC
+
+ -- Dongju Chae <dongju.chae@samsung.com> Fri, 27 Nov 2020 16:37:00 +0900
+
flatbuffers (1.12.0-3) unstable; urgency=medium
* Include flatbuffers.pc to the dev-kit package
diff --git a/debian/control b/debian/control
index 8ad479b4..b9564a0f 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,7 @@
Source: flatbuffers
Section: libdevel
Priority: optional
-Build-Depends: debhelper (>=9), cmake,
+Build-Depends: debhelper (>=9), cmake, quilt,
gcc-9 | gcc-8 | gcc-7 | gcc-6 | gcc-5 (>>5.4)
Maintainer: Wook Song <wook16.song@samsung.com>
Standards-Version: 3.6.1
diff --git a/debian/format b/debian/format
new file mode 100644
index 00000000..89ae9db8
--- /dev/null
+++ b/debian/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/debian/patches/0001-gRPC-Fix-out-of-sync-in-gRPC-support.patch b/debian/patches/0001-gRPC-Fix-out-of-sync-in-gRPC-support.patch
new file mode 100644
index 00000000..daf0eebc
--- /dev/null
+++ b/debian/patches/0001-gRPC-Fix-out-of-sync-in-gRPC-support.patch
@@ -0,0 +1,41 @@
+--- a/include/flatbuffers/grpc.h
++++ b/include/flatbuffers/grpc.h
+@@ -268,6 +268,21 @@ class MessageBuilder : private detail::S
+ } // namespace grpc
+ } // namespace flatbuffers
+
++// This is a horrible hack to get internal grpc_byte_buffer. Remove later.
++namespace grpc {
++namespace internal {
++ class GrpcByteBufferPeer {
++ public:
++ static void setBuffer(grpc::ByteBuffer* dest, grpc_byte_buffer* p) {
++ dest->set_buffer(p);
++ }
++ static grpc_byte_buffer** getBufferPtr(grpc::ByteBuffer* buf) {
++ return buf->c_buffer_ptr();
++ }
++ };
++} // namespace internal
++} // namespace grpc
++
+ namespace grpc {
+
+ template<class T> class SerializationTraits<flatbuffers::grpc::Message<T>> {
+@@ -323,6 +338,16 @@ template<class T> class SerializationTra
+ }
+ #endif
+ }
++
++ // A workaround to sync the interface between flatbuffers and gRPC
++ static grpc::Status Deserialize(ByteBuffer *buffer,
++ flatbuffers::grpc::Message<T> *msg) {
++ return Deserialize(*(grpc::internal::GrpcByteBufferPeer::getBufferPtr(buffer)), msg);
++ }
++ static grpc::Status Deserialize(ByteBuffer::ByteBufferPointer p,
++ flatbuffers::grpc::Message<T> *msg) {
++ return Deserialize((grpc_byte_buffer*)(p), msg);
++ }
+ };
+
+ } // namespace grpc
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 00000000..9ce32910
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-gRPC-Fix-out-of-sync-in-gRPC-support.patch
diff --git a/debian/rules b/debian/rules
index fa699795..624c1833 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,7 +18,7 @@ export DEB_CMAKE_EXTRA_FLAGS += -DFLATBUFFERS_INSTALL=ON \
-DCMAKE_BUILD_TYPE=Release
%:
- dh $@ --parallel --buildsystem=cmake
+ dh $@ --with quilt --parallel --buildsystem=cmake
override_dh_auto_configure:
dh_auto_configure -- $(DEB_CMAKE_EXTRA_FLAGS)
diff --git a/packaging/0001-gRPC-Fix-out-of-sync-in-gRPC-support.patch b/packaging/0001-gRPC-Fix-out-of-sync-in-gRPC-support.patch
new file mode 100644
index 00000000..daf0eebc
--- /dev/null
+++ b/packaging/0001-gRPC-Fix-out-of-sync-in-gRPC-support.patch
@@ -0,0 +1,41 @@
+--- a/include/flatbuffers/grpc.h
++++ b/include/flatbuffers/grpc.h
+@@ -268,6 +268,21 @@ class MessageBuilder : private detail::S
+ } // namespace grpc
+ } // namespace flatbuffers
+
++// This is a horrible hack to get internal grpc_byte_buffer. Remove later.
++namespace grpc {
++namespace internal {
++ class GrpcByteBufferPeer {
++ public:
++ static void setBuffer(grpc::ByteBuffer* dest, grpc_byte_buffer* p) {
++ dest->set_buffer(p);
++ }
++ static grpc_byte_buffer** getBufferPtr(grpc::ByteBuffer* buf) {
++ return buf->c_buffer_ptr();
++ }
++ };
++} // namespace internal
++} // namespace grpc
++
+ namespace grpc {
+
+ template<class T> class SerializationTraits<flatbuffers::grpc::Message<T>> {
+@@ -323,6 +338,16 @@ template<class T> class SerializationTra
+ }
+ #endif
+ }
++
++ // A workaround to sync the interface between flatbuffers and gRPC
++ static grpc::Status Deserialize(ByteBuffer *buffer,
++ flatbuffers::grpc::Message<T> *msg) {
++ return Deserialize(*(grpc::internal::GrpcByteBufferPeer::getBufferPtr(buffer)), msg);
++ }
++ static grpc::Status Deserialize(ByteBuffer::ByteBufferPointer p,
++ flatbuffers::grpc::Message<T> *msg) {
++ return Deserialize((grpc_byte_buffer*)(p), msg);
++ }
+ };
+
+ } // namespace grpc
diff --git a/packaging/flatbuffers.spec b/packaging/flatbuffers.spec
index 1e6eed6f..8ba227d8 100644
--- a/packaging/flatbuffers.spec
+++ b/packaging/flatbuffers.spec
@@ -7,6 +7,7 @@ Packager: Parichay Kapoor <pk.kapoor@samsung.com>
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.manifest
+Source2: 0001-gRPC-Fix-out-of-sync-in-gRPC-support.patch
BuildRequires: cmake
BuildRequires: gcc-c++
@@ -28,6 +29,7 @@ This package provides headers and other miscellaneous files required to use flat
%prep
%setup -q
cp %{SOURCE1} .
+%{__patch} -p1 < %{SOURCE2}
%build
export CFLAGS+=" -fno-lto"
@@ -77,6 +79,9 @@ sed -i 's#@includedir@#%{_includedir}#g' %{buildroot}%{_libdir}/pkgconfig/%{name
%{_libdir}/pkgconfig/flatbuffers.pc
%changelog
+* Fri Nov 27 2020 Dongju Chae <wook16.song@samsung.com>
+- Apply the patch file to fix out-of-sync with gRPC
+
* Tue Sep 15 2020 Wook Song <wook16.song@samsung.com>
- Add the pkg-config file to the dev-kit package