Repository: incubator-impala
Updated Branches:
  refs/heads/master fc275fab6 -> f87da848f


IMPALA-5927: Fix enable_distcc for zsh

enable_distcc didn't work on zsh anymore since it relies on automatic
variable splitting, which only works in bash.

This change moves clean-up actions for cmake files into an own bash
script.

This change also unifies variable quoting in clean.sh.

Change-Id: I88284e4f68c309bb46ce4b5a842ccc576cd487ed
Reviewed-on: http://gerrit.cloudera.org:8080/8049
Reviewed-by: Lars Volker <[email protected]>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/fa93a47d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/fa93a47d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/fa93a47d

Branch: refs/heads/master
Commit: fa93a47dd70ad23d45dfc8b9498d00a4c52e54da
Parents: fc275fa
Author: Lars Volker <[email protected]>
Authored: Tue Sep 12 21:32:58 2017 -0700
Committer: Impala Public Jenkins <[email protected]>
Committed: Thu Sep 21 00:56:36 2017 +0000

----------------------------------------------------------------------
 bin/clean-cmake.sh       | 36 ++++++++++++++++++++++++++++++++++++
 bin/clean.sh             | 30 +++++++++++++-----------------
 bin/distcc/distcc_env.sh |  7 +------
 3 files changed, 50 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/fa93a47d/bin/clean-cmake.sh
----------------------------------------------------------------------
diff --git a/bin/clean-cmake.sh b/bin/clean-cmake.sh
new file mode 100755
index 0000000..a708391
--- /dev/null
+++ b/bin/clean-cmake.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+# Removes artifacts generated by cmake.
+
+set -euo pipefail
+trap 'echo Error in ${0} at line ${LINENO}: $(cd "'${PWD}'" && awk "NR == 
${LINENO}" \
+  ${0})' ERR
+
+if [[ -z "${IMPALA_HOME}" || ! -d "${IMPALA_HOME}" ]]; then
+  echo IMPALA_HOME=${IMPALA_HOME} is not valid. 1>&2
+  exit 1
+fi
+# Remove trailing /
+ROOT_DIR=${IMPALA_HOME%%/}
+for loc in "${ROOT_DIR}/ -maxdepth 1" "${ROOT_DIR}/be/" "${ROOT_DIR}/fe/" 
"${ROOT_DIR}/common/"\
+           "${ROOT_DIR}/ext-data-source/"; do
+  find ${loc} \( -iname CMakeCache.txt -o -iname CMakeFiles \
+       -o -iname CTestTestfile.cmake -o -iname cmake_install.cmake \) -exec rm 
-Rf {} +
+done

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/fa93a47d/bin/clean.sh
----------------------------------------------------------------------
diff --git a/bin/clean.sh b/bin/clean.sh
index aeb6067..a8a42c1 100755
--- a/bin/clean.sh
+++ b/bin/clean.sh
@@ -22,36 +22,37 @@
 # branch to a non-toolchain branch due to caching in CMake generated files.
 
 set -euo pipefail
-trap 'echo Error in $0 at line $LINENO: $(cd "'$PWD'" && awk "NR == $LINENO" 
$0)' ERR
+trap 'echo Error in ${0} at line ${LINENO}: $(cd "'${PWD}'" && awk "NR == 
${LINENO}" \
+  ${0})' ERR
 
 # If the project was never build, no Makefile will exist and thus make clean 
will fail.
 # Combine the make command with the bash noop to always return true.
 "${MAKE_CMD:-make}" clean || :
 
 # clean the external data source project
-pushd ${IMPALA_HOME}/ext-data-source
+pushd "${IMPALA_HOME}/ext-data-source"
 rm -rf api/generated-sources/*
 ${IMPALA_HOME}/bin/mvn-quiet.sh clean
 popd
 
 # clean fe
 # don't use git clean because we need to retain Eclipse conf files
-pushd $IMPALA_FE_DIR
+pushd "${IMPALA_FE_DIR}"
 rm -rf target
 rm -f src/test/resources/{core,hbase,hive}-site.xml
 rm -rf generated-sources/*
-[ -z "$IMPALA_LOGS_DIR" ] || rm -rf "${IMPALA_LOGS_DIR}"/*
-mkdir -p $IMPALA_ALL_LOGS_DIRS
+[ -z "${IMPALA_LOGS_DIR}" ] || rm -rf "${IMPALA_LOGS_DIR}"/*
+mkdir -p "${IMPALA_ALL_LOGS_DIRS}"
 popd
 
 # clean be
-pushd "$IMPALA_HOME/be"
+pushd "${IMPALA_HOME}/be"
 # remove everything listed in .gitignore
 git rev-parse 2>/dev/null && git clean -Xdfq
 popd
 
 # clean shell build artifacts
-pushd "$IMPALA_HOME/shell"
+pushd "${IMPALA_HOME}/shell"
 # remove everything listed in .gitignore
 git rev-parse 2>/dev/null && git clean -Xdfq
 popd
@@ -63,20 +64,15 @@ find . -type d -name "__pycache__" -delete
 popd
 
 # clean llvm
-rm -f "$IMPALA_HOME/llvm-ir/"impala*.ll
-rm -f "$IMPALA_HOME/be/generated-sources/impala-ir/"*
+rm -f "${IMPALA_HOME}/llvm-ir/"impala*.ll
+rm -f "${IMPALA_HOME}/be/generated-sources/impala-ir/"*
 
 # Cleanup Impala-lzo
-if [ -e "$IMPALA_LZO" ]; then
-  pushd "$IMPALA_LZO"
+if [ -e "${IMPALA_LZO}" ]; then
+  pushd "${IMPALA_LZO}"
   git rev-parse 2>/dev/null && git clean -fdx
   popd
 fi
 
 # When switching to and from toolchain, make sure to remove all CMake 
generated files
-ROOT_DIR=${IMPALA_HOME%%/}
-for loc in "${ROOT_DIR}/ -maxdepth 1" "$ROOT_DIR/be/" "$ROOT_DIR/fe/" 
"$ROOT_DIR/common/"\
-           "$ROOT_DIR/ext-data-source/"; do
-  find $loc \( -iname CMakeCache.txt -o -iname CMakeFiles \
-       -o -iname CTestTestfile.cmake -o -iname cmake_install.cmake \) -exec rm 
-Rf {} +
-done
+"${IMPALA_HOME}/bin/clean-cmake.sh"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/fa93a47d/bin/distcc/distcc_env.sh
----------------------------------------------------------------------
diff --git a/bin/distcc/distcc_env.sh b/bin/distcc/distcc_env.sh
index e1129e3..92e27a7 100644
--- a/bin/distcc/distcc_env.sh
+++ b/bin/distcc/distcc_env.sh
@@ -114,12 +114,7 @@ function clean_cmake_files {
     echo IMPALA_HOME=$IMPALA_HOME is not valid. 1>&2
     return 1
   fi
-  ROOT_DIR=${IMPALA_HOME%%/}
-  for loc in "${ROOT_DIR}/ -maxdepth 1" "$ROOT_DIR/be/" "$ROOT_DIR/fe/" \
-             "$ROOT_DIR/common/" "$ROOT_DIR/ext-data-source/"; do
-    find $loc \( -iname CMakeCache.txt -o -iname CMakeFiles \
-         -o -iname CTestTestfile.cmake -o -iname cmake_install.cmake \) -exec 
rm -Rf {} +
-  done
+  $IMPALA_HOME/bin/clean-cmake.sh
 }
 
 function switch_compiler {

Reply via email to