Add: Python package python3-grpcio (#4233)
This commit is contained in:
parent
fd4cc549bc
commit
e4c77f5422
|
@ -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!"
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"Signatures": {
|
"Signatures": {
|
||||||
"grpc-1.42.0.tar.gz": "b2f2620c762427bfeeef96a68c1924319f384e877bc0e084487601e4cc6e434c"
|
"grpc-1.42.0.tar.gz": "b2f2620c762427bfeeef96a68c1924319f384e877bc0e084487601e4cc6e434c",
|
||||||
}
|
"grpc-1.42.0-submodules.tar.gz":"89adc6d52d4b75c9b623749106460d8be8f88524b5f8ea26b7fba3d69f1a8f32"
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,30 +1,39 @@
|
||||||
Summary: Open source remote procedure call (RPC) framework
|
Summary: Open source remote procedure call (RPC) framework
|
||||||
Name: grpc
|
Name: grpc
|
||||||
Version: 1.42.0
|
Version: 1.42.0
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
License: ASL 2.0
|
License: ASL 2.0
|
||||||
Vendor: Microsoft Corporation
|
Vendor: Microsoft Corporation
|
||||||
Distribution: Mariner
|
Distribution: Mariner
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: https://www.grpc.io
|
URL: https://www.grpc.io
|
||||||
Source0: https://github.com/grpc/grpc/archive/v%{version}/%{name}-%{version}.tar.gz
|
Source0: https://github.com/grpc/grpc/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||||
|
Source1: %{name}-%{version}-submodules.tar.gz
|
||||||
BuildRequires: abseil-cpp-devel
|
BuildRequires: abseil-cpp-devel
|
||||||
BuildRequires: c-ares-devel
|
BuildRequires: c-ares-devel
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: git
|
BuildRequires: git
|
||||||
BuildRequires: openssl-devel
|
|
||||||
BuildRequires: protobuf-devel
|
BuildRequires: protobuf-devel
|
||||||
BuildRequires: re2-devel
|
BuildRequires: re2-devel
|
||||||
BuildRequires: zlib-devel
|
BuildRequires: zlib-devel
|
||||||
|
BuildRequires: pkgconfig(openssl)
|
||||||
|
BuildRequires: ninja-build
|
||||||
Requires: abseil-cpp
|
Requires: abseil-cpp
|
||||||
Requires: c-ares
|
Requires: c-ares
|
||||||
Requires: openssl
|
Requires: openssl
|
||||||
Requires: protobuf
|
Requires: protobuf
|
||||||
Requires: zlib
|
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
|
%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.
|
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: %{name} = %{version}-%{release}
|
||||||
Requires: protobuf
|
Requires: protobuf
|
||||||
|
|
||||||
|
|
||||||
%description plugins
|
%description plugins
|
||||||
The grpc-plugins package contains the grpc 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
|
%prep
|
||||||
%autosetup
|
%setup -q -n %{name}-%{version}
|
||||||
|
%setup -T -D -a 1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# Updating used C++ version to be compatible with the build dependencies.
|
# 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}")
|
CXX_VERSION=$(c++ -dM -E -x c++ /dev/null | grep -oP "(?<=__cplusplus \d{2})\d{2}")
|
||||||
|
|
||||||
mkdir -p cmake/build
|
mkdir -p cmake/build
|
||||||
cd cmake/build
|
pushd cmake/build
|
||||||
cmake ../.. -DgRPC_INSTALL=ON \
|
%cmake ../.. -GNinja \
|
||||||
|
-DgRPC_INSTALL=ON \
|
||||||
-DBUILD_SHARED_LIBS=ON \
|
-DBUILD_SHARED_LIBS=ON \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DCMAKE_CXX_STANDARD=$CXX_VERSION \
|
-DCMAKE_CXX_STANDARD=$CXX_VERSION \
|
||||||
|
@ -67,12 +88,26 @@ cmake ../.. -DgRPC_INSTALL=ON \
|
||||||
-DgRPC_RE2_PROVIDER:STRING='package' \
|
-DgRPC_RE2_PROVIDER:STRING='package' \
|
||||||
-DgRPC_SSL_PROVIDER:STRING='package' \
|
-DgRPC_SSL_PROVIDER:STRING='package' \
|
||||||
-DgRPC_ZLIB_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
|
%install
|
||||||
cd cmake/build
|
pushd cmake/build
|
||||||
%make_install
|
%cmake_install
|
||||||
find %{buildroot} -name '*.cmake' -delete
|
find %{buildroot} -name '*.cmake' -delete
|
||||||
|
popd
|
||||||
|
#python
|
||||||
|
%py3_install
|
||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
|
@ -101,7 +136,16 @@ find %{buildroot} -name '*.cmake' -delete
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%{_bindir}/grpc_*_plugin
|
%{_bindir}/grpc_*_plugin
|
||||||
|
|
||||||
|
|
||||||
|
%files -n python3-grpcio
|
||||||
|
%license LICENSE
|
||||||
|
%{python3_sitearch}/grpc
|
||||||
|
%{python3_sitearch}/grpcio-%{version}-py%{python3_version}.egg-info
|
||||||
|
|
||||||
%changelog
|
%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
|
* Thu Jun 30 2022 Pawel Winogrodzki <pawelwi@microsoft.com> - 1.42.0-2
|
||||||
- Bumping release to rebuild with latest 'abseil-cpp'.
|
- Bumping release to rebuild with latest 'abseil-cpp'.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue