You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@yetus.apache.org by aw...@apache.org on 2020/09/10 21:52:10 UTC
[yetus] branch master updated: YETUS-978: missing exclusions file
should not be fatal (#118)
This is an automated email from the ASF dual-hosted git repository.
aw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yetus.git
The following commit(s) were added to refs/heads/master by this push:
new 97a6687 YETUS-978: missing exclusions file should not be fatal (#118)
97a6687 is described below
commit 97a6687484cb147864849019a57e6e49112afb7e
Author: Allen Wittenauer <aw...@apache.org>
AuthorDate: Thu Sep 10 14:52:01 2020 -0700
YETUS-978: missing exclusions file should not be fatal (#118)
---
precommit/src/main/shell/core.d/change-analysis.sh | 34 +++++++++++++++++++++-
precommit/src/main/shell/test-patch.sh | 8 ++---
2 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/precommit/src/main/shell/core.d/change-analysis.sh b/precommit/src/main/shell/core.d/change-analysis.sh
index 83a99c5..f9dfc08 100755
--- a/precommit/src/main/shell/core.d/change-analysis.sh
+++ b/precommit/src/main/shell/core.d/change-analysis.sh
@@ -93,10 +93,42 @@ function exclude_paths_from_changed_files
declare strip
declare -a a
+
+ # empty the existing list
EXCLUDE_PATHS=()
+ # if E_P_F has been defined, then it was found earlier
if [[ -n "${EXCLUDE_PATHS_FILE}" ]]; then
- yetus_file_to_array EXCLUDE_PATHS "${EXCLUDE_PATHS_FILE}"
+
+ # if it still exists ( it may have gotten deleted post-patch!)
+ # read it in
+ if [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
+ yetus_file_to_array EXCLUDE_PATHS "${EXCLUDE_PATHS_FILE}"
+ else
+ # it was deleted post-patch, so delete it
+ unset EXCLUDE_PATHS_FILE
+ return
+ fi
+
+ # User provided us with a name but it wasn't there.
+ # let's see if it is now
+ elif [[ -n "${EXCLUDE_PATHS_FILE_SAVEOFF}" ]]; then
+ # try to absolute the file name
+ if [[ -f "${EXCLUDE_PATHS_FILE_SAVEOFF}" ]]; then
+ EXCLUDE_PATHS_FILE=$(yetus_abs "${EXCLUDE_PATHS_FILE_SAVEOFF}")
+ elif [[ -f "${BASEDIR}/${EXCLUDE_PATHS_FILE_SAVEOFF}" ]]; then
+ EXCLUDE_PATHS_FILE=$(yetus_abs "${BASEDIR}/${EEXCLUDE_PATHS_FILE_SAVEOFF}")
+ fi
+
+ # if it exists, process, otherwise just return because nothing
+ # to do
+
+ if [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
+ yetus_file_to_array EXCLUDE_PATHS "${EXCLUDE_PATHS_FILE}"
+ else
+ unset EXCLUDE_PATHS_FILE
+ return
+ fi
else
return
fi
diff --git a/precommit/src/main/shell/test-patch.sh b/precommit/src/main/shell/test-patch.sh
index b7f0adf..6d4f40b 100755
--- a/precommit/src/main/shell/test-patch.sh
+++ b/precommit/src/main/shell/test-patch.sh
@@ -1047,15 +1047,15 @@ function parse_args
COPROC_LOGFILE="${PATCH_DIR}/coprocessors.txt"
if [[ -n "${EXCLUDE_PATHS_FILE}" ]]; then
+ # shellcheck disable=SC2034
+ EXCLUDE_PATHS_FILE_SAVEOFF=${EXCLUDE_PATHS_FILE}
if [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
EXCLUDE_PATHS_FILE=$(yetus_abs "${EXCLUDE_PATHS_FILE}")
elif [[ -f "${BASEDIR}/${EXCLUDE_PATHS_FILE}" ]]; then
EXCLUDE_PATHS_FILE=$(yetus_abs "${BASEDIR}/${EXCLUDE_PATHS_FILE}")
- elif [[ -f "${PATCH_DIR}/precommit/excluded.txt" ]]; then
- EXCLUDE_PATHS_FILE="${PATCH_DIR}/precommit/excluded.txt"
else
- yetus_error "ERROR: Excluded paths file (${EXCLUDE_PATHS_FILE}}) does not exist!"
- cleanup_and_exit 1
+ yetus_error "WARNING: Excluded paths file (${EXCLUDE_PATHS_FILE}}) does not exist (yet?)."
+ unset EXCLUDE_PATHS_FILE
fi
fi