From 4663db7d19804a444c2033aff318702e76a1e1dc Mon Sep 17 00:00:00 2001 From: Wong Hoi Sing Edison Date: Tue, 13 Feb 2024 14:59:45 +0800 Subject: [PATCH] alvistack/v3.19.6 git clean -xdf git submodule sync --recursive git submodule update --init --recursive git submodule foreach git checkout -- . tar zcvf ../protobuf_3.19.6.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.19.6-1.spec cp ../*protobuf*3.19.6*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ cp _constraints /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ rm -rf ../*proto*3.19.6*.* See https://github.com/protocolbuffers/protobuf/pull/10403 See https://github.com/protocolbuffers/protobuf/pull/12331 Signed-off-by: Wong Hoi Sing Edison --- .gitignore | 91 +++--- _constraints | 12 + debian/.gitignore | 13 + debian/changelog | 5 + debian/control | 125 ++++++++ debian/copyright | 21 ++ debian/libprotobuf-dev.install | 5 + debian/libprotobuf-dev.lintian-overrides | 3 + debian/libprotobuf-lite32t64.install | 1 + .../libprotobuf-lite32t64.lintian-overrides | 4 + debian/libprotobuf32t64.install | 1 + debian/libprotobuf32t64.lintian-overrides | 4 + debian/libprotoc-dev.install | 2 + debian/libprotoc-dev.lintian-overrides | 3 + debian/libprotoc32t64.install | 1 + debian/libprotoc32t64.lintian-overrides | 4 + debian/protobuf-compiler.install | 1 + debian/protobuf-compiler.lintian-overrides | 4 + debian/python3-protobuf.install | 1 + debian/python3-protobuf.lintian-overrides | 4 + debian/rules | 60 ++++ debian/source/format | 1 + debian/source/lintian-overrides | 7 + protobuf.spec | 283 ++++++++++++++++++ python/google/protobuf/pyext/descriptor.cc | 65 +++- src/Makefile.am | 8 +- src/libprotobuf-lite.map | 2 + src/libprotobuf.map | 2 + src/libprotoc.map | 2 + 29 files changed, 686 insertions(+), 49 deletions(-) create mode 100644 _constraints create mode 100644 debian/.gitignore create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/libprotobuf-dev.install create mode 100644 debian/libprotobuf-dev.lintian-overrides create mode 100644 debian/libprotobuf-lite32t64.install create mode 100644 debian/libprotobuf-lite32t64.lintian-overrides create mode 100644 debian/libprotobuf32t64.install create mode 100644 debian/libprotobuf32t64.lintian-overrides create mode 100644 debian/libprotoc-dev.install create mode 100644 debian/libprotoc-dev.lintian-overrides create mode 100644 debian/libprotoc32t64.install create mode 100644 debian/libprotoc32t64.lintian-overrides create mode 100644 debian/protobuf-compiler.install create mode 100644 debian/protobuf-compiler.lintian-overrides create mode 100644 debian/python3-protobuf.install create mode 100644 debian/python3-protobuf.lintian-overrides create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/source/lintian-overrides create mode 100644 protobuf.spec diff --git a/.gitignore b/.gitignore index b9d795ce4cd4..5be90318e967 100644 --- a/.gitignore +++ b/.gitignore @@ -1,29 +1,24 @@ -# autogen.sh-generated files -Makefile.in -src/Makefile.in -config.guess -config.h.in -config.sub -configure -depcomp -install-sh -ltmain.sh -missing - -aclocal.m4 -m4/libtool.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/ltversion.m4 -m4/lt~obsolete.m4 -autom4te.cache +# CMake-generated files +.ninja_deps +.ninja_logs +cmake/protobuf/*.cmake +cmake_install.cmake +CMakeCache.txt +CTestTestfile.cmake +CMakeFiles/* +Testing/Temporary/* + +/core +/protoc +/test_plugin +/tests +/lite-test +/protoc-*.* # downloaded files /gmock # in-tree configure-generated files -Makefile -src/Makefile /config.h config.log config.status @@ -38,15 +33,15 @@ stamp-h1 *.o *.lo *.la -src/.libs *.so +*.a .dirstamp any_test.pb.* map*unittest.pb.* unittest*.pb.* -cpp_test*.pb.* +src/google/protobuf/compiler/cpp/test*.pb.* src/google/protobuf/util/**/*.pb.cc src/google/protobuf/util/**/*.pb.h @@ -60,8 +55,6 @@ python/build/ python/docs/_build/ src/js_embed -src/protoc -src/unittest_proto_middleman # vim generated *.swp @@ -89,6 +82,10 @@ java/**/*.iml # Windows native output. cmake/build build_msvc +# Directories suggested by cmake/README.md +/debug/ +/solution/ +/release/ # NuGet packages: we want the repository configuration, but not the # packages themselves. @@ -164,21 +161,6 @@ php/ext/google/protobuf/run-tests.php php/ext/google/protobuf/third_party/ vendor/ -# JavaScript artifacts -js/commonjs_out/ -js/compatibility_tests/v3.0.0/commonjs_out* -js/compatibility_tests/v3.0.0/protoc -js/compatibility_tests/v3.0.0/testproto_libs1.js -js/compatibility_tests/v3.0.0/testproto_libs1_new.js -js/compatibility_tests/v3.0.0/testproto_libs2.js -js/compatibility_tests/v3.0.0/testproto_libs2_new.js -js/deps.js -js/google-protobuf.js -js/google/ -js/node_modules/ -js/testproto_libs1.js -js/testproto_libs2.js - # Ignore the bazel symlinks /bazel-* @@ -192,10 +174,10 @@ ruby/tests/generated_code_proto2_pb.rb ruby/tests/multi_level_nesting_test_pb.rb ruby/tests/test_import_proto2_pb.rb ruby/tests/test_ruby_package_proto2_pb.rb -ruby/Gemfile.lock ruby/compatibility_tests/v3.0.0/protoc ruby/compatibility_tests/v3.0.0/tests/generated_code_pb.rb ruby/compatibility_tests/v3.0.0/tests/test_import_pb.rb +ruby/Gemfile.lock # IntelliJ CLion Config files and build output cmake/.idea @@ -215,5 +197,32 @@ _build/ .idea *.iml +# Eclipse +**/.settings +**/.project +**/.classpath + # BenchmarkDotNet BenchmarkDotNet.Artifacts/ + +# Clangd uses these common ephemeral files +.cache +compile_commands.json + +# Ignore GHA NodeJS files +.github/**/node_modules/ + +*.a +*.so* +src/*.a +src/*.so* +src/CMakeCache.txt +src/CMakeFiles +src/Makefile +src/cmake +src/cmake_install.cmake +src/install_manifest.txt +src/lib/ +src/options-pinned.h +src/protoc* +src/third_party diff --git a/_constraints b/_constraints new file mode 100644 index 000000000000..45f9ec8330e3 --- /dev/null +++ b/_constraints @@ -0,0 +1,12 @@ + + + kvm + + + 72 + + + 24 + + + diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 000000000000..cefb2ec10cae --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,13 @@ +*.substvars +*debhelper* +.debhelper +autoreconf.* +files +libprotobuf-dev +libprotobuf-lite32 +libprotobuf32 +libprotoc-dev +libprotoc32 +protobuf-compiler +python3-protobuf +tmp diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000000..780e83228c85 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +protobuf (100:3.19.6-1) UNRELEASED; urgency=medium + + * https://github.com/protocolbuffers/protobuf/releases/tag/v3.19.6 + + -- Wong Hoi Sing Edison Wed, 10 Jan 2024 12:06:51 +0800 diff --git a/debian/control b/debian/control new file mode 100644 index 000000000000..3fc7fc09ef01 --- /dev/null +++ b/debian/control @@ -0,0 +1,125 @@ +Source: protobuf +Section: devel +Priority: optional +Standards-Version: 4.5.0 +Maintainer: Wong Hoi Sing Edison +Homepage: https://github.com/protocolbuffers/protobuf/tags +Vcs-Browser: https://github.com/alvistack/protocolbuffers-protobuf +Vcs-Git: https://github.com/alvistack/protocolbuffers-protobuf.git +Build-Depends: + debhelper, + debhelper-compat (= 10), + dh-python, + cmake, + fdupes, + libabsl-dev, + python3-dev, + python3-setuptools, + zlib1g-dev, + +Package: libprotobuf32t64 +Architecture: amd64 +Section: libs +Description: protocol buffers C++ library + This package contains the runtime library needed for C++ applications. +Depends: + ${misc:Depends}, + ${shlibs:Depends}, +Provides: + ${t64:Provides}, +Replaces: + libprotobuf32, +Breaks: + cura-engine (<< 1:3.3.0-2.1+b1), + libarcus3 (<< 3.3.0-2), + libprotobuf32 (<< ${source:Version}), + +Package: libprotobuf-lite32t64 +Architecture: amd64 +Section: libs +Description: protocol buffers C++ library (lite version) + This package contains the runtime library needed for C++ applications whose + message definitions have the "lite runtime" optimization setting. +Depends: + ${misc:Depends}, + ${shlibs:Depends}, +Provides: + ${t64:Provides}, +Replaces: + libprotobuf-lite32, +Breaks: + libprotobuf-lite32 (<< ${source:Version}), + +Package: libprotobuf-dev +Architecture: amd64 +Section: libdevel +Description: protocol buffers C++ library (development files) and proto files + This package contains the development headers and static libraries needed for + writing C++ applications. Includes well known proto type files. +Depends: + ${misc:Depends}, + zlib1g-dev, + libprotobuf32t64 (= ${source:Version}), + libprotobuf-lite32t64 (= ${source:Version}), +Provides: + protobuf-api-32-0, +Breaks: + protobuf-compiler (<< ${source:Version}), + protobuf-compiler (>> ${source:Version}), + +Package: libprotoc32t64 +Architecture: amd64 +Multi-Arch: same +Section: libs +Description: protocol buffers compiler library + This package contains the runtime library needed for the protocol buffer + compiler. +Depends: + ${shlibs:Depends}, + ${misc:Depends}, +Provides: + ${t64:Provides}, +Replaces: + libprotoc32, +Breaks: + libprotoc32 (<< ${source:Version}), + +Package: libprotoc-dev +Architecture: amd64 +Section: libdevel +Description: protocol buffers compiler library (development files) + This package contains the development headers and static library needed for + writing protobuf compilers. +Depends: + ${misc:Depends}, + libprotobuf-dev (= ${source:Version}), + libprotoc32t64 (= ${source:Version}), +Replaces: + libprotobuf-dev (<< 2.1.0), +Breaks: + libprotobuf-dev (<< 2.1.0), + +Package: protobuf-compiler +Architecture: amd64 +Description: compiler for protocol buffer definition files + This package contains the protocol buffer compiler that is used for + translating from .proto files (containing the definitions) to the language + binding for the supported languages. +Depends: + ${shlibs:Depends}, + ${misc:Depends}, + libprotoc32t64 (= ${source:Version}), + +Package: python3-protobuf +Architecture: amd64 +Section: python +Description: Python 3 bindings for protocol buffers + This package contains the Python 3 bindings for the protocol buffers. You will + need the protoc tool (in the protobuf-compiler package) to compile your + definition to Python classes, and then the modules in this package will allow + you to use those classes in your programs. +Depends: + ${misc:Depends}, + ${python3:Depends}, + ${shlibs:Depends}, + python3, diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 000000000000..12900b4193ce --- /dev/null +++ b/debian/copyright @@ -0,0 +1,21 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: debian/* +Copyright: 2024 Wong Hoi Sing Edison +License: Apache-2.0 + +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + The complete text of the Apache version 2.0 license + can be found in "/usr/share/common-licenses/Apache-2.0". diff --git a/debian/libprotobuf-dev.install b/debian/libprotobuf-dev.install new file mode 100644 index 000000000000..17fc3f11bfec --- /dev/null +++ b/debian/libprotobuf-dev.install @@ -0,0 +1,5 @@ +usr/include +usr/lib/*/cmake/*/*.cmake +usr/lib/*/libprotobuf-lite.so +usr/lib/*/libprotobuf.so +usr/lib/*/pkgconfig/* diff --git a/debian/libprotobuf-dev.lintian-overrides b/debian/libprotobuf-dev.lintian-overrides new file mode 100644 index 000000000000..30fd66a144cf --- /dev/null +++ b/debian/libprotobuf-dev.lintian-overrides @@ -0,0 +1,3 @@ +libprotobuf-dev: copyright-without-copyright-notice +libprotobuf-dev: initial-upload-closes-no-bugs +libprotobuf-dev: zero-byte-file-in-doc-directory diff --git a/debian/libprotobuf-lite32t64.install b/debian/libprotobuf-lite32t64.install new file mode 100644 index 000000000000..45e00546a30a --- /dev/null +++ b/debian/libprotobuf-lite32t64.install @@ -0,0 +1 @@ +usr/lib/*/libprotobuf-lite.so.* diff --git a/debian/libprotobuf-lite32t64.lintian-overrides b/debian/libprotobuf-lite32t64.lintian-overrides new file mode 100644 index 000000000000..e1c58172abd4 --- /dev/null +++ b/debian/libprotobuf-lite32t64.lintian-overrides @@ -0,0 +1,4 @@ +libprotobuf-lite32t64: copyright-without-copyright-notice +libprotobuf-lite32t64: initial-upload-closes-no-bugs +libprotobuf-lite32t64: package-name-doesnt-match-sonames +libprotobuf-lite32t64: zero-byte-file-in-doc-directory diff --git a/debian/libprotobuf32t64.install b/debian/libprotobuf32t64.install new file mode 100644 index 000000000000..9ac8d247dccb --- /dev/null +++ b/debian/libprotobuf32t64.install @@ -0,0 +1 @@ +usr/lib/*/libprotobuf.so.* diff --git a/debian/libprotobuf32t64.lintian-overrides b/debian/libprotobuf32t64.lintian-overrides new file mode 100644 index 000000000000..f0ac27f43c2e --- /dev/null +++ b/debian/libprotobuf32t64.lintian-overrides @@ -0,0 +1,4 @@ +libprotobuf32t64: copyright-without-copyright-notice +libprotobuf32t64: initial-upload-closes-no-bugs +libprotobuf32t64: package-name-doesnt-match-sonames +libprotobuf32t64: zero-byte-file-in-doc-directory diff --git a/debian/libprotoc-dev.install b/debian/libprotoc-dev.install new file mode 100644 index 000000000000..899bb85fe3b0 --- /dev/null +++ b/debian/libprotoc-dev.install @@ -0,0 +1,2 @@ +usr/include/google/protobuf/compiler +usr/lib/*/libprotoc.so diff --git a/debian/libprotoc-dev.lintian-overrides b/debian/libprotoc-dev.lintian-overrides new file mode 100644 index 000000000000..f90c4d60db90 --- /dev/null +++ b/debian/libprotoc-dev.lintian-overrides @@ -0,0 +1,3 @@ +libprotoc-dev: copyright-without-copyright-notice +libprotoc-dev: initial-upload-closes-no-bugs +libprotoc-dev: zero-byte-file-in-doc-directory diff --git a/debian/libprotoc32t64.install b/debian/libprotoc32t64.install new file mode 100644 index 000000000000..a28013348f3f --- /dev/null +++ b/debian/libprotoc32t64.install @@ -0,0 +1 @@ +usr/lib/*/libprotoc*.so.* diff --git a/debian/libprotoc32t64.lintian-overrides b/debian/libprotoc32t64.lintian-overrides new file mode 100644 index 000000000000..418b60e8955c --- /dev/null +++ b/debian/libprotoc32t64.lintian-overrides @@ -0,0 +1,4 @@ +libprotoc32t64: copyright-without-copyright-notice +libprotoc32t64: initial-upload-closes-no-bugs +libprotoc32t64: package-name-doesnt-match-sonames +libprotoc32t64: zero-byte-file-in-doc-directory diff --git a/debian/protobuf-compiler.install b/debian/protobuf-compiler.install new file mode 100644 index 000000000000..1df36c612fb7 --- /dev/null +++ b/debian/protobuf-compiler.install @@ -0,0 +1 @@ +usr/bin/* diff --git a/debian/protobuf-compiler.lintian-overrides b/debian/protobuf-compiler.lintian-overrides new file mode 100644 index 000000000000..6f8cc4457901 --- /dev/null +++ b/debian/protobuf-compiler.lintian-overrides @@ -0,0 +1,4 @@ +protobuf-compiler: copyright-without-copyright-notice +protobuf-compiler: initial-upload-closes-no-bugs +protobuf-compiler: no-manual-page +protobuf-compiler: zero-byte-file-in-doc-directory diff --git a/debian/python3-protobuf.install b/debian/python3-protobuf.install new file mode 100644 index 000000000000..e3da3e75536a --- /dev/null +++ b/debian/python3-protobuf.install @@ -0,0 +1 @@ +usr/lib/python*/*-packages/* diff --git a/debian/python3-protobuf.lintian-overrides b/debian/python3-protobuf.lintian-overrides new file mode 100644 index 000000000000..83767c0cd5bc --- /dev/null +++ b/debian/python3-protobuf.lintian-overrides @@ -0,0 +1,4 @@ +python3-protobuf: copyright-without-copyright-notice +python3-protobuf: initial-upload-closes-no-bugs +python3-protobuf: shared-library-lacks-prerequisites +python3-protobuf: zero-byte-file-in-doc-directory diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000000..c35268c0cde0 --- /dev/null +++ b/debian/rules @@ -0,0 +1,60 @@ +#!/usr/bin/make -f + +SHELL := /bin/bash + +override_dh_autoreconf: + +override_dh_auto_configure: + pushd src && \ + cmake \ + ../cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -Dprotobuf_BUILD_LIBPROTOC=ON \ + -Dprotobuf_BUILD_PROTOC_BINARIES=ON \ + -Dprotobuf_BUILD_SHARED_LIBS=ON \ + -Dprotobuf_BUILD_TESTS=OFF && \ + popd + +override_dh_auto_build: + pushd src && \ + cmake \ + --build . \ + --parallel 10 \ + --config Release && \ + popd + mkdir -p src/.libs + pushd src/.libs && \ + ln -fs ../*.so* . && \ + popd + pushd python && \ + python3 setup.py build \ + --cpp_implementation && \ + popd + +override_dh_auto_install: + pushd src && \ + export DESTDIR=../debian/tmp && \ + cmake \ + --install . && \ + popd + pushd python && \ + python3 setup.py install \ + --cpp_implementation \ + --no-compile \ + --install-layout=deb \ + --root=../debian/tmp && \ + popd + find debian/tmp/usr/lib/python*/*-packages -type f -name '*.pyc' -exec rm -rf {} \; + fdupes -qnrps debian/tmp/usr/lib/python*/*-packages + +override_dh_install: + dh_install + rm -rf debian/libprotobuf-dev/usr/include/google/protobuf/compiler + +override_dh_auto_test: + +override_dh_auto_clean: + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 000000000000..163aaf8d82b6 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides new file mode 100644 index 000000000000..d7c675178a31 --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1,7 @@ +protobuf source: configure-generated-file-in-source +protobuf source: dependency-is-not-multi-archified +protobuf source: file-without-copyright-information +protobuf source: no-debian-changes +protobuf source: not-binnmuable-any-depends-any +protobuf source: python3-depends-but-no-python3-helper +protobuf source: weak-library-dev-dependency diff --git a/protobuf.spec b/protobuf.spec new file mode 100644 index 000000000000..550bb2c98d0f --- /dev/null +++ b/protobuf.spec @@ -0,0 +1,283 @@ +# Copyright 2024 Wong Hoi Sing Edison +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +%global debug_package %{nil} + +%global source_date_epoch_from_changelog 0 + +Name: protobuf +Epoch: 100 +Version: 3.19.6 +Release: 1%{?dist} +Summary: Protocol Buffers - Google's data interchange format +License: BSD-3-Clause +URL: https://github.com/protocolbuffers/protobuf/tags +Source0: %{name}_%{version}.orig.tar.gz +BuildRequires: cmake +BuildRequires: fdupes +BuildRequires: gcc-c++ +BuildRequires: make +BuildRequires: python-rpm-macros +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: zlib-devel + +%description +Protocol Buffers are a way of encoding structured data in an efficient yet +extensible format. Google uses Protocol Buffers for almost all of its internal +RPC protocols and file formats. + +%prep +%autosetup -T -c -n %{name}_%{version}-%{release} +tar -zx -f %{S:0} --strip-components=1 -C . + +%build +pushd src && \ + cmake \ + ../cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -Dprotobuf_BUILD_LIBPROTOC=ON \ + -Dprotobuf_BUILD_PROTOC_BINARIES=ON \ + -Dprotobuf_BUILD_SHARED_LIBS=ON \ + -Dprotobuf_BUILD_TESTS=OFF && \ +popd +pushd src && \ + cmake \ + --build . \ + --parallel 10 \ + --config Release && \ +popd +mkdir -p src/.libs +pushd src/.libs && \ + ln -fs ../*.so* . && \ +popd +pushd python && \ + python3 setup.py build \ + --cpp_implementation && \ +popd + +%install +pushd src && \ + export DESTDIR=%{buildroot} && \ + cmake \ + --install . && \ +popd +pushd python && \ + python3 setup.py install \ + --cpp_implementation \ + --no-compile \ + --root=%{buildroot} && \ +popd +find %{buildroot}%{python3_sitearch} -type f -name '*.pyc' -exec rm -rf {} \; +fdupes -qnrps %{buildroot}%{python3_sitearch} + +%if 0%{?suse_version} > 1500 || 0%{?sle_version} > 150000 +%package -n libprotobuf3_19_6_0 +Summary: Protocol Buffers - Google's data interchange format + +%description -n libprotobuf3_19_6_0 +Protocol Buffers are a way of encoding structured data in an efficient +yet extensible format. Google uses Protocol Buffers for almost all of +its internal RPC protocols and file formats. + +%package -n libprotoc3_19_6_0 +Summary: Protocol Buffers - Google's data interchange format + +%description -n libprotoc3_19_6_0 +Protocol Buffers are a way of encoding structured data in an efficient +yet extensible format. Google uses Protocol Buffers for almost all of +its internal RPC protocols and file formats. + +%package -n libprotobuf-lite3_19_6_0 +Summary: Protocol Buffers - Google's data interchange format + +%description -n libprotobuf-lite3_19_6_0 +Protocol Buffers are a way of encoding structured data in an efficient +yet extensible format. Google uses Protocol Buffers for almost all of +its internal RPC protocols and file formats. + +%package -n protobuf-devel +Summary: Header files, libraries and development documentation for %{name} +Requires: libprotobuf-lite3_19_6_0 = %{epoch}:%{version}-%{release} +Requires: libprotobuf3_19_6_0 = %{epoch}:%{version}-%{release} +Requires: pkgconfig(zlib) +Provides: libprotobuf-devel = %{epoch}:%{version}-%{release} +Conflicts: protobuf2-devel + +%description -n protobuf-devel +Protocol Buffers are a way of encoding structured data in an efficient yet +extensible format. Google uses Protocol Buffers for almost all of its internal +RPC protocols and file formats. + +%if 0%{?suse_version} > 1500 +%package -n python%{python3_version_nodots}-protobuf +Summary: Python3 Bindings for Google Protocol Buffers +Requires: python3 +Requires: python3-six >= 1.9 +Provides: python3-protobuf = %{epoch}:%{version}-%{release} +Provides: python3dist(protobuf) = %{epoch}:%{version}-%{release} +Provides: python%{python3_version}-protobuf = %{epoch}:%{version}-%{release} +Provides: python%{python3_version}dist(protobuf) = %{epoch}:%{version}-%{release} +Provides: python%{python3_version_nodots}-protobuf = %{epoch}:%{version}-%{release} +Provides: python%{python3_version_nodots}dist(protobuf) = %{epoch}:%{version}-%{release} + +%description -n python%{python3_version_nodots}-protobuf +This package contains the Python bindings for Google Protocol Buffers. +%endif + +%if 0%{?sle_version} > 150000 +%package -n python3-protobuf +Summary: Python3 Bindings for Google Protocol Buffers +Requires: python3 +Requires: python3-six >= 1.9 +Provides: python3-protobuf = %{epoch}:%{version}-%{release} +Provides: python3dist(protobuf) = %{epoch}:%{version}-%{release} +Provides: python%{python3_version}-protobuf = %{epoch}:%{version}-%{release} +Provides: python%{python3_version}dist(protobuf) = %{epoch}:%{version}-%{release} +Provides: python%{python3_version_nodots}-protobuf = %{epoch}:%{version}-%{release} +Provides: python%{python3_version_nodots}dist(protobuf) = %{epoch}:%{version}-%{release} + +%description -n python3-protobuf +This package contains the Python bindings for Google Protocol Buffers. +%endif + +%post -n libprotobuf3_19_6_0 -p /sbin/ldconfig +%postun -n libprotobuf3_19_6_0 -p /sbin/ldconfig +%post -n libprotoc3_19_6_0 -p /sbin/ldconfig +%postun -n libprotoc3_19_6_0 -p /sbin/ldconfig +%post -n libprotobuf-lite3_19_6_0 -p /sbin/ldconfig +%postun -n libprotobuf-lite3_19_6_0 -p /sbin/ldconfig + +%files -n libprotobuf3_19_6_0 +%license LICENSE +%{_libdir}/libprotobuf.so.* + +%files -n libprotoc3_19_6_0 +%{_libdir}/libprotoc.so.* + +%files -n libprotobuf-lite3_19_6_0 +%{_libdir}/libprotobuf-lite.so.* + +%files -n protobuf-devel +%dir %{_includedir}/google +%dir %{_libdir}/cmake +%dir %{_libdir}/cmake/* +%{_bindir}/* +%{_includedir}/google/protobuf/ +%{_libdir}/cmake/*/*.cmake +%{_libdir}/libprotobuf-lite.so +%{_libdir}/libprotobuf.so +%{_libdir}/libprotoc.so +%{_libdir}/pkgconfig/protobuf-lite.pc +%{_libdir}/pkgconfig/protobuf.pc + +%if 0%{?suse_version} > 1500 +%files -n python%{python3_version_nodots}-protobuf +%license LICENSE +%{python3_sitearch}/* +%endif + +%if 0%{?sle_version} > 150000 +%files -n python3-protobuf +%license LICENSE +%{python3_sitearch}/* +%endif +%endif + +%if !(0%{?suse_version} > 1500) && !(0%{?sle_version} > 150000) +%package -n protobuf-compiler +Summary: Protocol Buffers compiler +Requires: protobuf = %{epoch}:%{version}-%{release} + +%description -n protobuf-compiler +This package contains Protocol Buffers compiler for all programming +languages + +%package -n protobuf-devel +Summary: Protocol Buffers C++ headers and libraries +Requires: protobuf = %{epoch}:%{version}-%{release} +Requires: protobuf-compiler = %{epoch}:%{version}-%{release} +Requires: zlib-devel +Requires: pkgconfig + +%description -n protobuf-devel +This package contains Protocol Buffers compiler for all languages and +C++ headers and libraries + +%package -n protobuf-lite +Summary: Protocol Buffers LITE_RUNTIME libraries + +%description -n protobuf-lite +Protocol Buffers built with optimize_for = LITE_RUNTIME. + +%package -n protobuf-lite-devel +Summary: Protocol Buffers LITE_RUNTIME development libraries +Requires: protobuf-devel = %{epoch}:%{version}-%{release} +Requires: protobuf-lite = %{epoch}:%{version}-%{release} + +%description -n protobuf-lite-devel +This package contains development libraries built with optimize_for = +LITE_RUNTIME. + +%package -n python3-protobuf +Summary: Python 3 bindings for Google Protocol Buffers +Requires: python3-six >= 1.9 +Provides: python3-protobuf = %{epoch}:%{version}-%{release} +Provides: python3dist(protobuf) = %{epoch}:%{version}-%{release} +Provides: python%{python3_version}-protobuf = %{epoch}:%{version}-%{release} +Provides: python%{python3_version}dist(protobuf) = %{epoch}:%{version}-%{release} +Provides: python%{python3_version_nodots}-protobuf = %{epoch}:%{version}-%{release} +Provides: python%{python3_version_nodots}dist(protobuf) = %{epoch}:%{version}-%{release} + +%description -n python3-protobuf +This package contains Python 3 libraries for Google Protocol Buffers + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig +%post -n protobuf-compiler -p /sbin/ldconfig +%postun -n protobuf-compiler -p /sbin/ldconfig +%post -n protobuf-lite -p /sbin/ldconfig +%postun -n protobuf-lite -p /sbin/ldconfig + +%files +%license LICENSE +%{_libdir}/libprotobuf.so.* + +%files -n protobuf-compiler +%{_bindir}/* +%{_libdir}/libprotoc.so.* + +%files -n protobuf-devel +%dir %{_includedir}/google +%dir %{_libdir}/cmake +%dir %{_libdir}/cmake/* +%{_includedir}/google/protobuf/ +%{_libdir}/cmake/*/*.cmake +%{_libdir}/libprotobuf.so +%{_libdir}/libprotoc.so +%{_libdir}/pkgconfig/protobuf.pc + +%files -n protobuf-lite +%{_libdir}/libprotobuf-lite.so.* + +%files -n protobuf-lite-devel +%{_libdir}/libprotobuf-lite.so +%{_libdir}/pkgconfig/protobuf-lite.pc + +%files -n python3-protobuf +%{python3_sitearch}/* +%endif + +%changelog diff --git a/python/google/protobuf/pyext/descriptor.cc b/python/google/protobuf/pyext/descriptor.cc index a2993d908bfa..4ff5f46898f5 100644 --- a/python/google/protobuf/pyext/descriptor.cc +++ b/python/google/protobuf/pyext/descriptor.cc @@ -57,6 +57,43 @@ : 0) \ : PyBytes_AsStringAndSize(ob, (charpp), (sizep))) +#if PY_VERSION_HEX < 0x030900B1 && !defined(PYPY_VERSION) +static inline PyCodeObject* PyFrame_GetCode(PyFrameObject *frame) +{ + Py_INCREF(frame->f_code); + return frame->f_code; +} + +static inline PyFrameObject* PyFrame_GetBack(PyFrameObject *frame) +{ + Py_XINCREF(frame->f_back); + return frame->f_back; +} +#endif + +#if PY_VERSION_HEX < 0x030B00A7 && !defined(PYPY_VERSION) +static inline PyObject* PyFrame_GetLocals(PyFrameObject *frame) +{ +#if PY_VERSION_HEX >= 0x030400B1 + if (PyFrame_FastToLocalsWithError(frame) < 0) { + return NULL; + } +#else + PyFrame_FastToLocals(frame); +#endif + Py_INCREF(frame->f_locals); + return frame->f_locals; +} +#endif + +#if PY_VERSION_HEX < 0x030B00A7 && !defined(PYPY_VERSION) +static inline PyObject* PyFrame_GetGlobals(PyFrameObject *frame) +{ + Py_INCREF(frame->f_globals); + return frame->f_globals; +} +#endif + namespace google { namespace protobuf { namespace python { @@ -98,43 +135,63 @@ bool _CalledFromGeneratedFile(int stacklevel) { if (frame == NULL) { return false; } + Py_INCREF(frame); while (stacklevel-- > 0) { - frame = frame->f_back; + PyFrameObject* next_frame = PyFrame_GetBack(frame); + Py_DECREF(frame); + frame = next_frame; if (frame == NULL) { return false; } } - if (frame->f_code->co_filename == NULL) { + PyCodeObject* frame_code = PyFrame_GetCode(frame); + if (frame_code->co_filename == nullptr) { + Py_DECREF(frame_code); + Py_DECREF(frame); return false; } char* filename; Py_ssize_t filename_size; - if (PyString_AsStringAndSize(frame->f_code->co_filename, + if (PyString_AsStringAndSize(frame_code->co_filename, &filename, &filename_size) < 0) { // filename is not a string. + Py_DECREF(frame_code); + Py_DECREF(frame); PyErr_Clear(); return false; } + Py_DECREF(frame_code); if ((filename_size < 3) || (strcmp(&filename[filename_size - 3], ".py") != 0)) { // Cython's stack does not have .py file name and is not at global module // scope. + Py_DECREF(frame); return true; } if (filename_size < 7) { // filename is too short. + Py_DECREF(frame); return false; } if (strcmp(&filename[filename_size - 7], "_pb2.py") != 0) { // Filename is not ending with _pb2. + Py_DECREF(frame); return false; } - if (frame->f_globals != frame->f_locals) { + PyObject* frame_globals = PyFrame_GetGlobals(frame); + PyObject* frame_locals = PyFrame_GetLocals(frame); + if (frame_globals != frame_locals) { // Not at global module scope + Py_DECREF(frame_globals); + Py_XDECREF(frame_locals); + Py_DECREF(frame); return false; } + Py_DECREF(frame_globals); + Py_XDECREF(frame_locals); + Py_DECREF(frame); #endif return true; } diff --git a/src/Makefile.am b/src/Makefile.am index 1d9cd6fb4def..11b9da83c12a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,7 @@ else PTHREAD_DEF = endif -PROTOBUF_VERSION = 30:6:0 +PROTOBUF_VERSION = 3.19.6 if GCC # Turn on all warnings except for sign comparison (we ignore sign comparison @@ -185,7 +185,7 @@ nobase_include_HEADERS = \ lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la libprotobuf_lite_la_LIBADD = $(PTHREAD_LIBS) $(LIBATOMIC_LIBS) -libprotobuf_lite_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) -export-dynamic -no-undefined +libprotobuf_lite_la_LDFLAGS = -release $(PROTOBUF_VERSION) -export-dynamic -no-undefined if HAVE_LD_VERSION_SCRIPT libprotobuf_lite_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf-lite.map EXTRA_libprotobuf_lite_la_DEPENDENCIES = libprotobuf-lite.map @@ -232,7 +232,7 @@ libprotobuf_lite_la_SOURCES = \ google/protobuf/wire_format_lite.cc libprotobuf_la_LIBADD = $(PTHREAD_LIBS) $(LIBATOMIC_LIBS) -libprotobuf_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) -export-dynamic -no-undefined +libprotobuf_la_LDFLAGS = -release $(PROTOBUF_VERSION) -export-dynamic -no-undefined if HAVE_LD_VERSION_SCRIPT libprotobuf_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf.map EXTRA_libprotobuf_la_DEPENDENCIES = libprotobuf.map @@ -319,7 +319,7 @@ libprotobuf_la_SOURCES = \ nodist_libprotobuf_la_SOURCES = $(nodist_libprotobuf_lite_la_SOURCES) libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la -libprotoc_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) -export-dynamic -no-undefined +libprotoc_la_LDFLAGS = -release $(PROTOBUF_VERSION) -export-dynamic -no-undefined if HAVE_LD_VERSION_SCRIPT libprotoc_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotoc.map EXTRA_libprotoc_la_DEPENDENCIES = libprotoc.map diff --git a/src/libprotobuf-lite.map b/src/libprotobuf-lite.map index 391554669481..a1853ca6cbf2 100644 --- a/src/libprotobuf-lite.map +++ b/src/libprotobuf-lite.map @@ -3,6 +3,8 @@ extern "C++" { *google*; }; + scc_info_*; + descriptor_table_*; local: *; diff --git a/src/libprotobuf.map b/src/libprotobuf.map index 391554669481..a1853ca6cbf2 100644 --- a/src/libprotobuf.map +++ b/src/libprotobuf.map @@ -3,6 +3,8 @@ extern "C++" { *google*; }; + scc_info_*; + descriptor_table_*; local: *; diff --git a/src/libprotoc.map b/src/libprotoc.map index 391554669481..a1853ca6cbf2 100644 --- a/src/libprotoc.map +++ b/src/libprotoc.map @@ -3,6 +3,8 @@ extern "C++" { *google*; }; + scc_info_*; + descriptor_table_*; local: *;