IMPALA-5716: Don't delete cmake_modules/* when enabling distcc If $IMPALA_HOME ends with a /, the clean_cmake_files function in distcc_env.sh will emit a find command with a double // at the end for the cmake_modules directory, and since it contains the substring cmake, find will match and delete its contents.
Fix is to use a whitelist of locations and filenames to look for, and delete only those. Testing: manually ran enable_distcc, observed that my files were still there. Change-Id: I8a6e34bedf8000aed9e2b0597cfe86f73222c6ed Reviewed-on: http://gerrit.cloudera.org:8080/7493 Reviewed-by: Tim Armstrong <[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/41e3055f Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/41e3055f Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/41e3055f Branch: refs/heads/master Commit: 41e3055f925093f971a3a800ae9601728ff9e37c Parents: 78845e5 Author: Henry Robinson <[email protected]> Authored: Mon Jul 24 17:50:02 2017 -0700 Committer: Impala Public Jenkins <[email protected]> Committed: Wed Jul 26 22:08:35 2017 +0000 ---------------------------------------------------------------------- bin/clean.sh | 13 ++++++------- bin/distcc/distcc_env.sh | 14 ++++++-------- 2 files changed, 12 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/41e3055f/bin/clean.sh ---------------------------------------------------------------------- diff --git a/bin/clean.sh b/bin/clean.sh index 8c009c7..aeb6067 100755 --- a/bin/clean.sh +++ b/bin/clean.sh @@ -74,10 +74,9 @@ if [ -e "$IMPALA_LZO" ]; then fi # When switching to and from toolchain, make sure to remove all CMake generated files -FIND_ARGS=("$IMPALA_HOME" -iname '*cmake*' -not -name CMakeLists.txt \ - -not -path "$IMPALA_HOME/cmake_modules*" \ - -not -path "$IMPALA_HOME/thirdparty*") -if [[ -n "$IMPALA_TOOLCHAIN" ]]; then - FIND_ARGS+=(-not -path "$IMPALA_TOOLCHAIN/*") -fi -find "${FIND_ARGS[@]}" -exec rm -Rf {} + +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/41e3055f/bin/distcc/distcc_env.sh ---------------------------------------------------------------------- diff --git a/bin/distcc/distcc_env.sh b/bin/distcc/distcc_env.sh index 28d8096..e1129e3 100644 --- a/bin/distcc/distcc_env.sh +++ b/bin/distcc/distcc_env.sh @@ -114,14 +114,12 @@ function clean_cmake_files { echo IMPALA_HOME=$IMPALA_HOME is not valid. 1>&2 return 1 fi - # Copied from $IMPALA_HOME/bin/clean.sh. - FIND_ARGS=("$IMPALA_HOME" -iname '*cmake*' -not -name CMakeLists.txt \ - -not -path "$IMPALA_HOME/cmake_modules*" \ - -not -path "$IMPALA_HOME/thirdparty*") - if [[ -n "$IMPALA_TOOLCHAIN" ]]; then - FIND_ARGS+=(-not -path "$IMPALA_TOOLCHAIN/*") - fi - find "${FIND_ARGS[@]}" -exec rm -Rf {} + + 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 } function switch_compiler {
