Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libprotobuf v5.26.0 #213

Merged
merged 5 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# keep this without major version to let the bot pick it up
{% set version = "25.3" %}
{% set version = "26.0" %}
# protobuf doesn't add the major version in the tag, it's defined per language in
# https://github.com/protocolbuffers/protobuf/blob/main/version.json
{% set major = "4" %}
{% set major = "5" %}
# pkg-config metadata sets yet another version format, not using the major version
# but adding the rc number as a patch version, or 0 for regular releases
Comment on lines +6 to +7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some documentation about it somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea TBH, would need some digging upstream; I just observed it while building the release candidates and put 2+2 together 😅

Copy link
Member

@jjerphan jjerphan Mar 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this behavior of pkg-config dangerous. 👀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure it's the way protobuf has set up their metadata; in any case, we're doing exact matches on the versions (according to the pkg-config metadata) in the testing here, so I'm not too worried.

{% set pkgconfig_ver = version.split(".")[0] ~ "." ~ version.split(".")[1] %}
{% if version.split(".")[-1].startswith("rc") %}
{% set pkgconfig_ver = pkgconfig_ver ~ "." ~ version.split(".")[-1].replace("rc", "") %}
{% else %}
{% set pkgconfig_ver = pkgconfig_ver ~ "." ~ "0" %}
{% endif %}

{% set libraries = ["libprotoc", "libprotobuf", "libprotobuf-lite"] %}

Expand All @@ -12,23 +20,21 @@ package:

source:
- url: https://github.com/protocolbuffers/protobuf/archive/refs/tags/v{{ version.replace(".rc", "-rc") }}.tar.gz
sha256: d19643d265b978383352b3143f04c0641eea75a75235c111cc01a1350173180e
sha256: e32100a8013870d24ffc37dad6781a61e5d0c99501bcb04d39c340a1c44a8e63
patches:
- patches/0001-use-consistent-cmake-location.patch
- patches/0002-set-static-lib-extension-on-windows.patch
- patches/0003-always-look-for-shared-abseil-builds.patch
# grpc_cpp_java_plugin links against otherwise internal symbols
- patches/0004-Export-functions-in-google-compiler-java-names.patch
- patches/0005-do-not-install-vendored-gmock.patch
# backport https://github.com/protocolbuffers/protobuf/pull/15518
- patches/0006-Fix-getting-env-variables-on-windows.patch
# backport https://github.com/protocolbuffers/protobuf/commit/f78f9c51fa2470070e5d4b49649800971c789224
- patches/0007-Workaround-false-positive-warning-in-MSVC.-Fixes-htt.patch
# backport https://github.com/protocolbuffers/protobuf/pull/15888
- patches/0008-fix-pkg-config-metadata-for-shared-abseil-on-windows.patch
- patches/0006-fix-pkg-config-metadata-for-shared-abseil-on-windows.patch
# skip annoyingly flaky test on windows, see
# https://github.com/protocolbuffers/protobuf/issues/8645
- patches/0009-disable-MapImplTest.RandomOrdering-due-to-flakiness.patch # [win]
- patches/0007-disable-MapImplTest.RandomOrdering-due-to-flakiness.patch # [win]
# backport https://github.com/protocolbuffers/protobuf/pull/16231
- patches/0008-Fix-windows-only-issue-in-our-compiler-unittests.patch

build:
number: 0
Expand Down Expand Up @@ -94,8 +100,8 @@ outputs:
- if not exist %LIBRARY_LIB%\cmake\protobuf\protobuf-config.cmake exit 1 # [win]

# pkg-config
- pkg-config --print-errors --exact-version "{{ version }}.0" protobuf
- pkg-config --print-errors --exact-version "{{ version }}.0" protobuf-lite
- pkg-config --print-errors --exact-version "{{ pkgconfig_ver }}" protobuf
- pkg-config --print-errors --exact-version "{{ pkgconfig_ver }}" protobuf-lite

