Remove docker, and update scripts

pull/21194/head
Muxi Yan 5 years ago
parent fc4a780207
commit 67d70ee059
  1. 487
      src/objective-c/BoringSSL-GRPC.podspec
  2. 14
      templates/src/objective-c/BoringSSL-GRPC.podspec.template
  3. 18
      tools/distrib/check_boringssl_prefix_symbol.sh
  4. 60
      tools/distrib/generate_boringssl_prefix_header.sh
  5. 44
      tools/distrib/upgrade_boringssl_objc.sh
  6. 36
      tools/dockerfile/grpc_objc/generate_boringssl_prefix_header/Dockerfile
  7. 41
      tools/dockerfile/grpc_objc/generate_boringssl_prefix_header/generate_boringssl_prefix_header.sh
  8. 1
      tools/dockerfile/test/sanity/Dockerfile

File diff suppressed because one or more lines are too long

@ -1,8 +1,14 @@
%YAML 1.2
--- |
<%!
import subprocess
import subprocess, base64
import gzip
boringssl_commit = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd='third_party/boringssl').decode().strip()
prefix_f = open("src/boringssl/boringssl_prefix_symbols.h", "rb")
prefix = prefix_f.read()
prefix_gzip = gzip.compress(prefix)
prefix_gzip_b64 = base64.b64encode(prefix_gzip)
prefix_f.close()
%>
# This file has been automatically generated from a template file.
@ -232,11 +238,9 @@
# outputs a gzip+base64 encoded version of boringssl_prefix_symbols.h because of Cocoapods'
# limit on the 'prepare_command' field length. The encoded header is put at
# /src/boringssl/boringssl_prefix_symbols.h.gz.b64. Here we decode the content and inject
# the header to correcty location in BoringSSL.
# the header to the correct location in BoringSSL.
base64 -D <<EOF | gunzip > include/openssl/boringssl_prefix_symbols.h
% for line in open("src/boringssl/boringssl_prefix_symbols.h.gz.b64", "r").readlines():
${line}\
% endfor
${prefix_gzip_b64}
EOF
# We are renaming openssl to openssl_grpc so that there is no conflict with openssl if it exists

@ -20,20 +20,8 @@ cd "$(dirname $0)"
cd ../../third_party/boringssl
BORINGSSL_COMMIT=$(git rev-parse HEAD)
PREFIX_SYMBOLS_COMMIT=$(cat ../../src/boringssl/boringssl_prefix_symbols.h | head -n1 | awk '{print $NF}')
mkdir -p ./build
cd build
cmake ..
make -j4
go run ../util/read_symbols.go ssl/libssl.a > ./symbols.txt
go run ../util/read_symbols.go crypto/libcrypto.a >> ./symbols.txt
[ $BORINGSSL_COMMIT == $PREFIX_SYMBOLS_COMMIT ] || { echo "The BoringSSL commit does not match the commit of the prefix symbols (src/boringssl/boringssl_prefix_symbols.h). Run tools/distrib/regenerate_boringssl_prefix_symbols.sh to update the prefix symbols." ; exit 1 ; }
cmake .. -DBORINGSSL_PREFIX=GRPC -DBORINGSSL_PREFIX_SYMBOLS=symbols.txt
make boringssl_prefix_symbols
gzip -c symbol_prefix_include/boringssl_prefix_symbols.h | base64 > boringssl_prefix_symbols.h.gz.b64
diff ../../../src/boringssl/boringssl_prefix_symbols.h.gz.b64 boringssl_prefix_symbols.h.gz.b64
result=$?
exit $result
exit 0

@ -0,0 +1,60 @@
#!/bin/bash
# Copyright 2018 gRPC authors.
#
# 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.
# Generate the list of boringssl symbols that need to be renamed based on the
# current boringssl submodule. The script should be run after a boringssl
# upgrade in third_party/boringssl. Note that after the script is run, you will
# typically need to manually upgrade the BoringSSL-GRPC podspec
# (templates/src/objective-c/BoringSSL-GRPC.podspec.template) version and the
# corresponding version number in gRPC-Core podspec
# (templates/gRPC-Core.podspec.template).
set -ev
cd "$(dirname $0)"
cd ../../third_party/boringssl
BORINGSSL_COMMIT=$(git rev-parse HEAD)
BORINGSSL_PREFIX_HEADERS_DIR=src/boringssl
# generate the prefix header
mkdir -p build
cd build
cmake ..
make clean
make -j
[ -f ssl/libssl.a ] || { echo "Failed to build libssl.a" ; exit 1 ; }
[ -f crypto/libcrypto.a ] || { echo "Failed to build libcrypto.a" ; exit 1 ; }
go run ../util/read_symbols.go ssl/libssl.a > ./symbols.txt
go run ../util/read_symbols.go crypto/libcrypto.a >> ./symbols.txt
# generates boringssl_prefix_symbols.h
cmake .. -DBORINGSSL_PREFIX=GRPC -DBORINGSSL_PREFIX_SYMBOLS=symbols.txt
make boringssl_prefix_symbols
[ -f symbol_prefix_include/boringssl_prefix_symbols.h ] || { echo "Failed to build boringssl_prefix_symbols.sh" ; exit 1 ; }
cd ../../..
mkdir -p $BORINGSSL_PREFIX_HEADERS_DIR
echo "// generated by generate_boringssl_prefix_header.sh on BoringSSL commit: $BORINGSSL_COMMIT" > $BORINGSSL_PREFIX_HEADERS_DIR/boringssl_prefix_symbols.h
echo "" >> $BORINGSSL_PREFIX_HEADERS_DIR/boringssl_prefix_symbols.h
cat third_party/boringssl/build/symbol_prefix_include/boringssl_prefix_symbols.h >> $BORINGSSL_PREFIX_HEADERS_DIR/boringssl_prefix_symbols.h
# Regenerated the project
tools/buildgen/generate_projects.sh
exit 0

@ -1,44 +0,0 @@
#!/bin/bash
# Copyright 2018 gRPC authors.
#
# 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.
# Generate the list of boringssl symbols that need to be shadowed based on the
# current boringssl submodule. Requires local toolchain to build boringssl.
set -e
cd "$(dirname $0)"
cd ../../third_party/boringssl
BORINGSSL_COMMIT=$(git rev-parse HEAD)
BORINGSSL_PREFIX_HEADERS_DIR=src/boringssl
# Do the following in grpc root directory
cd ../..
docker build tools/dockerfile/grpc_objc/generate_boringssl_prefix_header -t grpc/boringssl_prefix_header
mkdir -p $BORINGSSL_PREFIX_HEADERS_DIR
docker run -it --rm -v $(pwd)/$BORINGSSL_PREFIX_HEADERS_DIR:/output grpc/boringssl_prefix_header $BORINGSSL_COMMIT
# Increase the minor version by 1
POD_VER=$(cat templates/src/objective-c/BoringSSL-GRPC.podspec.template | grep 'version = ' | perl -pe '($_)=/([0-9]+([.][0-9]+)+)/')
POD_VER_NEW="${POD_VER%.*}.$((${POD_VER##*.}+1))"
sed -i.grpc_back -e "s/version = '$POD_VER'/version = '$POD_VER_NEW'/g" templates/src/objective-c/BoringSSL-GRPC.podspec.template
sed -i.grpc_back -e "s/dependency 'BoringSSL-GRPC', '$POD_VER'/dependency 'BoringSSL-GRPC', '$POD_VER_NEW'/g" templates/gRPC-Core.podspec.template
rm templates/src/objective-c/BoringSSL-GRPC.podspec.template.grpc_back templates/gRPC-Core.podspec.template.grpc_back
# Regenerated the project
tools/buildgen/generate_projects.sh
exit 0

@ -1,36 +0,0 @@
# Copyright 2019 gRPC authors.
#
# 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.
FROM debian:buster
ENV BORINGSSL_COMMIT=master
RUN apt-get update && apt-get install -y \
autoconf \
cmake \
curl \
g++ \
gcc \
git \
gnupg \
golang \
perl
COPY generate_boringssl_prefix_header.sh /
VOLUME /output
WORKDIR /
ENTRYPOINT ["/generate_boringssl_prefix_header.sh"]

@ -1,41 +0,0 @@
#!/bin/bash
# Copyright 2019 gRPC authors.
#
# 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.
[ $# == 1 ] || { echo "Usage: generate_boringssl_prefix_header.sh <boringssl_commit>" ; exit 1 ; }
git clone -n https://github.com/google/boringssl.git
cd boringssl
git checkout $1 || { echo "Unable to checkout the commit $1" ; exit 1 ; }
mkdir build
cd build
cmake ..
# gcc crashes on docker when using -j with too many cores. Limiting to 4 seems to be fine.
make -j4
[ -f ssl/libssl.a ] || { echo "Failed to build libssl.a" ; exit 1 ; }
[ -f crypto/libcrypto.a ] || { echo "Failed to build libcrypto.a" ; exit 1 ; }
go run ../util/read_symbols.go ssl/libssl.a > ./symbols.txt
go run ../util/read_symbols.go crypto/libcrypto.a >> ./symbols.txt
cmake .. -DBORINGSSL_PREFIX=GRPC -DBORINGSSL_PREFIX_SYMBOLS=symbols.txt
make boringssl_prefix_symbols
[ -f symbol_prefix_include/boringssl_prefix_symbols.h ] || { echo "Failed to build boringssl_prefix_symbols.sh" ; exit 1 ; }
gzip -c symbol_prefix_include/boringssl_prefix_symbols.h | base64 > /output/boringssl_prefix_symbols.h.gz.b64
exit 0

@ -21,7 +21,6 @@ RUN apt-get update && apt-get install -y \
build-essential \
bzip2 \
ccache \
cmake \
curl \
dnsutils \
gcc \

Loading…
Cancel
Save