diff options
author | Mehrdad Afshari <mehrdada@users.noreply.github.com> | 2018-01-18 11:43:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-18 11:43:49 -0800 |
commit | b58d13394ca1c56b791ad8b5c6cd2f51b4ddc9cf (patch) | |
tree | fd2f57cdd72c279bbe772d724bc3724c69ade572 /tools/run_tests/artifacts | |
parent | d4031c3b934aae20cac538124007dc3eeb3a5bff (diff) | |
parent | 05668d49a6f9b28cdb6bca430c539e128a5cd578 (diff) |
Merge pull request #14071 from mehrdada/shellcheck
Add tools/run_tests/artifacts to shellcheck enforcement list
Diffstat (limited to 'tools/run_tests/artifacts')
-rwxr-xr-x | tools/run_tests/artifacts/build_artifact_csharp.sh | 2 | ||||
-rwxr-xr-x | tools/run_tests/artifacts/build_artifact_php.sh | 3 | ||||
-rwxr-xr-x | tools/run_tests/artifacts/build_artifact_protoc.sh | 2 | ||||
-rwxr-xr-x | tools/run_tests/artifacts/build_artifact_python.sh | 30 | ||||
-rwxr-xr-x | tools/run_tests/artifacts/build_artifact_ruby.sh | 8 | ||||
-rwxr-xr-x | tools/run_tests/artifacts/build_package_php.sh | 4 | ||||
-rwxr-xr-x | tools/run_tests/artifacts/build_package_python.sh | 4 | ||||
-rwxr-xr-x | tools/run_tests/artifacts/build_package_ruby.sh | 18 | ||||
-rwxr-xr-x | tools/run_tests/artifacts/run_in_workspace.sh | 8 |
9 files changed, 42 insertions, 37 deletions
diff --git a/tools/run_tests/artifacts/build_artifact_csharp.sh b/tools/run_tests/artifacts/build_artifact_csharp.sh index 0884a9e5d6..d65340261d 100755 --- a/tools/run_tests/artifacts/build_artifact_csharp.sh +++ b/tools/run_tests/artifacts/build_artifact_csharp.sh @@ -15,7 +15,7 @@ set -ex -cd $(dirname $0)/../../.. +cd "$(dirname "$0")/../../.." make grpc_csharp_ext diff --git a/tools/run_tests/artifacts/build_artifact_php.sh b/tools/run_tests/artifacts/build_artifact_php.sh index bfba956f05..9372dc9b6b 100755 --- a/tools/run_tests/artifacts/build_artifact_php.sh +++ b/tools/run_tests/artifacts/build_artifact_php.sh @@ -13,10 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -PHP_TARGET_ARCH=$1 set -ex -cd $(dirname $0)/../../.. +cd "$(dirname "$0")/../../.." mkdir -p "${ARTIFACTS_OUT}" diff --git a/tools/run_tests/artifacts/build_artifact_protoc.sh b/tools/run_tests/artifacts/build_artifact_protoc.sh index 5c5ab7d78f..b531fc9a5d 100755 --- a/tools/run_tests/artifacts/build_artifact_protoc.sh +++ b/tools/run_tests/artifacts/build_artifact_protoc.sh @@ -18,7 +18,7 @@ source scl_source enable devtoolset-1.1 set -ex -cd $(dirname $0)/../../.. +cd "$(dirname "$0")/../../.." make plugins diff --git a/tools/run_tests/artifacts/build_artifact_python.sh b/tools/run_tests/artifacts/build_artifact_python.sh index ab5bce04f9..10d8211e23 100755 --- a/tools/run_tests/artifacts/build_artifact_python.sh +++ b/tools/run_tests/artifacts/build_artifact_python.sh @@ -15,7 +15,7 @@ set -ex -cd $(dirname $0)/../../.. +cd "$(dirname "$0")/../../.." export GRPC_PYTHON_USE_CUSTOM_BDIST=0 export GRPC_PYTHON_BUILD_WITH_CYTHON=1 @@ -29,30 +29,30 @@ ARTIFACT_DIR="$PWD/${ARTIFACTS_OUT}" # Build the source distribution first because MANIFEST.in cannot override # exclusion of built shared objects among package resources (for some # inexplicable reason). -${SETARCH_CMD} ${PYTHON} setup.py sdist +${SETARCH_CMD} "${PYTHON}" setup.py sdist # Wheel has a bug where directories don't get excluded. # https://bitbucket.org/pypa/wheel/issues/99/cannot-exclude-directory -${SETARCH_CMD} ${PYTHON} setup.py bdist_wheel +${SETARCH_CMD} "${PYTHON}" setup.py bdist_wheel # Build gRPC tools package distribution -${PYTHON} tools/distrib/python/make_grpcio_tools.py +"${PYTHON}" tools/distrib/python/make_grpcio_tools.py # Build gRPC tools package source distribution -${SETARCH_CMD} ${PYTHON} tools/distrib/python/grpcio_tools/setup.py sdist +${SETARCH_CMD} "${PYTHON}" tools/distrib/python/grpcio_tools/setup.py sdist # Build gRPC tools package binary distribution -${SETARCH_CMD} ${PYTHON} tools/distrib/python/grpcio_tools/setup.py bdist_wheel +${SETARCH_CMD} "${PYTHON}" tools/distrib/python/grpcio_tools/setup.py bdist_wheel if [ "$GRPC_BUILD_MANYLINUX_WHEEL" != "" ] then for wheel in dist/*.whl; do - ${AUDITWHEEL} repair $wheel -w "$ARTIFACT_DIR" - rm $wheel + "${AUDITWHEEL}" repair "$wheel" -w "$ARTIFACT_DIR" + rm "$wheel" done for wheel in tools/distrib/python/grpcio_tools/dist/*.whl; do - ${AUDITWHEEL} repair $wheel -w "$ARTIFACT_DIR" - rm $wheel + "${AUDITWHEEL}" repair "$wheel" -w "$ARTIFACT_DIR" + rm "$wheel" done fi @@ -62,17 +62,17 @@ fi # are in a docker image or in a virtualenv. if [ "$GRPC_BUILD_GRPCIO_TOOLS_DEPENDENTS" != "" ] then - ${PIP} install -rrequirements.txt - ${PIP} install grpcio --no-index --find-links "file://$ARTIFACT_DIR/" - ${PIP} install grpcio-tools --no-index --find-links "file://$ARTIFACT_DIR/" + "${PIP}" install -rrequirements.txt + "${PIP}" install grpcio --no-index --find-links "file://$ARTIFACT_DIR/" + "${PIP}" install grpcio-tools --no-index --find-links "file://$ARTIFACT_DIR/" # Build gRPC health-checking source distribution - ${SETARCH_CMD} ${PYTHON} src/python/grpcio_health_checking/setup.py \ + ${SETARCH_CMD} "${PYTHON}" src/python/grpcio_health_checking/setup.py \ preprocess build_package_protos sdist cp -r src/python/grpcio_health_checking/dist/* "$ARTIFACT_DIR" # Build gRPC reflection source distribution - ${SETARCH_CMD} ${PYTHON} src/python/grpcio_reflection/setup.py \ + ${SETARCH_CMD} "${PYTHON}" src/python/grpcio_reflection/setup.py \ preprocess build_package_protos sdist cp -r src/python/grpcio_reflection/dist/* "$ARTIFACT_DIR" fi diff --git a/tools/run_tests/artifacts/build_artifact_ruby.sh b/tools/run_tests/artifacts/build_artifact_ruby.sh index 9165a22484..5ab4cf21b4 100755 --- a/tools/run_tests/artifacts/build_artifact_ruby.sh +++ b/tools/run_tests/artifacts/build_artifact_ruby.sh @@ -14,9 +14,9 @@ # limitations under the License. set -ex -SYSTEM=`uname | cut -f 1 -d_` +SYSTEM=$(uname | cut -f 1 -d_) -cd $(dirname $0)/../../.. +cd "$(dirname "$0")/../../.." set +ex [[ -s /etc/profile.d/rvm.sh ]] && . /etc/profile.d/rvm.sh [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" @@ -46,7 +46,9 @@ export DOCKERHUB_ORGANIZATION=grpctesting rake gem:native if [ "$SYSTEM" == "Darwin" ] ; then - rm `ls pkg/*.gem | grep -v darwin` + # TODO: consider rewriting this to pass shellcheck + # shellcheck disable=SC2046,SC2010 + rm $(ls pkg/*.gem | grep -v darwin) fi mkdir -p "${ARTIFACTS_OUT}" diff --git a/tools/run_tests/artifacts/build_package_php.sh b/tools/run_tests/artifacts/build_package_php.sh index d2d1e8d459..85e4dda40a 100755 --- a/tools/run_tests/artifacts/build_package_php.sh +++ b/tools/run_tests/artifacts/build_package_php.sh @@ -15,7 +15,7 @@ set -ex -cd $(dirname $0)/../../.. +cd "$(dirname "$0")/../../.." mkdir -p artifacts/ -cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/php_*/* artifacts/ || true +cp -r "$EXTERNAL_GIT_ROOT"/platform={windows,linux,macos}/artifacts/php_*/* artifacts/ || true diff --git a/tools/run_tests/artifacts/build_package_python.sh b/tools/run_tests/artifacts/build_package_python.sh index 1d9d04e3c0..d596e35000 100755 --- a/tools/run_tests/artifacts/build_package_python.sh +++ b/tools/run_tests/artifacts/build_package_python.sh @@ -15,13 +15,13 @@ set -ex -cd $(dirname $0)/../../.. +cd "$(dirname "$0")/../../.." mkdir -p artifacts/ # All the python packages have been built in the artifact phase already # and we only collect them here to deliver them to the distribtest phase. -cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/python_*/* artifacts/ || true +cp -r "$EXTERNAL_GIT_ROOT"/platform={windows,linux,macos}/artifacts/python_*/* artifacts/ || true # TODO: all the artifact builder configurations generate a grpcio-VERSION.tar.gz # source distribution package, and only one of them will end up diff --git a/tools/run_tests/artifacts/build_package_ruby.sh b/tools/run_tests/artifacts/build_package_ruby.sh index b7e0965ffe..0283c43843 100755 --- a/tools/run_tests/artifacts/build_package_ruby.sh +++ b/tools/run_tests/artifacts/build_package_ruby.sh @@ -15,7 +15,7 @@ set -ex -cd $(dirname $0)/../../.. +cd "$(dirname "$0")/../../.." base=$(pwd) @@ -23,7 +23,7 @@ mkdir -p artifacts/ # All the ruby packages have been built in the artifact phase already # and we only collect them here to deliver them to the distribtest phase. -cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/ruby_native_gem_*/* artifacts/ || true +cp -r "$EXTERNAL_GIT_ROOT"/platform={windows,linux,macos}/artifacts/ruby_native_gem_*/* artifacts/ || true well_known_protos=( any api compiler/plugin descriptor duration empty field_mask source_context struct timestamp type wrappers ) @@ -43,16 +43,16 @@ for arch in {x86,x64}; do for plat in {windows,linux,macos}; do input_dir="$EXTERNAL_GIT_ROOT/platform=${plat}/artifacts/protoc_${plat}_${arch}" output_dir="$base/src/ruby/tools/bin/${ruby_arch}-${plat}" - mkdir -p $output_dir/google/protobuf - mkdir -p $output_dir/google/protobuf/compiler # needed for plugin.proto - cp $input_dir/protoc* $output_dir/ - cp $input_dir/grpc_ruby_plugin* $output_dir/ + mkdir -p "$output_dir"/google/protobuf + mkdir -p "$output_dir"/google/protobuf/compiler # needed for plugin.proto + cp "$input_dir"/protoc* "$output_dir"/ + cp "$input_dir"/grpc_ruby_plugin* "$output_dir"/ for proto in "${well_known_protos[@]}"; do - cp $base/third_party/protobuf/src/google/protobuf/$proto.proto $output_dir/google/protobuf/$proto.proto + cp "$base/third_party/protobuf/src/google/protobuf/$proto.proto" "$output_dir/google/protobuf/$proto.proto" done done done -cd $base/src/ruby/tools +cd "$base/src/ruby/tools" gem build grpc-tools.gemspec -cp ./grpc-tools*.gem $base/artifacts/ +cp ./grpc-tools*.gem "$base/artifacts/" diff --git a/tools/run_tests/artifacts/run_in_workspace.sh b/tools/run_tests/artifacts/run_in_workspace.sh index 5b8af6ab53..20181e077c 100755 --- a/tools/run_tests/artifacts/run_in_workspace.sh +++ b/tools/run_tests/artifacts/run_in_workspace.sh @@ -18,15 +18,19 @@ # All cmdline args will be executed as a command. set -ex -cd $(dirname $0)/../../.. +cd "$(dirname "$0")/../../.." export repo_root=$(pwd) +# TODO: fix file to pass shellcheck + rm -rf "${WORKSPACE_NAME}" git clone . "${WORKSPACE_NAME}" # clone gRPC submodules, use data from locally cloned submodules where possible +# shellcheck disable=SC1004,SC2016 git submodule foreach 'cd "${repo_root}/${WORKSPACE_NAME}" \ && git submodule update --init --reference ${repo_root}/${name} ${name}' echo "Running in workspace ${WORKSPACE_NAME}" -cd ${WORKSPACE_NAME} +cd "${WORKSPACE_NAME}" +# shellcheck disable=SC2068 $@ |