[12/17] hadoop git commit: HADOOP-11917. test-patch.sh should work with ${BASEDIR}/patchprocess setups (aw)
HADOOP-11917. test-patch.sh should work with ${BASEDIR}/patchprocess setups (aw) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d33419ae Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d33419ae Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d33419ae Branch: refs/heads/HDFS-7240 Commit: d33419ae01c528073f9f00ef1aadf153fed41222 Parents: 24d3a2d Author: Allen Wittenauer a...@apache.org Authored: Tue May 5 11:26:31 2015 -0700 Committer: Allen Wittenauer a...@apache.org Committed: Tue May 5 11:26:31 2015 -0700 -- .gitignore | 1 + dev-support/test-patch.sh | 78 +--- hadoop-common-project/hadoop-common/CHANGES.txt | 3 + pom.xml | 23 +++--- 4 files changed, 84 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/d33419ae/.gitignore -- diff --git a/.gitignore b/.gitignore index a49ad4b..779f507 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ hadoop-tools/hadoop-openstack/src/test/resources/contract-test-options.xml hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/tla/yarnregistry.toolbox yarnregistry.pdf hadoop-tools/hadoop-aws/src/test/resources/contract-test-options.xml +patchprocess/ http://git-wip-us.apache.org/repos/asf/hadoop/blob/d33419ae/dev-support/test-patch.sh -- diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh index 9f48c64..3759e9f 100755 --- a/dev-support/test-patch.sh +++ b/dev-support/test-patch.sh @@ -535,6 +535,26 @@ function echo_and_redirect ${@} ${logfile} 21 } +## @description is PATCH_DIR relative to BASEDIR? +## @audiencepublic +## @stability stable +## @replaceable yes +## @returns 1 - no, PATCH_DIR +## @returns 0 - yes, PATCH_DIR - BASEDIR +function relative_patchdir +{ + local p=${PATCH_DIR#${BASEDIR}} + + if [[ ${#p} -eq ${#PATCH_DIR} ]]; then +echo ${p} +return 1 + fi + p=${p#/} + echo ${p} + return 0 +} + + ## @description Print the usage information ## @audience public ## @stabilitystable @@ -697,7 +717,8 @@ function parse_args esac done - # if we get a relative path, turn it absolute + # we need absolute dir for ${BASEDIR} + cd ${CWD} BASEDIR=$(cd -P -- ${BASEDIR} /dev/null pwd -P) if [[ ${BUILD_NATIVE} == true ]] ; then @@ -723,6 +744,7 @@ function parse_args JENKINS=false fi + cd ${CWD} if [[ ! -d ${PATCH_DIR} ]]; then mkdir -p ${PATCH_DIR} if [[ $? == 0 ]] ; then @@ -733,6 +755,9 @@ function parse_args fi fi + # we need absolute dir for PATCH_DIR + PATCH_DIR=$(cd -P -- ${PATCH_DIR} /dev/null pwd -P) + GITDIFFLINES=${PATCH_DIR}/gitdifflines.txt } @@ -821,17 +846,36 @@ function find_changed_modules function git_checkout { local currentbranch + local exemptdir big_console_header Confirming git environment + cd ${BASEDIR} + if [[ ! -d .git ]]; then +hadoop_error ERROR: ${BASEDIR} is not a git repo. +cleanup_and_exit 1 + fi + if [[ ${RESETREPO} == true ]] ; then -cd ${BASEDIR} ${GIT} reset --hard if [[ $? != 0 ]]; then hadoop_error ERROR: git reset is failing cleanup_and_exit 1 fi -${GIT} clean -xdf + +# if PATCH_DIR is in BASEDIR, then we don't want +# git wiping it out. +exemptdir=$(relative_patchdir) +if [[ $? == 1 ]]; then + ${GIT} clean -xdf +else + # we do, however, want it emptied of all _files_. + # we need to leave _directories_ in case we are in + # re-exec mode (which places a directory full of stuff in it) + hadoop_debug Exempting ${exemptdir} from clean + rm ${PATCH_DIR}/* 2/dev/null + ${GIT} clean -xdf -e ${exemptdir} +fi if [[ $? != 0 ]]; then hadoop_error ERROR: git clean is failing cleanup_and_exit 1 @@ -875,11 +919,6 @@ function git_checkout fi else -cd ${BASEDIR} -if [[ ! -d .git ]]; then - hadoop_error ERROR: ${BASEDIR} is not a git repo. - cleanup_and_exit 1 -fi status=$(${GIT} status --porcelain) if [[ ${status} != -z ${DIRTY_WORKSPACE} ]] ; then @@ -1000,6 +1039,16 @@ function verify_valid_branch local check=$2 local i + # shortcut some common + # non-resolvable names + if [[ -z ${check} ]]; then +return 1 + fi + + if [[ ${check} == patch ]]; then +return 1 + fi + if [[ ${check} =~ ^git ]]; then ref=$(echo ${check} | cut -f2 -dt) count=$(echo ${ref} | wc -c | tr -d ' ') @@ -2207,9 +2256,16 @@ function cleanup_and_exit if [[ ${JENKINS} == true ]] ; then if [[ -e
hadoop git commit: HADOOP-11917. test-patch.sh should work with ${BASEDIR}/patchprocess setups (aw)
Repository: hadoop Updated Branches: refs/heads/trunk 24d3a2d4f - d33419ae0 HADOOP-11917. test-patch.sh should work with ${BASEDIR}/patchprocess setups (aw) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d33419ae Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d33419ae Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d33419ae Branch: refs/heads/trunk Commit: d33419ae01c528073f9f00ef1aadf153fed41222 Parents: 24d3a2d Author: Allen Wittenauer a...@apache.org Authored: Tue May 5 11:26:31 2015 -0700 Committer: Allen Wittenauer a...@apache.org Committed: Tue May 5 11:26:31 2015 -0700 -- .gitignore | 1 + dev-support/test-patch.sh | 78 +--- hadoop-common-project/hadoop-common/CHANGES.txt | 3 + pom.xml | 23 +++--- 4 files changed, 84 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/d33419ae/.gitignore -- diff --git a/.gitignore b/.gitignore index a49ad4b..779f507 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ hadoop-tools/hadoop-openstack/src/test/resources/contract-test-options.xml hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/tla/yarnregistry.toolbox yarnregistry.pdf hadoop-tools/hadoop-aws/src/test/resources/contract-test-options.xml +patchprocess/ http://git-wip-us.apache.org/repos/asf/hadoop/blob/d33419ae/dev-support/test-patch.sh -- diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh index 9f48c64..3759e9f 100755 --- a/dev-support/test-patch.sh +++ b/dev-support/test-patch.sh @@ -535,6 +535,26 @@ function echo_and_redirect ${@} ${logfile} 21 } +## @description is PATCH_DIR relative to BASEDIR? +## @audiencepublic +## @stability stable +## @replaceable yes +## @returns 1 - no, PATCH_DIR +## @returns 0 - yes, PATCH_DIR - BASEDIR +function relative_patchdir +{ + local p=${PATCH_DIR#${BASEDIR}} + + if [[ ${#p} -eq ${#PATCH_DIR} ]]; then +echo ${p} +return 1 + fi + p=${p#/} + echo ${p} + return 0 +} + + ## @description Print the usage information ## @audience public ## @stabilitystable @@ -697,7 +717,8 @@ function parse_args esac done - # if we get a relative path, turn it absolute + # we need absolute dir for ${BASEDIR} + cd ${CWD} BASEDIR=$(cd -P -- ${BASEDIR} /dev/null pwd -P) if [[ ${BUILD_NATIVE} == true ]] ; then @@ -723,6 +744,7 @@ function parse_args JENKINS=false fi + cd ${CWD} if [[ ! -d ${PATCH_DIR} ]]; then mkdir -p ${PATCH_DIR} if [[ $? == 0 ]] ; then @@ -733,6 +755,9 @@ function parse_args fi fi + # we need absolute dir for PATCH_DIR + PATCH_DIR=$(cd -P -- ${PATCH_DIR} /dev/null pwd -P) + GITDIFFLINES=${PATCH_DIR}/gitdifflines.txt } @@ -821,17 +846,36 @@ function find_changed_modules function git_checkout { local currentbranch + local exemptdir big_console_header Confirming git environment + cd ${BASEDIR} + if [[ ! -d .git ]]; then +hadoop_error ERROR: ${BASEDIR} is not a git repo. +cleanup_and_exit 1 + fi + if [[ ${RESETREPO} == true ]] ; then -cd ${BASEDIR} ${GIT} reset --hard if [[ $? != 0 ]]; then hadoop_error ERROR: git reset is failing cleanup_and_exit 1 fi -${GIT} clean -xdf + +# if PATCH_DIR is in BASEDIR, then we don't want +# git wiping it out. +exemptdir=$(relative_patchdir) +if [[ $? == 1 ]]; then + ${GIT} clean -xdf +else + # we do, however, want it emptied of all _files_. + # we need to leave _directories_ in case we are in + # re-exec mode (which places a directory full of stuff in it) + hadoop_debug Exempting ${exemptdir} from clean + rm ${PATCH_DIR}/* 2/dev/null + ${GIT} clean -xdf -e ${exemptdir} +fi if [[ $? != 0 ]]; then hadoop_error ERROR: git clean is failing cleanup_and_exit 1 @@ -875,11 +919,6 @@ function git_checkout fi else -cd ${BASEDIR} -if [[ ! -d .git ]]; then - hadoop_error ERROR: ${BASEDIR} is not a git repo. - cleanup_and_exit 1 -fi status=$(${GIT} status --porcelain) if [[ ${status} != -z ${DIRTY_WORKSPACE} ]] ; then @@ -1000,6 +1039,16 @@ function verify_valid_branch local check=$2 local i + # shortcut some common + # non-resolvable names + if [[ -z ${check} ]]; then +return 1 + fi + + if [[ ${check} == patch ]]; then +return 1 + fi + if [[ ${check} =~ ^git ]]; then ref=$(echo ${check} | cut -f2 -dt) count=$(echo ${ref} | wc -c | tr -d ' ') @@ -2207,9 +2256,16 @@
hadoop git commit: HADOOP-11917. test-patch.sh should work with ${BASEDIR}/patchprocess setups (aw)
Repository: hadoop Updated Branches: refs/heads/branch-2 1f6bcf94c - 50a5d0b62 HADOOP-11917. test-patch.sh should work with ${BASEDIR}/patchprocess setups (aw) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/50a5d0b6 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/50a5d0b6 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/50a5d0b6 Branch: refs/heads/branch-2 Commit: 50a5d0b62b88a24f2db36d097fdd28d972a07dfe Parents: 1f6bcf9 Author: Allen Wittenauer a...@apache.org Authored: Tue May 5 11:28:16 2015 -0700 Committer: Allen Wittenauer a...@apache.org Committed: Tue May 5 11:28:16 2015 -0700 -- .gitignore | 1 + dev-support/test-patch.sh | 78 +--- hadoop-common-project/hadoop-common/CHANGES.txt | 3 + pom.xml | 21 +++--- 4 files changed, 83 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/50a5d0b6/.gitignore -- diff --git a/.gitignore b/.gitignore index 15c040c..e6a05de 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ hadoop-tools/hadoop-openstack/src/test/resources/contract-test-options.xml hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/tla/yarnregistry.toolbox yarnregistry.pdf hadoop-tools/hadoop-aws/src/test/resources/contract-test-options.xml +patchprocess/ http://git-wip-us.apache.org/repos/asf/hadoop/blob/50a5d0b6/dev-support/test-patch.sh -- diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh index 9f48c64..3759e9f 100755 --- a/dev-support/test-patch.sh +++ b/dev-support/test-patch.sh @@ -535,6 +535,26 @@ function echo_and_redirect ${@} ${logfile} 21 } +## @description is PATCH_DIR relative to BASEDIR? +## @audiencepublic +## @stability stable +## @replaceable yes +## @returns 1 - no, PATCH_DIR +## @returns 0 - yes, PATCH_DIR - BASEDIR +function relative_patchdir +{ + local p=${PATCH_DIR#${BASEDIR}} + + if [[ ${#p} -eq ${#PATCH_DIR} ]]; then +echo ${p} +return 1 + fi + p=${p#/} + echo ${p} + return 0 +} + + ## @description Print the usage information ## @audience public ## @stabilitystable @@ -697,7 +717,8 @@ function parse_args esac done - # if we get a relative path, turn it absolute + # we need absolute dir for ${BASEDIR} + cd ${CWD} BASEDIR=$(cd -P -- ${BASEDIR} /dev/null pwd -P) if [[ ${BUILD_NATIVE} == true ]] ; then @@ -723,6 +744,7 @@ function parse_args JENKINS=false fi + cd ${CWD} if [[ ! -d ${PATCH_DIR} ]]; then mkdir -p ${PATCH_DIR} if [[ $? == 0 ]] ; then @@ -733,6 +755,9 @@ function parse_args fi fi + # we need absolute dir for PATCH_DIR + PATCH_DIR=$(cd -P -- ${PATCH_DIR} /dev/null pwd -P) + GITDIFFLINES=${PATCH_DIR}/gitdifflines.txt } @@ -821,17 +846,36 @@ function find_changed_modules function git_checkout { local currentbranch + local exemptdir big_console_header Confirming git environment + cd ${BASEDIR} + if [[ ! -d .git ]]; then +hadoop_error ERROR: ${BASEDIR} is not a git repo. +cleanup_and_exit 1 + fi + if [[ ${RESETREPO} == true ]] ; then -cd ${BASEDIR} ${GIT} reset --hard if [[ $? != 0 ]]; then hadoop_error ERROR: git reset is failing cleanup_and_exit 1 fi -${GIT} clean -xdf + +# if PATCH_DIR is in BASEDIR, then we don't want +# git wiping it out. +exemptdir=$(relative_patchdir) +if [[ $? == 1 ]]; then + ${GIT} clean -xdf +else + # we do, however, want it emptied of all _files_. + # we need to leave _directories_ in case we are in + # re-exec mode (which places a directory full of stuff in it) + hadoop_debug Exempting ${exemptdir} from clean + rm ${PATCH_DIR}/* 2/dev/null + ${GIT} clean -xdf -e ${exemptdir} +fi if [[ $? != 0 ]]; then hadoop_error ERROR: git clean is failing cleanup_and_exit 1 @@ -875,11 +919,6 @@ function git_checkout fi else -cd ${BASEDIR} -if [[ ! -d .git ]]; then - hadoop_error ERROR: ${BASEDIR} is not a git repo. - cleanup_and_exit 1 -fi status=$(${GIT} status --porcelain) if [[ ${status} != -z ${DIRTY_WORKSPACE} ]] ; then @@ -1000,6 +1039,16 @@ function verify_valid_branch local check=$2 local i + # shortcut some common + # non-resolvable names + if [[ -z ${check} ]]; then +return 1 + fi + + if [[ ${check} == patch ]]; then +return 1 + fi + if [[ ${check} =~ ^git ]]; then ref=$(echo ${check} | cut -f2 -dt) count=$(echo ${ref} | wc -c | tr -d ' ') @@ -2207,9 +2256,16