third_party: update chromite's vendored protbuf 3.13 --> 4.21.9
The current copy is from 2020-08 and needs updating so that protos
can remain idiomatic (e.g., use of the "optional" keyword). Advancing
takes advantage of other optimizations.
4.21.9 matches the current version available in the SDK, and supports
the "optional" keyword as well as generation of type annotations.
To use it, compile_build_api_proto.py is updated to pull protoc from a
new CIPD prefix at infra/3pp/tools/protoc, which is regularly updated.
The "fork" is patched to use chromite import paths, with the only
other change a tweak to internal/api_implementation.py to ensure it
does not look for compiled implementations from system site packages.
Patchset 1: https://github.com/protocolbuffers/protobuf/tree/v21.9/python/google/protobuf
Patchset 2: sed -i -re 's/( *)from google\.protobuf/\1from chromite.third_party.google.protobuf/'
Patchset 3: point compile_build_api_proto to 4.21.9 at new CIPD prefix + regenerate
Patchset 6: fix errors picked up in ./run_tests (version check, api_implementation)
Onwards: Rebasing (regenerate at @5b48513b1), CL description updates
BUG=b:293226674
TEST=CQ
Change-Id: If557e07962eee3f75d113c49b065fe9fb9cef9bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4718152
Reviewed-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Tested-by: Trent Apted <tapted@chromium.org>
diff --git a/api/compile_build_api_proto_unittest.py b/api/compile_build_api_proto_unittest.py
index a829c6d..db61d53 100644
--- a/api/compile_build_api_proto_unittest.py
+++ b/api/compile_build_api_proto_unittest.py
@@ -23,7 +23,10 @@
TODO: Investigate using protobuf.__version__ instead of hard coding a
version in compile_build_api_proto.
"""
- assert compile_build_api_proto.PROTOC_VERSION == protobuf.__version__, (
+ assert (
+ f"{compile_build_api_proto.PROTOC_MAJOR_VERSION}."
+ f"{compile_build_api_proto.PROTOC_VERSION}"
+ ) == protobuf.__version__, (
"The protobuf library or compile_build_api_proto.PROTOC_VERSION has "
"been updated, but the other has not. They must be updated together."
)