# binary
- protoc --help
Expand Down
8 changes: 4 additions & 4 deletions recipe/patches/0001-use-consistent-cmake-location.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From df4354948bbcf18e6a41fc5743724fe85b166bc2 Mon Sep 17 00:00:00 2001
From d8881312b1307f5b4c4c2576e3512e68290af874 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Sat, 3 Sep 2022 19:48:04 +0200
Subject: [PATCH 1/9] use consistent cmake location
Subject: [PATCH 1/8] use consistent cmake location

---
cmake/install.cmake | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/cmake/install.cmake b/cmake/install.cmake
index 9679d5b26..c4757f06c 100644
index 52914a8ea..5d89a5f5f 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -96,15 +96,9 @@ set(_install_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the c
@@ -98,15 +98,9 @@ set(_install_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the c
set(_build_cmakedir_desc "Directory relative to CMAKE_CURRENT_BINARY_DIR for cmake configuration files")
set(_exampledir_desc "Directory relative to CMAKE_INSTALL_DATA to install examples")
set(_protobuf_subdir_desc "Subdirectory in which to install cmake configuration files")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 6137fefd543de0aca634ef820f83f7e9d6e6f075 Mon Sep 17 00:00:00 2001
From 22e5509651b5e084698703390063abeae73a6b9f Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Sun, 4 Sep 2022 10:57:08 +0200
Subject: [PATCH 2/9] set static lib extension on windows
Subject: [PATCH 2/8] set static lib extension on windows

---
CMakeLists.txt | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 162fb1c72..1f175c416 100644
index 06906417a..b6383b767 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -326,6 +326,12 @@ else ()
@@ -328,6 +328,12 @@ else ()
endif ()
endif ()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From ce158be9e2ae9baed2a31ed978c2f33c567c01c4 Mon Sep 17 00:00:00 2001
From 76e73d4d94848a13bfef089dfc505e2ad0263444 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Sat, 13 May 2023 22:43:45 +1100
Subject: [PATCH 3/9] always look for shared abseil builds
Subject: [PATCH 3/8] always look for shared abseil builds

---
cmake/abseil-cpp.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmake/abseil-cpp.cmake b/cmake/abseil-cpp.cmake
index b50fb89e6..b07e63f26 100644
index a4e9d2295..b3ad53528 100644
--- a/cmake/abseil-cpp.cmake
+++ b/cmake/abseil-cpp.cmake
@@ -37,7 +37,7 @@ elseif(protobuf_ABSL_PROVIDER STREQUAL "package")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From b4ad926042037d3f40604bf7fa617f49cb426399 Mon Sep 17 00:00:00 2001
From 0d41978988135d0c3d1000740cd16ddc3ef0e143 Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <uwe.korn@quantco.com>
Date: Wed, 14 Jun 2023 11:36:55 +0200
Subject: [PATCH 4/9] Export functions in google::compiler::java::names
Subject: [PATCH 4/8] Export functions in google::compiler::java::names

---
src/google/protobuf/compiler/java/names.h | 20 ++++++++++----------
Expand Down
8 changes: 4 additions & 4 deletions recipe/patches/0005-do-not-install-vendored-gmock.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 8e04212bac883743aea9e19e77976f44ffdb5ad6 Mon Sep 17 00:00:00 2001
From 1fa22abd2038cd9d40648f5fe9faca8490b6e045 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Wed, 9 Aug 2023 14:06:35 +1100
Subject: [PATCH 5/9] do not install vendored gmock
Subject: [PATCH 5/8] do not install vendored gmock

---
cmake/install.cmake | 7 -------
1 file changed, 7 deletions(-)

diff --git a/cmake/install.cmake b/cmake/install.cmake
index c4757f06c..f68ec217b 100644
index 5d89a5f5f..b516cbab2 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -136,10 +136,3 @@ if(protobuf_INSTALL_EXAMPLES)
@@ -138,10 +138,3 @@ if(protobuf_INSTALL_EXAMPLES)
DESTINATION "${CMAKE_INSTALL_EXAMPLEDIR}"
COMPONENT protobuf-examples)
endif()
Expand Down
28 changes: 0 additions & 28 deletions recipe/patches/0006-Fix-getting-env-variables-on-windows.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From c0759889e6f5a9899532e54bde8232564a1ff8dc Mon Sep 17 00:00:00 2001
From 569c7cc8c2def75473921b883682da1f33269d8d Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Tue, 20 Feb 2024 20:27:36 +1100
Subject: [PATCH 8/9] fix pkg-config metadata for shared abseil on windows
Subject: [PATCH 6/8] fix pkg-config metadata for shared abseil on windows

---
cmake/install.cmake | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cmake/install.cmake b/cmake/install.cmake
index f68ec217b..60871aab9 100644
index b516cbab2..ee772b461 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -1,7 +1,10 @@
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
From 02bcda9d01dd12ecf641dba54e0832a97de989f5 Mon Sep 17 00:00:00 2001
From a43d86c561c6094f02d5e3b5a1b8d14539cd32fa Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Tue, 20 Feb 2024 22:21:55 +1100
Subject: [PATCH 9/9] disable MapImplTest.RandomOrdering due to flakiness
Subject: [PATCH 7/8] disable MapImplTest.RandomOrdering due to flakiness

see https://google.github.io/googletest/advanced.html#temporarily-disabling-tests
---
src/google/protobuf/map_test.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/google/protobuf/map_test.inc b/src/google/protobuf/map_test.inc
index c1b002987..34d45f44d 100644
index cbd0f4461..2a58cc92a 100644
--- a/src/google/protobuf/map_test.inc
+++ b/src/google/protobuf/map_test.inc
@@ -1344,7 +1344,7 @@ bool MapOrderingIsRandom(int a, int b) {
@@ -1349,7 +1349,7 @@ bool MapOrderingIsRandom(int a, int b) {

// This test verifies that the iteration order is reasonably random even for
// small maps.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
From a4ad52b7abda09ec071145cb7253cc1993899295 Mon Sep 17 00:00:00 2001
From: Mike Kruskal <mkruskal@google.com>
Date: Tue, 19 Mar 2024 14:47:35 -0700
Subject: [PATCH 8/8] Fix windows-only issue in our compiler unittests.

Closes https://github.com/protocolbuffers/protobuf/issues/16026

PiperOrigin-RevId: 617301270
---
.../protobuf/compiler/mock_code_generator.cc | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/google/protobuf/compiler/mock_code_generator.cc b/src/google/protobuf/compiler/mock_code_generator.cc
index 665262d71..7c8912631 100644
--- a/src/google/protobuf/compiler/mock_code_generator.cc
+++ b/src/google/protobuf/compiler/mock_code_generator.cc
@@ -50,6 +50,7 @@
namespace google {
namespace protobuf {
namespace compiler {
+namespace {

// Returns the list of the names of files in all_files in the form of a
// comma-separated string.
@@ -71,14 +72,20 @@ static constexpr absl::string_view kFirstInsertionPoint =
static constexpr absl::string_view kSecondInsertionPoint =
" # @@protoc_insertion_point(second_mock_insertion_point) is here\n";

-MockCodeGenerator::MockCodeGenerator(absl::string_view name) : name_(name) {
+absl::string_view GetTestCase() {
const char* c_key = getenv("TEST_CASE");
if (c_key == NULL) {
// In Windows, setting 'TEST_CASE=' is equivalent to unsetting
- // and therefore c_key can be NULL
- c_key = "";
+ // and therefore c_key can be nullptr
+ return "";
}
- absl::string_view key(c_key);
+ return c_key;
+}
+
+} // namespace
+
+MockCodeGenerator::MockCodeGenerator(absl::string_view name) : name_(name) {
+ absl::string_view key = GetTestCase();
if (key == "no_editions") {
suppressed_features_ |= CodeGenerator::FEATURE_SUPPORTS_EDITIONS;
} else if (key == "invalid_features") {
@@ -214,7 +221,7 @@ bool MockCodeGenerator::Generate(const FileDescriptor* file,
std::string* error) const {
// Override minimum/maximum after generating the pool to simulate a plugin
// that "works" but doesn't advertise support of the current edition.
- absl::string_view test_case = getenv("TEST_CASE");
+ absl::string_view test_case = GetTestCase();
if (test_case == "high_minimum") {
minimum_edition_ = Edition::EDITION_99997_TEST_ONLY;
} else if (test_case == "low_maximum") {