Repository: yetus Updated Branches: refs/heads/master 5dd5f1db4 -> a6425f410
YETUS-171. patches that don't apply are not getting reported back to JIRA Signed-off-by: Sean Busbey <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/a6425f41 Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/a6425f41 Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/a6425f41 Branch: refs/heads/master Commit: a6425f41003359ff83576f15956c0f08cdf5888c Parents: 5dd5f1d Author: Allen Wittenauer <[email protected]> Authored: Wed Nov 18 20:43:21 2015 -0800 Committer: Allen Wittenauer <[email protected]> Committed: Wed Nov 18 22:27:12 2015 -0800 ---------------------------------------------------------------------- precommit/core.d/01-common.sh | 21 +++++++++++++++++++++ precommit/test-patch.d/jira.sh | 19 ++++++++++++------- precommit/test-patch.sh | 5 ++++- 3 files changed, 37 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/a6425f41/precommit/core.d/01-common.sh ---------------------------------------------------------------------- diff --git a/precommit/core.d/01-common.sh b/precommit/core.d/01-common.sh index 41e4e63..5108ad0 100755 --- a/precommit/core.d/01-common.sh +++ b/precommit/core.d/01-common.sh @@ -93,6 +93,7 @@ function common_args { declare i declare showhelp=false + declare version for i in "$@"; do case ${i} in @@ -170,6 +171,26 @@ function common_args if [[ ${showhelp} == true ]]; then yetus_usage exit 0 + + # Absolutely require v1.7.3 or higher + # versions lower than this either have bugs with + # git apply or don't support all the + # expected options + version=$(${GIT} --version) + + if [[ $? != 0 ]]; then + yetus_error "ERROR: ${GIT} failed during version detection." + exit 1 + fi + + # shellcheck disable=SC2016 + version=$(echo "${version}" | ${AWK} '{print $NF}') + if [[ ${version} =~ ^0 + || ${version} =~ ^1.[0-6] + || ${version} =~ ^1.7.[0-2] + ]]; then + yetus_error "ERROR: ${GIT} v1.7.3 or higher is required (found ${version})." + exit 1 fi } http://git-wip-us.apache.org/repos/asf/yetus/blob/a6425f41/precommit/test-patch.d/jira.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/jira.sh b/precommit/test-patch.d/jira.sh index e5fd550..671cb2b 100755 --- a/precommit/test-patch.d/jira.sh +++ b/precommit/test-patch.d/jira.sh @@ -152,21 +152,26 @@ function jira_locate_patch relativeurl=$(${AWK} 'match($0,"/secure/attachment/[0-9]*/[^\"]*"){print substr($0,RSTART,RLENGTH)}' "${PATCH_DIR}/jira" | ${GREP} -v -e 'htm[l]*$' | sort | tail -1 | ${SED} -e 's,[ ]*$,,g') PATCHURL="${JIRA_URL}${relativeurl}" + + echo "${input} patch is being downloaded at $(date) from" + echo "${PATCHURL}" + jira_http_fetch "${relativeurl}" "${fileloc}" + if [[ $? != 0 ]];then + yetus_error "ERROR: ${input}/${PATCHURL} could not be downloaded." + cleanup_and_exit 1 + fi + if [[ ! ${PATCHURL} =~ \.patch$ ]]; then guess_patch_file "${PATCH_DIR}/patch" if [[ $? == 0 ]]; then yetus_debug "The patch ${PATCHURL} was not named properly, but it looks like a patch file. Proceeding, but issue/branch matching might go awry." add_vote_table 0 patch "The patch file was not named according to ${PROJECT_NAME}'s naming conventions. Please see ${HOW_TO_CONTRIBUTE} for instructions." + else + # this definitely isn't a patch so just bail out. + return 1 fi fi - echo "${input} patch is being downloaded at $(date) from" - echo "${PATCHURL}" add_footer_table "JIRA Patch URL" "${PATCHURL}" - jira_http_fetch "${relativeurl}" "${fileloc}" - if [[ $? != 0 ]];then - yetus_error "ERROR: ${input}/${PATCHURL} could not be downloaded." - cleanup_and_exit 1 - fi return 0 } http://git-wip-us.apache.org/repos/asf/yetus/blob/a6425f41/precommit/test-patch.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.sh b/precommit/test-patch.sh index 3c04dd7..16b8b30 100755 --- a/precommit/test-patch.sh +++ b/precommit/test-patch.sh @@ -1344,7 +1344,7 @@ function apply_patch_file if [[ $? != 0 ]] ; then echo "PATCH APPLICATION FAILED" ((RESULT = RESULT + 1)) - add_vote_table -1 patch "The patch command could not apply the patch." + add_vote_table -1 patch "${PATCH_OR_ISSUE} does not apply to ${PATCH_BRANCH}. Rebase required? Wrong Branch? See ${HOW_TO_CONTRIBUTE} for help." bugsystem_finalreport 1 cleanup_and_exit 1 fi @@ -2540,7 +2540,10 @@ function initialize patchfile_dryrun_driver "${PATCH_DIR}/patch" if [[ $? != 0 ]]; then + ((RESULT = RESULT + 1)) yetus_error "ERROR: ${PATCH_OR_ISSUE} does not apply to ${PATCH_BRANCH}." + add_vote_table -1 patch "${PATCH_OR_ISSUE} does not apply to ${PATCH_BRANCH}. Rebase required? Wrong Branch? See ${HOW_TO_CONTRIBUTE} for help." + bugsystem_finalreport 1 cleanup_and_exit 1 fi
