Add: Python package python3-grpcio (#4233)

This commit is contained in:
Riken Maharjan 2022-11-15 14:37:11 -08:00 committed by GitHub
parent fd4cc549bc
commit e4c77f5422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 158 additions and 15 deletions

View File

@ -0,0 +1,98 @@
#!/bin/bash
set -e
SRC_TARBALL=""
OUT_FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PKG_VERSION=""
# parameters:
#
# --srcTarball : src tarball file
# this file contains the 'initial' source code of the component
# and should be replaced with the new/modified src code
# --outFolder : folder where to copy the new tarball(s)
# --pkgVersion : package version
#
PARAMS=""
while (( "$#" )); do
case "$1" in
--srcTarball)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
SRC_TARBALL=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
--outFolder)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
OUT_FOLDER=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
--pkgVersion)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
PKG_VERSION=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
-*|--*=) # unsupported flags
echo "Error: Unsupported flag $1" >&2
exit 1
;;
*) # preserve positional arguments
PARAMS="$PARAMS $1"
shift
;;
esac
done
echo "--srcTarball -> $SRC_TARBALL"
echo "--outFolder -> $OUT_FOLDER"
echo "--pkgVersion -> $PKG_VERSION"
if [ -z "$PKG_VERSION" ]; then
echo "--pkgVersion parameter cannot be empty"
exit 1
fi
echo "-- create temp folder"
TEMPDIR=$(mktemp -d)
function cleanup {
echo "+++ cleanup -> remove $TEMPDIR"
rm -rf $TEMPDIR
}
trap cleanup EXIT
echo 'Starting gRPC source tarball creation'
cd $TEMPDIR
git clone --depth 1 https://github.com/grpc/grpc.git
pushd grpc
git fetch --all --tags
git checkout tags/v$PKG_VERSION -b grpc-$PKG_VERSION
git submodule update --init
popd
mv grpc/third_party third_party
TARBALL_NAME="grpc-$PKG_VERSION-submodules.tar.gz"
NEW_TARBALL="$OUT_FOLDER/$TARBALL_NAME"
# Create a reproducible tarball
# Credit to https://reproducible-builds.org/docs/archives/ for instructions
# Do not update mtime value for new versions- keep the same value for ease of
# reproducing old tarball versions in the future if necessary
tar --sort=name --mtime="2021-11-10 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-zcf $NEW_TARBALL third_party
echo "Source tarball $NEW_TARBALL successfully created!"

View File

@ -1,5 +1,6 @@
{
"Signatures": {
"grpc-1.42.0.tar.gz": "b2f2620c762427bfeeef96a68c1924319f384e877bc0e084487601e4cc6e434c"
}
}
"Signatures": {
"grpc-1.42.0.tar.gz": "b2f2620c762427bfeeef96a68c1924319f384e877bc0e084487601e4cc6e434c",
"grpc-1.42.0-submodules.tar.gz":"89adc6d52d4b75c9b623749106460d8be8f88524b5f8ea26b7fba3d69f1a8f32"
}
}

View File

@ -1,30 +1,39 @@
Summary: Open source remote procedure call (RPC) framework
Name: grpc
Version: 1.42.0
Release: 2%{?dist}
Release: 3%{?dist}
License: ASL 2.0
Vendor: Microsoft Corporation
Distribution: Mariner
Group: Applications/System
URL: https://www.grpc.io
Source0: https://github.com/grpc/grpc/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: %{name}-%{version}-submodules.tar.gz
BuildRequires: abseil-cpp-devel
BuildRequires: c-ares-devel
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: git
BuildRequires: openssl-devel
BuildRequires: protobuf-devel
BuildRequires: re2-devel
BuildRequires: zlib-devel
BuildRequires: pkgconfig(openssl)
BuildRequires: ninja-build
Requires: abseil-cpp
Requires: c-ares
Requires: openssl
Requires: protobuf
Requires: zlib
# Python
BuildRequires: build-essential
BuildRequires: python3-devel
BuildRequires: python3-Cython
BuildRequires: python3-six
BuildRequires: python3-wheel
BuildRequires: python3-setuptools
BuildRequires: python3-protobuf
%description
gRPC is a modern, open source, high-performance remote procedure call (RPC) framework that can run anywhere. It enables client and server applications to communicate transparently, and simplifies the building of connected systems.
@ -42,11 +51,22 @@ Summary: Plugins files for grpc
Requires: %{name} = %{version}-%{release}
Requires: protobuf
%description plugins
The grpc-plugins package contains the grpc plugins.
%package -n python3-grpcio
Summary: Python language bindings for gRPC
Requires: %{name} = %{version}-%{release}
Requires: python3-six
%{?python_provide:%python_provide python3-grpcio}
%description -n python3-grpcio
Python language bindings for gRPC.
%prep
%autosetup
%setup -q -n %{name}-%{version}
%setup -T -D -a 1
%build
# Updating used C++ version to be compatible with the build dependencies.
@ -55,8 +75,9 @@ The grpc-plugins package contains the grpc plugins.
CXX_VERSION=$(c++ -dM -E -x c++ /dev/null | grep -oP "(?<=__cplusplus \d{2})\d{2}")
mkdir -p cmake/build
cd cmake/build
cmake ../.. -DgRPC_INSTALL=ON \
pushd cmake/build
%cmake ../.. -GNinja \
-DgRPC_INSTALL=ON \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=$CXX_VERSION \
@ -67,12 +88,26 @@ cmake ../.. -DgRPC_INSTALL=ON \
-DgRPC_RE2_PROVIDER:STRING='package' \
-DgRPC_SSL_PROVIDER:STRING='package' \
-DgRPC_ZLIB_PROVIDER:STRING='package'
%make_build
%cmake_build
popd
#python
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_BUILD_SYSTEM_RE2=True
export GRPC_PYTHON_BUILD_SYSTEM_ABSL=True
%py3_build
%install
cd cmake/build
%make_install
pushd cmake/build
%cmake_install
find %{buildroot} -name '*.cmake' -delete
popd
#python
%py3_install
%files
%license LICENSE
@ -101,7 +136,16 @@ find %{buildroot} -name '*.cmake' -delete
%license LICENSE
%{_bindir}/grpc_*_plugin
%files -n python3-grpcio
%license LICENSE
%{python3_sitearch}/grpc
%{python3_sitearch}/grpcio-%{version}-py%{python3_version}.egg-info
%changelog
* Wed Nov 09 2022 Riken Maharjan <rmaharjan@microsoft.com> - 1.42.0-3
- Add 'python3-grpcio' subpackage using Fedora 37 spec for guidance.
* Thu Jun 30 2022 Pawel Winogrodzki <pawelwi@microsoft.com> - 1.42.0-2
- Bumping release to rebuild with latest 'abseil-cpp'.
@ -129,4 +173,4 @@ find %{buildroot} -name '*.cmake' -delete
- Switch to system provided packages for zlib and openssl.
* Mon Mar 08 2021 Neha Agarwal <nehaagarwal@microsoft.com> - 1.35.0-1
- Original version for CBL-Mariner. License Verified.
- Original version for CBL-Mariner. License Verified.