Significant packaging improvements and new subpackages

- General:
  * Update summaries and descriptions
  * Update License fields to include licenses from bundled components
  * Fix failure to respect Fedora build flags
  * Use the system shared certificate bundle instead of shipping our own
- CLI:
  * No longer set rpath $ORIGIN
- C (core) and C++ (cpp):
  * Add c_so_version/cpp_so_version macros
  * Split out C++ bindings and shared data into subpackages
  * Drop obsolete ldconfig_scriptlets macro
  * Stop stripping debugging symbols
- Python:
  * Use generated BR’s
  * Build and package Python binding documentation
  * Disable accommodations for older libc’s
  * Patch out -std=gnu99 flag, which is inappropriate for C++
  * Build additional Python packages grpcio_tools, gprcio_channelz,
    grpcio_health_checking, grpcio_reflection, grpcio_status, and
    grpcio_testing
This commit is contained in:
Benjamin A. Beasley 2021-02-02 08:20:44 -05:00
parent 2dadba5e8f
commit 87469ef514
9 changed files with 777 additions and 109 deletions

View File

@ -0,0 +1,21 @@
diff -Naur grpc-1.26.0-original/src/python/grpcio_tests/setup.py grpc-1.26.0/src/python/grpcio_tests/setup.py
--- grpc-1.26.0-original/src/python/grpcio_tests/setup.py 2019-12-17 20:29:27.000000000 -0500
+++ grpc-1.26.0/src/python/grpcio_tests/setup.py 2021-02-02 09:11:20.236194502 -0500
@@ -37,7 +37,7 @@
}
INSTALL_REQUIRES = (
- 'coverage>=4.0', 'enum34>=1.0.4',
+ 'coverage>=4.0',
'grpcio>={version}'.format(version=grpc_version.VERSION),
'grpcio-channelz>={version}'.format(version=grpc_version.VERSION),
'grpcio-status>={version}'.format(version=grpc_version.VERSION),
@@ -48,6 +48,8 @@
if not PY3:
INSTALL_REQUIRES += ('futures>=2.2.0',)
+if sys.version_info < (3, 4):
+ INSTALL_REQUIRES += ('enum34>=1.0.4',)
COMMAND_CLASS = {
# Run `preprocess` *before* doing any packaging!

View File

@ -0,0 +1,34 @@
diff -Naur grpc-1.26.0-original/src/python/grpcio_tests/setup.py grpc-1.26.0/src/python/grpcio_tests/setup.py
--- grpc-1.26.0-original/src/python/grpcio_tests/setup.py 2019-12-17 20:29:27.000000000 -0500
+++ grpc-1.26.0/src/python/grpcio_tests/setup.py 2021-02-02 10:12:54.881753347 -0500
@@ -19,7 +19,12 @@
import setuptools
-import grpc_tools.command
+try:
+ from grpc_tools.command import BuildPackageProtos
+except ImportError:
+ if not os.environ.get('GRPCIO_TESTS_IGNORE_MISSING_TOOLS'):
+ raise
+ BuildPackageProtos = None
PY3 = sys.version_info.major == 3
@@ -52,7 +57,6 @@
COMMAND_CLASS = {
# Run `preprocess` *before* doing any packaging!
'preprocess': commands.GatherProto,
- 'build_package_protos': grpc_tools.command.BuildPackageProtos,
'build_py': commands.BuildPy,
'run_fork': commands.RunFork,
'run_interop': commands.RunInterop,
@@ -60,6 +64,8 @@
'test_gevent': commands.TestGevent,
'test_aio': commands.TestAio,
}
+if BuildPackageProtos is not None:
+ COMMAND_CLASS['build_package_protos'] = BuildPackageProtos
PACKAGE_DATA = {
'tests.interop': [

View File

@ -0,0 +1,14 @@
Backport upstream commit 9e0b427893b65b220faf8a31a6afdc67f6f41364 “Use != with literals”
diff -Naur grpc-1.26.0-original/src/python/grpcio/commands.py grpc-1.26.0/src/python/grpcio/commands.py
--- grpc-1.26.0-original/src/python/grpcio/commands.py 2019-12-17 20:29:27.000000000 -0500
+++ grpc-1.26.0/src/python/grpcio/commands.py 2021-01-28 12:51:33.635142522 -0500
@@ -99,7 +99,7 @@
target_dir = os.path.join(GRPC_STEM, 'doc', 'build')
exit_code = sphinx.cmd.build.build_main(
['-b', 'html', '-W', '--keep-going', source_dir, target_dir])
- if exit_code is not 0:
+ if exit_code:
raise CommandError(
"Documentation generation has warnings or errors")

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,12 @@
diff -Naur grpc-1.26.0-original/setup.py grpc-1.26.0/setup.py
--- grpc-1.26.0-original/setup.py 2019-12-17 20:29:27.000000000 -0500
+++ grpc-1.26.0/setup.py 2021-01-28 13:20:22.540840537 -0500
@@ -197,7 +197,7 @@
' -static-libgcc -static-libstdc++ -mcrtdll={msvcr}'
' -static'.format(msvcr=msvcr))
if "linux" in sys.platform:
- EXTRA_ENV_LINK_ARGS += ' -Wl,-wrap,memcpy -static-libgcc'
+ EXTRA_ENV_LINK_ARGS += ' -Wl,-wrap,memcpy'
EXTRA_COMPILE_ARGS = shlex.split(EXTRA_ENV_COMPILE_ARGS)
EXTRA_LINK_ARGS = shlex.split(EXTRA_ENV_LINK_ARGS)

View File

@ -0,0 +1,32 @@
Based on remove-gnu99.patch from
https://src.fedoraproject.org/rpms/grpc/pull-request/3; corresponds to ignored
upstream PR https://github.com/grpc/grpc/pull/23671. For consistency, we also
patch a related shell script that we do not use.
Using -std=gnu99 for C++ code makes GCC warn and clang error; besides, it makes
no sense.
diff -Naur grpc-1.26.0-original/setup.py grpc-1.26.0/setup.py
--- grpc-1.26.0-original/setup.py 2019-12-17 20:29:27.000000000 -0500
+++ grpc-1.26.0/setup.py 2021-02-01 11:49:55.741613488 -0500
@@ -179,7 +179,7 @@
# available dynamically
EXTRA_ENV_COMPILE_ARGS += ' /MT'
elif "linux" in sys.platform:
- EXTRA_ENV_COMPILE_ARGS += ' -std=gnu99 -fvisibility=hidden -fno-wrapv -fno-exceptions'
+ EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden -fno-wrapv -fno-exceptions'
elif "darwin" in sys.platform:
EXTRA_ENV_COMPILE_ARGS += ' -stdlib=libc++ -fvisibility=hidden -fno-wrapv -fno-exceptions'
diff -Naur grpc-1.26.0-original/tools/run_tests/helper_scripts/build_python.sh grpc-1.26.0/tools/run_tests/helper_scripts/build_python.sh
--- grpc-1.26.0-original/tools/run_tests/helper_scripts/build_python.sh 2019-12-17 20:29:27.000000000 -0500
+++ grpc-1.26.0/tools/run_tests/helper_scripts/build_python.sh 2021-02-01 11:49:37.059492917 -0500
@@ -116,7 +116,7 @@
fi
ROOT=$(pwd)
-export CFLAGS="-I$ROOT/include -std=gnu99 -fno-wrapv $CFLAGS"
+export CFLAGS="-I$ROOT/include -fno-wrapv $CFLAGS"
export GRPC_PYTHON_BUILD_WITH_CYTHON=1
export LANG=en_US.UTF-8

14
grpc.rpmlintrc Normal file
View File

@ -0,0 +1,14 @@
# These are not real spelling errors...
addFilter(r' spelling-error .*[ \(]en_US\)? (microservices|auth|gRPC|channelz|proto(buf)?|unary|rpc) ')
# Maybe some of these are supposed to be CRNL-terminated:
addFilter(r' wrong-file-end-of-line-encoding /usr/share/doc/grpc/examples/csharp/')
# We generally follow upstream package metadata for these:
addFilter(r' description-shorter-than-summary')
# Many subpackages do not have their own documentation!
addFilter(r' no-documentation')
# We believe we have patched all calls to SSL_CTX_set_cipher_list with
# hard-coded values to use "PROFILE=SYSTEM" instead, thereby complying with the
# system policy.
addFilter(r' crypto-policy-non-compliance-openssl .* SSL_CTX_set_cipher_list')
# These will not dangle after the ca-certificates dependency is installed:
addFilter(r' dangling-relative-symlink .*\.pem$')

729
grpc.spec
View File

@ -1,34 +1,145 @@
%define _lto_cflags %{nil}
Name: grpc
Version: 1.26.0
Release: 11%{?dist}
Summary: RPC library and framework
Name: grpc
Version: 1.26.0
Release: 10%{?dist}
Summary: Modern, open source, high-performance remote procedure call (RPC) framework
License: ASL 2.0
URL: https://www.grpc.io
Source0: https://github.com/grpc/grpc/archive/v%{version}/%{name}-%{version}.tar.gz
# The entire source is ASL 2.0 except the following:
#
# BSD:
# - third_party/upb/, except third_party/upb/third_party/lunit/
# * Potentially linked into any compiled subpackage (but not -doc,
# pure-Python subpackages, etc.)
# - third_party/address_sorting/
# * Potentially linked into any compiled subpackage (but not -doc,
# pure-Python subpackages, etc.)
#
# as well as the following which do not contribute to the base License field or
# any subpackage License field for the reasons noted:
#
# MPLv2.0:
# - etc/roots.pem
# * Truncated to an empty file in prep; a symlink to the shared system
# certificates is used instead
# - src/android/test/interop/app/src/main/assets/roots.pem
# * Truncated to an empty file in prep
# ISC:
# - src/boringssl/crypto_test_data.cc and src/boringssl/err_data.c
# * Removed in prep; not used when building with system OpenSSL
# BSD:
# - src/objective-c/*.podspec and templates/src/objective-c/*.podspec.template
# * Unused since the Objective-C bindings are not currently built
# MIT:
# - third_party/cares/ares_build.h
# * Removed in prep; header from system C-Ares used instead
# - third_party/rake-compiler-dock/
# * Removed in prep, since we build no containers
# - third_party/upb/third_party/lunit/
# * Removed in prep, since there is no obvious way to run the upb tests
License: ASL 2.0 and BSD
URL: https://www.%{name}.io
%global forgeurl https://github.com/%{name}/%{name}/
Source0: %{forgeurl}/archive/v%{version}/%{name}-%{version}.tar.gz
BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: protobuf-devel
BuildRequires: protobuf-compiler
BuildRequires: openssl-devel
BuildRequires: c-ares-devel
BuildRequires: gflags-devel
BuildRequires: gtest-devel
BuildRequires: zlib-devel
BuildRequires: gperftools-devel
# ~~~~ C (core) and C++ (cpp) ~~~~
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-Cython
BuildRequires: make
%global c_so_version 9
%global cpp_so_version 1
Patch0: grpc-0001-enforce-system-crypto-policies.patch
Patch2: grpc-0003-use-shell-loop-instead-makefile-function.patch
Patch3: 99f8a10aec994a8957fbb6787768b444ef34d6a2.patch
Patch4: 72351f63fd650cc7acfcd2d0307e8e8e8f777283.patch
Patch5: remove-gnu99.patch
BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: make
BuildRequires: chrpath
BuildRequires: protobuf-devel
BuildRequires: protobuf-compiler
BuildRequires: openssl-devel
BuildRequires: c-ares-devel
BuildRequires: gflags-devel
BuildRequires: gtest-devel
BuildRequires: zlib-devel
BuildRequires: gperftools-devel
# ~~~~ Python ~~~~
%global set_grpc_python_environment %{expand:
export GRPC_PYTHON_BUILD_WITH_CYTHON=True
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=True
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=True
export GRPC_PYTHON_BUILD_SYSTEM_CARES=True
export GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY=True
export GRPC_PYTHON_ENABLE_DOCUMENTATION_BUILD=True}
BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
BuildRequires: pyproject-rpm-macros
# Not automatically generated even when we set GRPC_PYTHON_BUILD_WITH_CYTHON:
BuildRequires: python3dist(cython)
# Otherwise, we use generated BRs.
# ~~~~ Miscellaneous ~~~~
# https://bugzilla.redhat.com/show_bug.cgi?id=1893533
%global _lto_cflags %{nil}
BuildRequires: ca-certificates
# For converting absolute symlinks in the buildroot to relative ones
BuildRequires: symlinks
BuildRequires: dos2unix
# https://docs.fedoraproject.org/en-US/packaging-guidelines/CryptoPolicies/#_cc_applications
Patch0: %{name}-0001-enforce-system-crypto-policies.patch
Patch2: %{name}-0003-use-shell-loop-instead-makefile-function.patch
Patch3: 99f8a10aec994a8957fbb6787768b444ef34d6a2.patch
Patch4: 72351f63fd650cc7acfcd2d0307e8e8e8f777283.patch
# Based on remove-gnu99.patch from
# https://src.fedoraproject.org/rpms/grpc/pull-request/3; corresponds to
# ignored upstream PR https://github.com/grpc/grpc/pull/23671. For consistency,
# we also patch a related shell script that we do not use.
#
# Using -std=gnu99 for C++ code makes GCC warn and clang error; besides, it
# makes no sense.
Patch5: %{name}-1.26.0-python-no-std-gnu99.patch
# Backport upstream commit 9e0b427893b65b220faf8a31a6afdc67f6f41364 “Use !=
# with literals”
Patch6: %{name}-1.26.0-python-SyntaxWarning.patch
# Stop adding -static-libgcc when linking Python bindings
Patch7: %{name}-1.26.0-python-no-static-libgcc.patch
# Build python3-grpcio_tools against system protobuf packages instead of
# expecting a git submodule. Must also add requisite linker flags using
# GRPC_PYTHON_LDFLAGS.
Patch8: %{name}-1.26.0-python-grpcio_tools-use-system-protobuf.patch
# Allow us to use the setup.py in grpcio-tests (e.g. for generating BRs)
# before we have built grpcio-tools; the build_package_protos command is simply
# not available in this case. Activated by setting environment variable
# GRPCIO_TESTS_IGNORE_MISSING_TOOLS with any value.
Patch9: %{name}-1.26.0-grpcio-tests-setup-without-grpcio-tools.patch
# In grpcio-tests, require enum34 for install only on those ancient Pythons
# that require it; we are not using such a Python!
Patch10: %{name}-1.26.0-grpcio-tests-conditionalize-enum34.patch
Requires: %{name}-data = %{version}-%{release}
# Upstream https://github.com/protocolbuffers/upb does not support building
# with anything other than Bazel, and Bazel is not likely to make it into
# Fedora anytime soon due to its nightmarish collection of dependencies.
# Monitor this at https://bugzilla.redhat.com/show_bug.cgi?id=1470842.
# Therefore upb cannot be packaged for Fedora, and we must use the bundled copy.
#
# Note that upstream has never chosen a version, and it is not clear from which
# commit the bundled copy was taken or forked.
#
# Note also that libupb is installed in the system-wide linker path, which will
# be a problem if upb is ever packaged separately. We will cross that bridge if
# we get there.
Provides: bundled(upb)
# Regarding third_party/address_sorting: this looks a bit like a bundled
# library, but it is not. From a source file comment:
# This is an adaptation of Android's implementation of RFC 6724 (in Androids
# getaddrinfo.c). It has some cosmetic differences from Androids
# getaddrinfo.c, but Androids getaddrinfo.c was used as a guide or example
# of a way to implement the RFC 6724 spec when this was written.
%description
gRPC is a modern open source high performance RPC framework that can run in any
@ -39,125 +150,549 @@ connect devices, mobile applications and browsers to backend services.
The main usage scenarios:
* Efficiently connecting polyglot services in microservices style architecture
* Connecting mobile devices, browser clients to backend services
* Generating efficient client libraries
* Efficiently connecting polyglot services in microservices style architecture
* Connecting mobile devices, browser clients to backend services
* Generating efficient client libraries
Core Features that make it awesome:
* Idiomatic client libraries in 10 languages
* Highly efficient on wire and with a simple service definition framework
* Bi-directional streaming with http/2 based transport
* Pluggable auth, tracing, load balancing and health checking
* Idiomatic client libraries in 10 languages
* Highly efficient on wire and with a simple service definition framework
* Bi-directional streaming with http/2 based transport
* Pluggable auth, tracing, load balancing and health checking
This package provides the shared C core library.
%generate_buildrequires
%set_grpc_python_environment
%pyproject_buildrequires -r
# Generate BRs from other Python packages; but use grep to filter out those we
# are building and installing ourselves.
(
export GRPCIO_TESTS_IGNORE_MISSING_TOOLS=1
pushd "tools/distrib/python/grpcio_tools/" >/dev/null
%pyproject_buildrequires -r
popd >/dev/null
for suffix in channelz health_checking reflection status testing tests
do
pushd "src/python/grpcio_${suffix}/" >/dev/null
%pyproject_buildrequires -r
popd >/dev/null
done
) | grep -vF 'grpc'
%package data
Summary: Data for gRPC bindings
License: ASL 2.0
BuildArch: noarch
Requires: ca-certificates
%description data
Common data for gRPC bindings: currently, this contains only a symbolic link to
the system shared TLS certificates.
%package doc
Summary: Documentation and examples for gRPC
License: ASL 2.0
BuildArch: noarch
%description doc
Documentation and examples for gRPC.
%package cpp
Summary: C++ language bindings for gRPC
# License: same as base package
Requires: %{name}%{?_isa} = %{version}-%{release}
%description cpp
C++ language bindings for gRPC.
%package plugins
Summary: gRPC protocol buffers compiler plugins
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: protobuf-compiler
Summary: Protocol buffers compiler plugins for gRPC
# License: same as base package
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: protobuf-compiler
%description plugins
Plugins to the protocol buffers compiler to generate gRPC sources.
%package cli
Summary: gRPC protocol buffers cli
Requires: %{name}%{?_isa} = %{version}-%{release}
Summary: Command-line tool for gRPC
# License: same as base package
Requires: %{name}%{?_isa} = %{version}-%{release}
%description cli
Plugins to the protocol buffers compiler to generate gRPC sources.
The command line tool can do the following things:
* Send unary rpc.
* Attach metadata and display received metadata.
* Handle common authentication to server.
* Infer request/response types from server reflection result.
* Find the request/response types from a given proto file.
* Read proto request in text form.
* Read request in wire form (for protobuf messages, this means serialized
binary form).
* Display proto response in text form.
* Write response in wire form to a file.
%package devel
Summary: gRPC library development files
Requires: %{name}%{?_isa} = %{version}-%{release}
Summary: Development files for gRPC library
# License: same as base package
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-cpp%{?_isa} = %{version}-%{release}
%description devel
Development headers and files for gRPC libraries.
Development headers and files for gRPC libraries (both C and C++).
%package -n python3-grpcio
Summary: Python language bindings for grpc, remote procedure call (RPC) framework
Requires: %{name}%{?_isa} = %{version}-%{release}
Summary: Python language bindings for gRPC
# License: same as base package
# Note that the Python package has no runtime dependency on the base C library;
# everything it needs is bundled.
Requires: %{name}-data = %{version}-%{release}
%description -n python3-grpcio
Python3 bindings for gRPC library.
Python language bindings for gRPC (HTTP/2-based RPC framework).
%package -n python3-grpcio-tools
Summary: Package for gRPC Python tools
# License: same as base package
%description -n python3-grpcio-tools
Package for gRPC Python tools.
%package -n python3-grpcio-channelz
Summary: Channel Level Live Debug Information Service for gRPC
License: ASL 2.0
BuildArch: noarch
%description -n python3-grpcio-channelz
Channelz is a live debug tool in gRPC Python.
%package -n python3-grpcio-health-checking
Summary: Standard Health Checking Service for gRPC
License: ASL 2.0
BuildArch: noarch
%description -n python3-grpcio-health-checking
Reference package for GRPC Python health checking.
%package -n python3-grpcio-reflection
Summary: Standard Protobuf Reflection Service for gRPC
License: ASL 2.0
BuildArch: noarch
%description -n python3-grpcio-reflection
Reference package for reflection in GRPC Python.
%package -n python3-grpcio-status
Summary: Status proto mapping for gRPC
License: ASL 2.0
BuildArch: noarch
%description -n python3-grpcio-status
Reference package for GRPC Python status proto mapping.
%package -n python3-grpcio-testing
Summary: Testing utilities for gRPC Python
License: ASL 2.0
BuildArch: noarch
%description -n python3-grpcio-testing
Testing utilities for gRPC Python.
%package -n python-grpcio-doc
License: ASL 2.0
Summary: Documentation for Python language bindings for gRPC
BuildArch: noarch
Provides: python-grpcio-channelz-doc = %{version}-%{release}
Provides: python-grpcio-health-checking-doc = %{version}-%{release}
Provides: python-grpcio-reflection-doc = %{version}-%{release}
Provides: python-grpcio-status-doc = %{version}-%{release}
Provides: python-grpcio-testing-doc = %{version}-%{release}
%description -n python-grpcio-doc
Documentation for Python language bindings for gRPC, including the following
packages:
* grpcio
* grpcio_channelz
* grpcio_health_checking
* grpcio_reflection
* grpcio_status
* grpcio_testing
%prep
%autosetup -N
%patch0 -p1
#%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
sed -i 's:^prefix ?= .*:prefix ?= %{_prefix}:' Makefile
sed -i 's:$(prefix)/lib:$(prefix)/%{_lib}:' Makefile
sed -i 's:^GTEST_LIB =.*::' Makefile
%autosetup -p1
sed -i \
-e 's:^prefix ?= .*:prefix ?= %{_prefix}:' \
-e 's:$(prefix)/lib:$(prefix)/%{_lib}:' \
-e 's:^GTEST_LIB =.*::' Makefile
# Fix some of the weirdest accidentally-executable files
find . -type f -name '*.md' -perm /0111 -execdir chmod -v a-x '{}' '+'
# Allow building Python documentation with a newer Sphinx; the upstream version
# requirement is needlessly strict. (It is fine for upstreams own purposes, as
# they are happy to build documentation with a pinned old version.)
sed -r -i "s/('Sphinx)~=.*'/\1'/" setup.py
# Remove unused sources that have licenses not in the License field, to ensure
# they are not accidentally used in the build. See the comment above the base
# package License field for more details.
rm -rfv \
src/boringssl/*.c src/boringssl/*.cc \
third_party/cares/ares_build.h \
third_party/rake-compiler-dock \
third_party/upb/third_party/lunit
# Since we are replacing roots.pem with a symlink to the shared system
# certificates, we do not include its license (MPLv2.0) in any License field.
# We remove its contents so that, if we make a packaging mistake, we will have
# a bug but not an incorrect License field.
echo '' > etc/roots.pem
# Remove Android sources and examples. We do not need these on Linux, and they
# have some issues that will be flagged when reviewing the package, such as:
# - Another copy of the MPLv2.0-licensed certificate bundle from
# etc/roots.pem, in src/android/test/interop/app/src/main/assets/roots.pem
# - Pre-built jar files at
# src/android/test/interop/gradle/wrapper/gradle-wrapper.jar and
# examples/android/helloworld/gradle/wrapper/gradle-wrapper.jar
rm -rvf examples/android src/android
# Remove unwanted .gitignore files, generally in examples. One could argue that
# a sample .gitignore file is part of the example, but, well, were not going
# to do that.
find . -type f -name .gitignore -print -delete
# Find executables with /usr/bin/env shebangs in the examples, and fix them.
find examples -type f -perm /0111 |
while read -r fn
do
if head -n 1 "${fn}" | grep -E '^#!/usr/bin/env[[:blank:]]'
then
sed -r -i '1{s|^(#!/usr/bin/)env[[:blank:]]+([^[:blank:]]+)|\1\2|}' \
"${fn}"
fi
done
# Fix some CRNL line endings:
dos2unix \
examples/cpp/helloworld/CMakeLists.txt \
examples/cpp/helloworld/cmake_externalproject/CMakeLists.txt
# We leave those under examples/csharp alone.
%build
# ~~~~ C (core) and C++ (cpp) ~~~~
%set_build_flags
# Default targets are: static shared plugins
%make_build shared plugins
# build python module
export GRPC_PYTHON_BUILD_WITH_CYTHON=True
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=True
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=True
export GRPC_PYTHON_BUILD_SYSTEM_CARES=True
export CFLAGS="%optflags"
# ~~~~ Python ~~~~
# Since we will need all of the Python packages for the documentation build,
# and there are some other interdependencies (e.g., many have setup_requires:
# grpcio-tools), we do a temporary install of the built packages into a local
# directory, and add it to the PYTHONPATH.
PYROOT="${PWD}/%{_vpath_builddir}/pyroot"
if [ -n "${PYTHONPATH-}" ]; then PYTHONPATH="${PYTHONPATH}:"; fi
PYTHONPATH="${PYTHONPATH-}${PYROOT}%{python3_sitelib}"
PYTHONPATH="${PYTHONPATH}:${PYROOT}%{python3_sitearch}"
export PYTHONPATH
# ~~ grpcio ~~
%set_grpc_python_environment
%py3_build
%{__python3} %{py_setup} %{?py_setup_args} install \
-O1 --skip-build --root "${PYROOT}"
# ~~ grpcio-tools ~~
pushd "tools/distrib/python/grpcio_tools/" >/dev/null
# When copying more things in here, make sure the subpackage License field
# stays correct. We need copies, not symlinks, so that the “graft” in
# MANIFEST.in works.
mkdir -p %{name}_root/src
for srcdir in compiler
do
cp -rp "../../../../src/${srcdir}" "%{name}_root/src/"
done
cp -rp '../../../../include' '%{name}_root/'
(
export GRPC_PYTHON_LDFLAGS='-lprotoc'
%py3_build
)
# Remove unwanted shebang from grpc_tools.protoc source file, which will be
# installed without an executable bit:
find . -type f -name protoc.py -execdir sed -r -i '1{/^#!/d}' '{}' '+'
%{__python3} %{py_setup} %{?py_setup_args} install \
-O1 --skip-build --root "${PYROOT}"
popd >/dev/null
# ~~ pure-python modules grpcio-* ~~
for suffix in channelz health_checking reflection status testing
do
echo "----> grpcio_${suffix} <----" 1>&2
pushd "src/python/grpcio_${suffix}/" >/dev/null
%py3_build
%{__python3} %{py_setup} %{?py_setup_args} install \
-O1 --skip-build --root "${PYROOT}"
popd >/dev/null
done
# ~~ grpcio-tests ~~
echo '----> grpcio_tests <----'
pushd 'src/python/grpcio_tests/' >/dev/null
%py3_build
popd >/dev/null
# ~~ documentation ~~
%{__python3} %{py_setup} %{?py_setup_args} doc
%install
make install prefix="%{buildroot}%{_prefix}"
make install-grpc-cli prefix="%{buildroot}%{_prefix}"
find %{buildroot} -type f -name '*.a' -exec rm -f {} \;
# ~~~~ C (core) and C++ (cpp) ~~~~
# Do not strip debugging symbols!
export STRIP=/bin/true
make install prefix='%{buildroot}%{_prefix}'
make install-grpc-cli prefix='%{buildroot}%{_prefix}'
chrpath --delete '%{buildroot}%{_bindir}/%{name}_cli'
# Remove any static libraries that may have been installed against our wishes
find %{buildroot} -type f -name '*.a' -print -delete
# Fix wrong permissions on installed headers
find %{buildroot}%{_includedir}/%{name}* -type f -name '*.h' -perm /0111 \
-execdir chmod -v a-x '{}' '+'
# ~~~~ Python ~~~~
# Since several packages have an install_requires: grpcio-tools, we must ensure
# the buildroot Python site-packages directories are in the PYTHONPATH.
pushd '%{buildroot}'
PYROOT="${PWD}"
popd
if [ -n "${PYTHONPATH-}" ]; then PYTHONPATH="${PYTHONPATH}:"; fi
PYTHONPATH="${PYTHONPATH-}${PYROOT}%{python3_sitelib}"
PYTHONPATH="${PYTHONPATH}:${PYROOT}%{python3_sitearch}"
export PYTHONPATH
# ~~ grpcio ~~
%py3_install
%ldconfig_scriptlets
# ~~ grpcio-tools ~~
pushd "tools/distrib/python/grpcio_tools/" >/dev/null
%py3_install
popd >/dev/null
# ~~ pure-python modules grpcio-* ~~
for suffix in channelz health_checking reflection status testing
do
pushd "src/python/grpcio_${suffix}/" >/dev/null
%py3_install
popd >/dev/null
done
# ~~~~ Miscellaneous ~~~~
# Replace copies of the certificate bundle with symlinks to the shared system
# certificates. This has the following benefits:
# - Reduces duplication and save space
# - Respects system-wide administrative trust configuration
# - Keeps “MPLv2.0” from having to be added to a number of License fields
%global sysbundle %{_sysconfdir}/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
# We do not own this file; we temporarily install it in the buildroot so we do
# not have dangling symlinks.
install -D -t "%{buildroot}$(dirname '%{sysbundle}')" -m 0644 '%{sysbundle}'
find '%{buildroot}' -type f -name 'roots.pem' |
while read -r fn
do
ln -s -f "%{buildroot}%{sysbundle}" "${fn}"
symlinks -c -o "${fn}"
done
# ~~ documentation and examples ~~
install -D -t '%{buildroot}%{_pkgdocdir}' -m 0644 -p AUTHORS *.md
cp -rp doc examples '%{buildroot}%{_pkgdocdir}'
%global pythondocdir %{_docdir}/python-grpcio
install -d '%{buildroot}%{pythondocdir}'
cp -rp doc/build '%{buildroot}%{pythondocdir}/html'
%check
# TODO: Run C/C++ test suite.
pushd src/python/grpcio_tests
# Currently fails with
# ModuleNotFoundError: No module named 'grpc_channelz.v1.channelz_pb2'
# Will look into this if it continues on the latest version.
# See the implementation of the %%pytest macro, upon which our environment
# setup is based:
env \
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" \
LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \
PATH="%{buildroot}%{_bindir}:$PATH" \
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \
PYTHONDONTWRITEBYTECODE=1 \
%{__python3} %{py_setup} %{?py_setup_args} test_lite || :
popd
%files
%doc README.md
%license LICENSE
%{_libdir}/libaddress_sorting.so.9*
%{_libdir}/libgpr.so.9*
%{_libdir}/libgrpc++.so.1*
%{_libdir}/libgrpc++_error_details.so.1*
%{_libdir}/libgrpc++_reflection.so.1*
%{_libdir}/libgrpc++_unsecure.so.1*
%{_libdir}/libgrpc.so.9*
%{_libdir}/libgrpc_cronet.so.9*
%{_libdir}/libgrpc_unsecure.so.9*
%{_libdir}/libgrpcpp_channelz.so.1*
%{_libdir}/libup*.so.9*
%{_datadir}/grpc
%license LICENSE NOTICE.txt
%{_libdir}/libaddress_sorting.so.%{c_so_version}*
%{_libdir}/libgpr.so.%{c_so_version}*
%{_libdir}/lib%{name}.so.%{c_so_version}*
%{_libdir}/lib%{name}_cronet.so.%{c_so_version}*
%{_libdir}/lib%{name}_unsecure.so.%{c_so_version}*
%{_libdir}/libupb.so.%{c_so_version}*
%files data
%license LICENSE NOTICE.txt
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/roots.pem
# Actually part of ca-certificates dependency:
%exclude %{sysbundle}
%files doc
%license LICENSE NOTICE.txt
%{_pkgdocdir}
# Built Python documentation:
%exclude %{_pkgdocdir}/doc/build
# Python documentation sources:
%exclude %{_pkgdocdir}/doc/python/sphinx
%files cpp
%{_libdir}/lib%{name}++.so.%{cpp_so_version}*
%{_libdir}/lib%{name}++_error_details.so.%{cpp_so_version}*
%{_libdir}/lib%{name}++_reflection.so.%{cpp_so_version}*
%{_libdir}/lib%{name}++_unsecure.so.%{cpp_so_version}*
%{_libdir}/lib%{name}pp_channelz.so.%{cpp_so_version}*
%files cli
%{_bindir}/grpc_cli
%{_bindir}/%{name}_cli
%files plugins
%doc README.md
%license LICENSE
%{_bindir}/grpc_*_plugin
%{_bindir}/%{name}_*_plugin
%files devel
%{_libdir}/libaddress_sorting.so
%{_libdir}/libgpr.so
%{_libdir}/libgrpc++.so
%{_libdir}/libgrpc++_error_details.so
%{_libdir}/libgrpc++_reflection.so
%{_libdir}/libgrpc++_unsecure.so
%{_libdir}/libgrpc.so
%{_libdir}/libgrpc_cronet.so
%{_libdir}/libgrpc_unsecure.so
%{_libdir}/libgrpcpp_channelz.so
%{_libdir}/lib%{name}.so
%{_libdir}/lib%{name}_cronet.so
%{_libdir}/lib%{name}_unsecure.so
%{_libdir}/libupb.so
%{_libdir}/pkgconfig/*
%{_includedir}/grpc
%{_includedir}/grpc++
%{_includedir}/grpcpp
%{_includedir}/%{name}
%{_libdir}/pkgconfig/gpr.pc
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/pkgconfig/%{name}_unsecure.pc
%{_libdir}/lib%{name}++.so
%{_libdir}/lib%{name}++_error_details.so
%{_libdir}/lib%{name}++_reflection.so
%{_libdir}/lib%{name}++_unsecure.so
%{_includedir}/%{name}++
%{_libdir}/pkgconfig/%{name}++.pc
%{_libdir}/pkgconfig/%{name}++_unsecure.pc
%{_libdir}/lib%{name}pp_channelz.so
%{_includedir}/%{name}pp
%files -n python3-grpcio
%license LICENSE
%license LICENSE NOTICE.txt
%{python3_sitearch}/grpc
%{python3_sitearch}/grpcio-%{version}-py%{python3_version}.egg-info
%files -n python3-grpcio-tools
%{python3_sitearch}/grpc_tools
%{python3_sitearch}/grpcio_tools-%{version}-py%{python3_version}.egg-info
%files -n python3-grpcio-channelz
%{python3_sitelib}/grpc_channelz
%{python3_sitelib}/grpcio_channelz-%{version}-py%{python3_version}.egg-info
%files -n python3-grpcio-health-checking
%{python3_sitelib}/grpc_health
%{python3_sitelib}/grpcio_health_checking-%{version}-py%{python3_version}.egg-info
%files -n python3-grpcio-reflection
%{python3_sitelib}/grpc_reflection
%{python3_sitelib}/grpcio_reflection-%{version}-py%{python3_version}.egg-info
%files -n python3-grpcio-status
%{python3_sitelib}/grpc_status
%{python3_sitelib}/grpcio_status-%{version}-py%{python3_version}.egg-info
%files -n python3-grpcio-testing
%{python3_sitelib}/grpc_testing
%{python3_sitelib}/grpcio_testing-%{version}-py%{python3_version}.egg-info
%files -n python-grpcio-doc
%license LICENSE NOTICE.txt
%{pythondocdir}
%exclude %{pythondocdir}/html/.buildinfo
%exclude %{pythondocdir}/html/.doctrees
%changelog
* Tue Feb 2 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1.26.0-11
- General:
* Update summaries and descriptions
* Update License fields to include licenses from bundled components
* Fix failure to respect Fedora build flags
* Use the system shared certificate bundle instead of shipping our own
- CLI:
* No longer set rpath $ORIGIN
- C (core) and C++ (cpp):
* Add c_so_version/cpp_so_version macros
* Split out C++ bindings and shared data into subpackages
* Drop obsolete ldconfig_scriptlets macro
* Stop stripping debugging symbols
- Python:
* Use generated BRs
* Build and package Python binding documentation
* Disable accommodations for older libcs
* Patch out -std=gnu99 flag, which is inappropriate for C++
* Build additional Python packages grpcio_tools, gprcio_channelz,
grpcio_health_checking, grpcio_reflection, grpcio_status, and
grpcio_testing
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.26.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

View File

@ -1,12 +0,0 @@
diff -ruN grpc-1.26.0.orig/setup.py grpc-1.26.0/setup.py
--- grpc-1.26.0.orig/setup.py 2019-12-18 02:29:27.000000000 +0100
+++ grpc-1.26.0/setup.py 2020-12-09 08:41:38.202678255 +0100
@@ -179,7 +179,7 @@
# available dynamically
EXTRA_ENV_COMPILE_ARGS += ' /MT'
elif "linux" in sys.platform:
- EXTRA_ENV_COMPILE_ARGS += ' -std=gnu99 -fvisibility=hidden -fno-wrapv -fno-exceptions'
+ EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden -fno-wrapv -fno-exceptions'
elif "darwin" in sys.platform:
EXTRA_ENV_COMPILE_ARGS += ' -stdlib=libc++ -fvisibility=hidden -fno-wrapv -fno-exceptions'