yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [1/3] yetus git commit: YETUS-708. Clean up the source
Date Thu, 13 Dec 2018 16:22:45 GMT
Repository: yetus
Updated Branches:
  refs/heads/master 492a20e05 -> 1fcaabd4e


http://git-wip-us.apache.org/repos/asf/yetus/blob/9a2cd581/precommit/src/main/shell/test-patch.d/scala.sh
----------------------------------------------------------------------
diff --git a/precommit/src/main/shell/test-patch.d/scala.sh b/precommit/src/main/shell/test-patch.d/scala.sh
index f2b599a..ba29136 100755
--- a/precommit/src/main/shell/test-patch.d/scala.sh
+++ b/precommit/src/main/shell/test-patch.d/scala.sh
@@ -14,6 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# SHELLDOC-IGNORE
+
 add_test_type scalac
 add_test_type scaladoc
 
@@ -122,8 +124,7 @@ function scalac_logfilter
   declare input=$1
   declare output=$2
 
-  #shellcheck disable=SC2016,SC2046
-  ${GREP} "^/.*.scala:[0-9]*:" "${input}" > "${output}"
+  "${GREP}" "^/.*.scala:[0-9]*:" "${input}" > "${output}"
 }
 
 ## @description  Helper for generic_logfilter
@@ -135,6 +136,5 @@ function scaladoc_logfilter
   declare input=$1
   declare output=$2
 
-  #shellcheck disable=SC2016,SC2046
-  ${GREP} "^/.*.scala:[0-9]*:" "${input}" > "${output}"
+  "${GREP}" "^/.*.scala:[0-9]*:" "${input}" > "${output}"
 }

http://git-wip-us.apache.org/repos/asf/yetus/blob/9a2cd581/precommit/src/main/shell/test-patch.d/shellcheck.sh
----------------------------------------------------------------------
diff --git a/precommit/src/main/shell/test-patch.d/shellcheck.sh b/precommit/src/main/shell/test-patch.d/shellcheck.sh
index f0450f7..59ef98b 100755
--- a/precommit/src/main/shell/test-patch.d/shellcheck.sh
+++ b/precommit/src/main/shell/test-patch.d/shellcheck.sh
@@ -22,7 +22,7 @@ add_test_type shellcheck
 SHELLCHECK_TIMER=0
 SHELLCHECK_X=true
 
-SHELLCHECK=${SHELLCHECK:-$(which shellcheck 2>/dev/null)}
+SHELLCHECK=${SHELLCHECK:-$(command -v shellcheck 2>/dev/null)}
 
 # files that are going to get shellcheck'd
 SHELLCHECK_CHECKFILES=()
@@ -141,7 +141,7 @@ function shellcheck_logic
   declare i
 
   echo "Running shellcheck against all suspected shell scripts"
-  pushd "${BASEDIR}" >/dev/null
+  pushd "${BASEDIR}" >/dev/null || return 1
 
   # need to run this every time in case patch
   # add/removed files
@@ -154,7 +154,7 @@ function shellcheck_logic
       "${SHELLCHECK}" -f gcc "${i}" >> "${PATCH_DIR}/${repostatus}-shellcheck-result.txt"
     fi
   done
-  popd > /dev/null
+  popd > /dev/null || return 1
 }
 
 function shellcheck_preapply
@@ -224,13 +224,13 @@ function shellcheck_postapply
       > "${PATCH_DIR}/diff-patch-shellcheck.txt"
 
   # shellcheck disable=SC2016
-  numPrepatch=$(wc -l "${PATCH_DIR}/branch-shellcheck-result.txt" | ${AWK} '{print $1}')
+  numPrepatch=$(wc -l "${PATCH_DIR}/branch-shellcheck-result.txt" | "${AWK}" '{print $1}')
 
   # shellcheck disable=SC2016
-  numPostpatch=$(wc -l "${PATCH_DIR}/patch-shellcheck-result.txt" | ${AWK} '{print $1}')
+  numPostpatch=$(wc -l "${PATCH_DIR}/patch-shellcheck-result.txt" | "${AWK}" '{print $1}')
 
   # shellcheck disable=SC2016
-  diffPostpatch=$(wc -l "${PATCH_DIR}/diff-patch-shellcheck.txt" | ${AWK} '{print $1}')
+  diffPostpatch=$(wc -l "${PATCH_DIR}/diff-patch-shellcheck.txt" | "${AWK}" '{print $1}')
 
 
   ((fixedpatch=numPrepatch-numPostpatch+diffPostpatch))

http://git-wip-us.apache.org/repos/asf/yetus/blob/9a2cd581/precommit/src/main/shell/test-patch.d/shelldocs.sh
----------------------------------------------------------------------
diff --git a/precommit/src/main/shell/test-patch.d/shelldocs.sh b/precommit/src/main/shell/test-patch.d/shelldocs.sh
index d52fa6b..67f94d9 100755
--- a/precommit/src/main/shell/test-patch.d/shelldocs.sh
+++ b/precommit/src/main/shell/test-patch.d/shelldocs.sh
@@ -14,13 +14,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# SHELLDOC-IGNORE
+
 add_test_type shelldocs
 
 SHELLDOCS_TIMER=0
 
-SHELLDOCS=${SHELLDOCS}
+SHELLDOCS=$(command -v shelldocs)
 if [[ -z ${SHELLDOCS} ]]; then
-  for shelldocsexec in "${BINDIR}/shelldocs" "${BINDIR}/../shelldocs/shelldocs.py"; do
+  for shelldocsexec in \
+    "${BINDIR}/shelldocs" \
+    "${BINDIR}/../shelldocs/shelldocs.py"\
+    "${BASEDIR}/shelldocs/src/main/python/shelldocs.py"; do
     if [[ -f ${shelldocsexec} && -x ${shelldocsexec} ]]; then
       SHELLDOCS=${shelldocsexec}
       break
@@ -108,13 +113,13 @@ function shelldocs_preapply
   start_clock
 
   echo "Running shelldocs against all identifiable shell scripts"
-  pushd "${BASEDIR}" >/dev/null
+  pushd "${BASEDIR}" >/dev/null || return 1
   for i in $(shelldocs_private_findbash); do
     if [[ -f ${i} ]]; then
-      ${SHELLDOCS} --input "${i}" --lint >> "${PATCH_DIR}/branch-shelldocs-result.txt"
+      "${SHELLDOCS}" --input "${i}" --lint >> "${PATCH_DIR}/branch-shelldocs-result.txt"
     fi
   done
-  popd > /dev/null
+  popd > /dev/null || return 1
 
   # keep track of how much as elapsed for us already
   SHELLDOCS_TIMER=$(stop_clock)
@@ -146,7 +151,7 @@ function shelldocs_postapply
   # we re-check this in case one has been added
   for i in $(shelldocs_private_findbash); do
     if [[ -f ${i} ]]; then
-      ${SHELLDOCS} --input "${i}" --lint >> "${PATCH_DIR}/patch-shelldocs-result.txt"
+      "${SHELLDOCS}" --input "${i}" --lint >> "${PATCH_DIR}/patch-shelldocs-result.txt"
     fi
   done
 
@@ -157,13 +162,13 @@ function shelldocs_postapply
       > "${PATCH_DIR}/diff-patch-shelldocs.txt"
 
   # shellcheck disable=SC2016
-  numPrepatch=$(wc -l "${PATCH_DIR}/branch-shelldocs-result.txt" | ${AWK} '{print $1}')
+  numPrepatch=$(wc -l "${PATCH_DIR}/branch-shelldocs-result.txt" | "${AWK}" '{print $1}')
 
   # shellcheck disable=SC2016
-  numPostpatch=$(wc -l "${PATCH_DIR}/patch-shelldocs-result.txt" | ${AWK} '{print $1}')
+  numPostpatch=$(wc -l "${PATCH_DIR}/patch-shelldocs-result.txt" | "${AWK}" '{print $1}')
 
   # shellcheck disable=SC2016
-  diffPostpatch=$(wc -l "${PATCH_DIR}/diff-patch-shelldocs.txt" | ${AWK} '{print $1}')
+  diffPostpatch=$(wc -l "${PATCH_DIR}/diff-patch-shelldocs.txt" | "${AWK}" '{print $1}')
 
   ((fixedpatch=numPrepatch-numPostpatch+diffPostpatch))
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/9a2cd581/precommit/src/main/shell/test-patch.d/tap.sh
----------------------------------------------------------------------
diff --git a/precommit/src/main/shell/test-patch.d/tap.sh b/precommit/src/main/shell/test-patch.d/tap.sh
index 465b7f1..08d5242 100755
--- a/precommit/src/main/shell/test-patch.d/tap.sh
+++ b/precommit/src/main/shell/test-patch.d/tap.sh
@@ -14,6 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# SHELLDOC-IGNORE
+
 add_test_format tap
 
 TAP_FAILED_TESTS=""

http://git-wip-us.apache.org/repos/asf/yetus/blob/9a2cd581/precommit/src/main/shell/test-patch.d/unitveto.sh
----------------------------------------------------------------------
diff --git a/precommit/src/main/shell/test-patch.d/unitveto.sh b/precommit/src/main/shell/test-patch.d/unitveto.sh
index e0d348e..fd88ec5 100755
--- a/precommit/src/main/shell/test-patch.d/unitveto.sh
+++ b/precommit/src/main/shell/test-patch.d/unitveto.sh
@@ -14,6 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# SHELLDOC-IGNORE
+
 add_test_type unitveto
 
 UNITVETO_RE=${UNITVETO_RE:-}

http://git-wip-us.apache.org/repos/asf/yetus/blob/9a2cd581/precommit/src/main/shell/test-patch.d/whitespace.sh
----------------------------------------------------------------------
diff --git a/precommit/src/main/shell/test-patch.d/whitespace.sh b/precommit/src/main/shell/test-patch.d/whitespace.sh
index 861fe3b..b52e9d1 100755
--- a/precommit/src/main/shell/test-patch.d/whitespace.sh
+++ b/precommit/src/main/shell/test-patch.d/whitespace.sh
@@ -14,6 +14,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# SHELLDOC-IGNORE
+
+
 WHITESPACE_EOL_IGNORE_LIST=
 WHITESPACE_TABS_IGNORE_LIST='.*Makefile.*'
 
@@ -83,7 +86,7 @@ function whitespace_postcompile
   big_console_header "Checking for whitespace issues."
   start_clock
 
-  pushd "${BASEDIR}" >/dev/null
+  pushd "${BASEDIR}" >/dev/null || return 1
 
   eolignore=$(printf -- "-e ^%s: " "${WHITESPACE_EOL_IGNORE_LIST[@]}")
   tabsignore=$(printf -- "-e ^%s: " "${WHITESPACE_TABS_IGNORE_LIST[@]}")
@@ -139,12 +142,12 @@ function whitespace_postcompile
     ((result=result+1))
   fi
 
+  popd >/dev/null || return 1
+
   if [[ ${result} -gt 0 ]]; then
-    popd >/dev/null
     return 1
   fi
 
-  popd >/dev/null
   add_vote_table +1 whitespace "${BUILDMODEMSG} has no whitespace issues."
   return 0
 }

http://git-wip-us.apache.org/repos/asf/yetus/blob/9a2cd581/precommit/src/main/shell/test-patch.d/xml.sh
----------------------------------------------------------------------
diff --git a/precommit/src/main/shell/test-patch.d/xml.sh b/precommit/src/main/shell/test-patch.d/xml.sh
index 1e56905..e8cd0ed 100755
--- a/precommit/src/main/shell/test-patch.d/xml.sh
+++ b/precommit/src/main/shell/test-patch.d/xml.sh
@@ -14,6 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# SHELLDOC-IGNORE
+
 declare -a XML_FILES
 
 add_test_type xml
@@ -56,7 +58,7 @@ function xml_postcompile
 
   start_clock
 
-  pushd "${BASEDIR}" >/dev/null
+  pushd "${BASEDIR}" >/dev/null || return 1
   for i in "${CHANGED_FILES[@]}"; do
     if [[ ${i} =~ \.xml$ && -f ${i} ]]; then
       if ! "${js}" -e "XMLDocument(arguments[0])" "${i}" > "${PATCH_DIR}/xml.txt.tmp"
2>&1; then
@@ -72,7 +74,7 @@ function xml_postcompile
     fi
   done
 
-  popd >/dev/null
+  popd >/dev/null || return 1
 
   if [[ -f "${PATCH_DIR}/xml.txt.tmp" ]]; then
     rm "${PATCH_DIR}/xml.txt.tmp"

http://git-wip-us.apache.org/repos/asf/yetus/blob/9a2cd581/precommit/src/main/shell/test-patch.sh
----------------------------------------------------------------------
diff --git a/precommit/src/main/shell/test-patch.sh b/precommit/src/main/shell/test-patch.sh
index 5f25afb..9a78057 100755
--- a/precommit/src/main/shell/test-patch.sh
+++ b/precommit/src/main/shell/test-patch.sh
@@ -70,6 +70,7 @@ function setup_defaults
 
   set_yetus_version
 
+  #shellcheck disable=SC2153
   if [[ ${VERSION} =~ SNAPSHOT$ ]]; then
     version="in-progress"
   fi
@@ -113,6 +114,7 @@ function module_file_fragment
   if [[ ${mod} = \. ]]; then
     echo root
   else
+    #shellcheck disable=SC1003
     echo "$1" | tr '/' '_' | tr '\\' '_'
   fi
 }
@@ -279,7 +281,7 @@ function add_vote_table
 function report_jvm_version
 {
   #shellcheck disable=SC2016
-  "${1}/bin/java" -version 2>&1 | head -1 | ${AWK} '{print $NF}' | tr -d \"
+  "${1}/bin/java" -version 2>&1 | head -1 | "${AWK}" '{print $NF}' | tr -d \"
 }
 
 ## @description  Verify if a given test is multijdk
@@ -410,13 +412,13 @@ function big_console_header
 {
   local text="$*"
   local spacing=$(( (75+${#text}) /2 ))
-  printf "\n\n"
+  printf '\n\n'
   echo "============================================================================"
   echo "============================================================================"
-  printf "%*s\n"  ${spacing} "${text}"
+  printf '%*s\n'  ${spacing} "${text}"
   echo "============================================================================"
   echo "============================================================================"
-  printf "\n\n"
+  printf '\n\n'
 }
 
 ## @description  Find the largest size of a column of an array
@@ -456,7 +458,7 @@ function write_comment
   declare bug
 
   for bug in ${BUGCOMMENTS}; do
-    if declare -f ${bug}_write_comment >/dev/null; then
+    if declare -f "${bug}_write_comment" >/dev/null; then
        "${bug}_write_comment" "${commentfile}"
     fi
   done
@@ -511,8 +513,8 @@ function compute_gitdiff
   local content
   local outfile="${PATCH_DIR}/computegitdiff.${RANDOM}"
 
-  pushd "${BASEDIR}" >/dev/null
-  ${GIT} add --all --intent-to-add
+  pushd "${BASEDIR}" >/dev/null || return 1
+  "${GIT}" add --all --intent-to-add
   while read -r line; do
     if [[ ${line} =~ ^\+\+\+ ]]; then
       file="./"$(echo "${line}" | cut -f2- -d/)
@@ -545,7 +547,7 @@ function compute_gitdiff
       while read -r content; do
           ((actual=counter+startline))
           echo "${file}:${actual}:" >> "${GITDIFFLINES}"
-          printf "%s:%s:%s\n" "${file}" "${actual}" "${content}" >> "${GITDIFFCONTENT}"
+          printf '%s:%s:%s\n' "${file}" "${actual}" "${content}" >> "${GITDIFFCONTENT}"
           ((counter=counter+1))
       done < "${outfile}"
       rm "${outfile}"
@@ -567,7 +569,7 @@ function compute_gitdiff
     touch "${GITUNIDIFFLINES}"
   fi
 
-  popd >/dev/null
+  popd >/dev/null || return 1
 }
 
 ## @description generate an index of unified diff lines vs. modified/added lines
@@ -596,11 +598,11 @@ function compute_unidiff
     filen=${fn##./}
 
     if [[ -f "${filen}" ]]; then
-      ${GIT} diff "${filen}" \
+      "${GIT}" diff "${filen}" \
         | tail -n +6 \
-        | ${GREP} -n '^+' \
-        | ${GREP} -vE '^[0-9]*:\+\+\+' \
-        | ${SED} -e 's,^\([0-9]*:\)\+,\1,g' \
+        | "${GREP}" -n '^+' \
+        | "${GREP}" -vE '^[0-9]*:\+\+\+' \
+        | "${SED}" -e 's,^\([0-9]*:\)\+,\1,g' \
           -e "s,^,./${filen}:,g" \
               >>  "${tmpfile}"
     fi
@@ -613,7 +615,7 @@ function compute_unidiff
   # ./filename:real number:diff number
   # shellcheck disable=SC2016
   paste -d: "${GITDIFFLINES}" "${tmpfile}" \
-    | ${AWK} -F: '{print $1":"$2":"$5":"$6}' \
+    | "${AWK}" -F: '{print $1":"$2":"$5":"$6}' \
     >> "${GITUNIDIFFLINES}"
 
   rm "${tmpfile}"
@@ -804,7 +806,7 @@ function yetus_usage
   yetus_reset_usage
 
   for plugin in ${BUILDTOOLS} ${TESTTYPES} ${BUGSYSTEMS} ${TESTFORMATS}; do
-    if declare -f ${plugin}_usage >/dev/null 2>&1; then
+    if declare -f "${plugin}_usage" >/dev/null 2>&1; then
       echo ""
       echo "'${plugin}' plugin usage options:"
       "${plugin}_usage"
@@ -1027,8 +1029,7 @@ function parse_args
   # we need absolute dir for PATCH_DIR
   cd "${STARTINGDIR}" || cleanup_and_exit 1
   if [[ ! -d ${PATCH_DIR} ]]; then
-    mkdir -p "${PATCH_DIR}"
-    if [[ $? == 0 ]] ; then
+    if mkdir -p "${PATCH_DIR}"; then
       echo "${PATCH_DIR} has been created"
     else
       echo "Unable to create ${PATCH_DIR}"
@@ -1134,15 +1135,11 @@ function find_buildfile_dir
 function find_changed_files
 {
   declare line
-  declare oldifs
 
   case "${BUILDMODE}" in
     full)
       echo "Building a list of all files in the source tree"
-      oldifs=${IFS}
-      IFS=$'\n'
-      CHANGED_FILES=($(git ls-files))
-      IFS=${oldifs}
+      while IFS= read -r; do CHANGED_FILES+=("$REPLY"); done < <(git ls-files)
     ;;
     patch)
       # get a list of all of the files that have been changed,
@@ -1213,10 +1210,18 @@ function find_changed_modules
   declare dirt
   declare buildfile
   declare -a tmpmods
+  declare retval
 
-  buildfile=$("${BUILDTOOL}_buildfile")
+  if declare -f "${BUILDTOOL}_buildfile" >/dev/null; then
+    buildfile=$("${BUILDTOOL}_buildfile")
+    retval=$?
+  else
+    yetus_error "ERROR: build tool plugin is broken"
+    bugsystem_finalreport 1
+    cleanup_and_exit 1
+  fi
 
-  if [[ $? != 0 ]]; then
+  if [[ ${retval} != 0 ]]; then
     yetus_error "ERROR: Unsupported build tool."
     bugsystem_finalreport 1
     cleanup_and_exit 1
@@ -1224,7 +1229,7 @@ function find_changed_modules
 
   #  Empty string indicates the build system wants to disable module detection
   if [[ -z ${buildfile} ]]; then
-    tmpmods=(".")
+    CHANGED_MODULES=(".")
   else
 
     # Now find all the modules that were changed
@@ -1237,8 +1242,7 @@ function find_changed_modules
 
       dirt=$(dirname "${i}")
 
-      module_skipdir "${dirt}"
-      if [[ $? != 0 ]]; then
+      if ! module_skipdir "${dirt}"; then
         continue
       fi
 
@@ -1248,15 +1252,16 @@ function find_changed_modules
         bugsystem_finalreport 1
         cleanup_and_exit 1
       fi
-      tmpmods=("${tmpmods[@]}" "${builddir}")
+      CHANGED_MODULES+=("${builddir}")
     done
   fi
 
-  tmpmods=("${tmpmods[@]}" "${USER_MODULE_LIST[@]}")
+  CHANGED_MODULES+=("${USER_MODULE_LIST[@]}")
 
-  CHANGED_MODULES=($(printf "%s\n" "${tmpmods[@]}" | sort -u))
+  yetus_sort_and_unique_array CHANGED_MODULES
 
   yetus_debug "Locate the union of ${CHANGED_MODULES[*]}"
+
   count=${#CHANGED_MODULES[@]}
   if [[ ${count} -lt 2 ]]; then
     yetus_debug "Only one entry, so keeping it ${CHANGED_MODULES[0]}"
@@ -1264,13 +1269,15 @@ function find_changed_modules
     CHANGED_UNION_MODULES="${CHANGED_MODULES[0]}"
   else
     i=1
-    while [[ ${i} -lt 100 ]]
-    do
+
+    # BUG - fix me
+    # shellcheck disable=SC2207
+    while [[ ${i} -lt 100 ]]; do
       tmpmods=()
       for j in "${CHANGED_MODULES[@]}"; do
-        tmpmods=("${tmpmods[@]}" $(echo "${j}" | cut -f1-${i} -d/))
+        tmpmods+=($(echo "${j}" | cut -f1-${i} -d/))
       done
-      tmpmods=($(printf "%s\n" "${tmpmods[@]}" | sort -u))
+      tmpmods=($(printf '%s\n' "${tmpmods[@]}" | sort -u))
 
       module=${tmpmods[0]}
       count=${#tmpmods[@]}
@@ -1297,7 +1304,7 @@ function find_changed_modules
 
   # some build tools may want to change these and/or
   # make other changes based upon these results
-  if declare -f ${BUILDTOOL}_reorder_modules >/dev/null; then
+  if declare -f "${BUILDTOOL}_reorder_modules" >/dev/null; then
     "${BUILDTOOL}_reorder_modules" "${repostatus}"
   fi
 }
@@ -1368,7 +1375,7 @@ function git_checkout
     # git wiping it out.
     exemptdir=$(relative_dir "${PATCH_DIR}")
     if [[ $? == 1 ]]; then
-      ${GIT} clean -xdf
+      "${GIT}" clean -xdf
       status=$?
 
     else
@@ -1377,7 +1384,7 @@ function git_checkout
       # re-exec mode (which places a directory full of stuff in it)
       yetus_debug "Exempting ${exemptdir} from clean"
       rm "${PATCH_DIR}/*" 2>/dev/null
-      ${GIT} clean -xdf -e "${exemptdir}"
+      "${GIT}" clean -xdf -e "${exemptdir}"
       status=$?
     fi
 
@@ -1420,18 +1427,18 @@ function git_checkout
       # protected by OFFLINE == false
 
       if [[ "${GIT_OFFLINE}" == false ]]; then
-        if ! ${GIT} fetch; then
+        if ! "${GIT}" fetch; then
           yetus_error "ERROR: git fetch is failing"
           cleanup_and_exit 1
         fi
 
-        if ! ${GIT} reset --hard FETCH_HEAD; then
+        if ! "${GIT}" reset --hard FETCH_HEAD; then
           yetus_error "ERROR: git reset is failing"
           cleanup_and_exit 1
         fi
       fi
 
-      if ! ${GIT} clean -df; then
+      if ! "${GIT}" clean -df; then
         yetus_error "ERROR: git clean is failing"
         cleanup_and_exit 1
       fi
@@ -1439,7 +1446,7 @@ function git_checkout
 
   else
 
-    status=$(${GIT} status --porcelain)
+    status=$("${GIT}" status --porcelain)
     if [[ "${status}" != "" && -z ${DIRTY_WORKSPACE} ]] ; then
       yetus_error "ERROR: --dirty-workspace option not provided."
       yetus_error "ERROR: can't run in a workspace that contains the following modifications"
@@ -1449,7 +1456,7 @@ function git_checkout
 
     determine_branch
 
-    currentbranch=$(${GIT} rev-parse --abbrev-ref HEAD)
+    currentbranch=$("${GIT}" rev-parse --abbrev-ref HEAD)
     if [[ "${currentbranch}" != "${PATCH_BRANCH}" ]];then
       if [[ "${BUILDMODE}" = patch ]]; then
         echo "WARNING: Current git branch is ${currentbranch} but patch is built for ${PATCH_BRANCH}."
@@ -1485,8 +1492,7 @@ function verify_valid_branch
   if [[ ${check} =~ ^git ]]; then
     hash=$(echo "${check}" | cut -f2- -dt)
     if [[ -n ${hash} ]]; then
-      ${GIT} cat-file -t "${hash}" >/dev/null 2>&1
-      if [[ $? -eq 0 ]]; then
+      if "${GIT}" cat-file -t "${hash}" >/dev/null 2>&1; then
         PATCH_BRANCH=${hash}
         return 0
       fi
@@ -1496,7 +1502,7 @@ function verify_valid_branch
     fi
   fi
 
-  ${GIT} show-ref "${check}" >/dev/null 2>&1
+  "${GIT}" show-ref "${check}" >/dev/null 2>&1
   return $?
 }
 
@@ -1516,7 +1522,7 @@ function determine_branch
     return
   fi
 
-  pushd "${BASEDIR}" > /dev/null
+  pushd "${BASEDIR}" > /dev/null || return 1
 
   yetus_debug "Determine branch"
 
@@ -1533,7 +1539,7 @@ function determine_branch
   fi
 
   for bugs in ${BUGSYSTEMS}; do
-    if declare -f ${bugs}_determine_branch >/dev/null;then
+    if declare -f "${bugs}_determine_branch" >/dev/null;then
       "${bugs}_determine_branch"
       retval=$?
       if [[ ${retval} == 0 ]]; then
@@ -1545,7 +1551,7 @@ function determine_branch
   if [[ ${retval} != 0 ]]; then
     PATCH_BRANCH="${PATCH_BRANCH_DEFAULT}"
   fi
-  popd >/dev/null
+  popd >/dev/null || return 1
 }
 
 ## @description  Try to guess the issue being tested using a variety of heuristics
@@ -1561,9 +1567,8 @@ function determine_issue
   yetus_debug "Determine issue"
 
   for bugsys in ${BUGSYSTEMS}; do
-    if declare -f ${bugsys}_determine_issue >/dev/null; then
-      "${bugsys}_determine_issue" "${PATCH_OR_ISSUE}"
-      if [[ $? == 0 ]]; then
+    if declare -f "${bugsys}_determine_issue" >/dev/null; then
+      if "${bugsys}_determine_issue" "${PATCH_OR_ISSUE}"; then
         yetus_debug "${bugsys} says ${ISSUE}"
         return 0
       fi
@@ -1590,7 +1595,7 @@ function determine_needed_tests
     personality_file_tests "${i}"
 
     for plugin in ${TESTTYPES} ${BUILDTOOL}; do
-      if declare -f ${plugin}_filefilter >/dev/null 2>&1; then
+      if declare -f "${plugin}_filefilter" >/dev/null 2>&1; then
         "${plugin}_filefilter" "${i}"
       fi
     done
@@ -1609,8 +1614,7 @@ function apply_patch_file
 {
   big_console_header "Applying patch to ${PATCH_BRANCH}"
 
-  patchfile_apply_driver "${PATCH_DIR}/patch"
-  if [[ $? != 0 ]] ; then
+  if ! patchfile_apply_driver "${PATCH_DIR}/patch"; then
     echo "PATCH APPLICATION FAILED"
     ((RESULT = RESULT + 1))
     add_vote_table -1 patch "${PATCH_OR_ISSUE} does not apply to ${PATCH_BRANCH}. Rebase
required? Wrong Branch? See ${PATCH_NAMING_RULE} for help."
@@ -1644,7 +1648,7 @@ function copytpbits
     return
   fi
 
-  pushd "${STARTINGDIR}" >/dev/null
+  pushd "${STARTINGDIR}" >/dev/null || return 1
   mkdir -p "${PATCH_DIR}/precommit/user-plugins"
   mkdir -p "${PATCH_DIR}/precommit/personality"
   mkdir -p "${PATCH_DIR}/precommit/test-patch-docker"
@@ -1682,9 +1686,9 @@ function copytpbits
     yetus_debug "copying '${DOCKERFILE}' over to '${PATCH_DIR}/precommit/test-patch-docker/Dockerfile'"
     dockerdir=$(dirname "${DOCKERFILE}")
     dockfile=$(basename "${DOCKERFILE}")
-    pushd "${dockerdir}" >/dev/null
+    pushd "${dockerdir}" >/dev/null || return 1
     gitfilerev=$("${GIT}" log -n 1 --pretty=format:%h -- "${dockfile}" 2>/dev/null)
-    popd >/dev/null
+    popd >/dev/null || return 1
     if [[ -z ${gitfilerev} ]]; then
       gitfilerev=$(date "+%F")
       gitfilerev="date${gitfilerev}"
@@ -1700,16 +1704,16 @@ function copytpbits
       fi
       # make sure we put some space between, just in case last
       # line isn't an empty line or whatever
-      printf "\n\n"
+      printf '\n\n'
       echo "### YETUS_PRIVATE: start test-patch-bootstrap"
       cat "${BINDIR}/test-patch-docker/Dockerfile-endstub"
 
-      printf "\n\n"
+      printf '\n\n'
     ) > "${PATCH_DIR}/precommit/test-patch-docker/Dockerfile"
     DOCKERFILE="${PATCH_DIR}/precommit/test-patch-docker/Dockerfile"
   fi
 
-  popd >/dev/null
+  popd >/dev/null || return 1
 }
 
 ## @description  change the working directory to execute the buildtool
@@ -1729,19 +1733,19 @@ function buildtool_cwd
     if [[ ! -e "${BUILDTOOLCWD}" ]]; then
       mkdir -p "${BUILDTOOLCWD}"
     fi
-    pushd "${BUILDTOOLCWD}" >/dev/null
-    return $?
+    pushd "${BUILDTOOLCWD}" >/dev/null || return 1
+    return 0
   fi
 
   case "${BUILDTOOLCWD}" in
     basedir)
-      pushd "${BASEDIR}" >/dev/null
+      pushd "${BASEDIR}" >/dev/null || return 1
     ;;
     module)
-      pushd "${BASEDIR}/${MODULE[${modindex}]}" >/dev/null
+      pushd "${BASEDIR}/${MODULE[${modindex}]}" >/dev/null || return 1
     ;;
     *)
-      pushd "$(pwd)"
+      pushd "$(pwd)" || return 1
     ;;
   esac
 }
@@ -1774,6 +1778,7 @@ function check_reexec
       "${USER_PLUGIN_DIR}" \
       "${DOCKERFILE}"; do
     tpdir=$(relative_dir "${testdir}")
+    # shellcheck disable=SC2181
     if [[ $? == 0
         && "${CHANGED_FILES[*]}" =~ ${tpdir} ]]; then
       copy=true
@@ -2132,13 +2137,11 @@ function modules_workers
     fn=$(module_file_fragment "${MODULE[${modindex}]}")
     fn="${fn}${jdk}"
     modulesuffix=$(basename "${MODULE[${modindex}]}")
-    buildtool_cwd "${modindex}"
-
     if [[ ${modulesuffix} = \. ]]; then
       modulesuffix="root"
     fi
 
-    if [[ $? != 0 ]]; then
+    if ! buildtool_cwd "${modindex}"; then
       echo "${BASEDIR}/${MODULE[${modindex}]} no longer exists. Skipping."
       ((modindex=modindex+1))
       continue
@@ -2182,7 +2185,7 @@ function modules_workers
     MODULE_STATUS_TIMER[${modindex}]=${savestop}
     # shellcheck disable=SC2086
     echo "Elapsed: $(clock_display ${savestop})"
-    popd >/dev/null
+    popd >/dev/null || return 1
     ((modindex=modindex+1))
   done
 
@@ -2331,7 +2334,7 @@ function check_unittests
 
       needlog=0
       for testsys in ${TESTFORMATS}; do
-        if declare -f ${testsys}_process_tests >/dev/null; then
+        if declare -f "${testsys}_process_tests" >/dev/null; then
           yetus_debug "Calling ${testsys}_process_tests"
           "${testsys}_process_tests" "${module}" "${test_logfile}" "${fn}"
           formatresult=$?
@@ -2346,13 +2349,13 @@ function check_unittests
         module_status ${i} -1 "patch-unit-${fn}.txt"
       fi
 
-      popd >/dev/null
+      popd >/dev/null || return 1
 
       ((i=i+1))
     done
 
     for testsys in ${TESTFORMATS}; do
-      if declare -f ${testsys}_finalize_results >/dev/null; then
+      if declare -f "${testsys}_finalize_results" >/dev/null; then
         yetus_debug "Calling ${testsys}_finalize_results"
         "${testsys}_finalize_results" "${statusjdk}"
       fi
@@ -2404,7 +2407,7 @@ function bugsystem_linecomments
     uniline=$(${GREP} "${idxline}" "${GITUNIDIFFLINES}" | cut -f3 -d: )
 
     for bugs in ${BUGLINECOMMENTS}; do
-      if declare -f ${bugs}_linecomments >/dev/null;then
+      if declare -f "${bugs}_linecomments" >/dev/null;then
         "${bugs}_linecomments" "${title}" "${file}" "${realline}" "${uniline}" "${text}"
       fi
     done
@@ -2428,7 +2431,7 @@ function bugsystem_finalreport
   add_footer_table "Powered by" "Apache Yetus ${VERSION} http://yetus.apache.org"
 
   for bugs in ${BUGCOMMENTS}; do
-    if declare -f ${bugs}_finalreport >/dev/null;then
+    if declare -f "${bugs}_finalreport" >/dev/null;then
       "${bugs}_finalreport" "${@}"
     fi
   done
@@ -2483,11 +2486,10 @@ function runtests
 
   for plugin in ${TESTTYPES}; do
     verify_patchdir_still_exists
-    if declare -f ${plugin}_tests >/dev/null 2>&1; then
+    if declare -f "${plugin}_tests" >/dev/null 2>&1; then
       modules_reset
       yetus_debug "Running ${plugin}_tests"
-      #shellcheck disable=SC2086
-      ${plugin}_tests
+      "${plugin}_tests"
     fi
   done
   archive
@@ -2514,14 +2516,12 @@ function column_calcdiffs
   # accuracy in case of multiple, repeated errors
   # since the column number shouldn't change
   # if the line of code hasn't been touched
-  # shellcheck disable=SC2016
   cut -f3- -d: "${branch}" > "${tmp}.branch"
-  # shellcheck disable=SC2016
   cut -f3- -d: "${patch}" > "${tmp}.patch"
 
   # compare the errors, generating a string of line
   # numbers. Sorry portability: GNU diff makes this too easy
-  ${DIFF} --unchanged-line-format="" \
+  "${DIFF}" --unchanged-line-format="" \
      --old-line-format="" \
      --new-line-format="%dn " \
      "${tmp}.branch" \
@@ -2558,14 +2558,14 @@ function error_calcdiffs
 
   # first, pull out just the errors
   # shellcheck disable=SC2016
-  ${AWK} -F: '{print $NF}' "${branch}" > "${tmp}.branch"
+  "${AWK}" -F: '{print $NF}' "${branch}" > "${tmp}.branch"
 
   # shellcheck disable=SC2016
-  ${AWK} -F: '{print $NF}' "${patch}" > "${tmp}.patch"
+  "${AWK}" -F: '{print $NF}' "${patch}" > "${tmp}.patch"
 
   # compare the errors, generating a string of line
   # numbers. Sorry portability: GNU diff makes this too easy
-  ${DIFF} --unchanged-line-format="" \
+  "${DIFF}" --unchanged-line-format="" \
      --old-line-format="" \
      --new-line-format="%dn " \
      "${tmp}.branch" \
@@ -2608,11 +2608,11 @@ function calcdiffs
     touch "${patchlog}"
   fi
 
-  if declare -f ${PROJECT_NAME}_${testtype}_calcdiffs >/dev/null; then
+  if declare -f "${PROJECT_NAME}_${testtype}_calcdiffs" >/dev/null; then
     "${PROJECT_NAME}_${testtype}_calcdiffs" "${branchlog}" "${patchlog}"
-  elif declare -f ${BUILDTOOL}_${testtype}_calcdiffs >/dev/null; then
+  elif declare -f "${BUILDTOOL}_${testtype}_calcdiffs" >/dev/null; then
     "${BUILDTOOL}_${testtype}_calcdiffs" "${branchlog}" "${patchlog}"
-  elif declare -f ${testtype}_calcdiffs >/dev/null; then
+  elif declare -f "${testtype}_calcdiffs" >/dev/null; then
     "${testtype}_calcdiffs" "${branchlog}" "${patchlog}"
   else
     error_calcdiffs "${branchlog}" "${patchlog}"
@@ -2663,11 +2663,11 @@ function generic_logfilter
   declare input=$2
   declare output=$3
 
-  if declare -f ${PROJECT_NAME}_${testtype}_logfilter >/dev/null; then
+  if declare -f "${PROJECT_NAME}_${testtype}_logfilter" >/dev/null; then
     "${PROJECT_NAME}_${testtype}_logfilter" "${input}" "${output}"
-  elif declare -f ${BUILDTOOL}_${testtype}_logfilter >/dev/null; then
+  elif declare -f "${BUILDTOOL}_${testtype}_logfilter" >/dev/null; then
     "${BUILDTOOL}_${testtype}_logfilter" "${input}" "${output}"
-  elif declare -f ${testtype}_logfilter >/dev/null; then
+  elif declare -f "${testtype}_logfilter" >/dev/null; then
     "${testtype}_logfilter" "${input}" "${output}"
   else
     yetus_error "ERROR: ${testtype}: No function defined to filter problems."
@@ -2790,9 +2790,9 @@ function generic_postlog_compare
     generic_logfilter "${testtype}" "${PATCH_DIR}/patch-${origlog}-${fn}.txt" "${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt"
 
     # shellcheck disable=SC2016
-    numbranch=$(wc -l "${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt" | ${AWK} '{print
$1}')
+    numbranch=$(wc -l "${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt" | "${AWK}" '{print
$1}')
     # shellcheck disable=SC2016
-    numpatch=$(wc -l "${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt" | ${AWK} '{print
$1}')
+    numpatch=$(wc -l "${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt" | "${AWK}" '{print
$1}')
 
     calcdiffs \
       "${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt" \
@@ -2801,7 +2801,7 @@ function generic_postlog_compare
       > "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt"
 
     # shellcheck disable=SC2016
-    addpatch=$(wc -l "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt" | ${AWK} '{print
$1}')
+    addpatch=$(wc -l "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt" | "${AWK}" '{print
$1}')
 
     ((fixedpatch=numbranch-numpatch+addpatch))
 
@@ -2949,7 +2949,7 @@ function compile_nonjvm
   for plugin in ${TESTTYPES}; do
     modules_restore
     verify_patchdir_still_exists
-    if declare -f ${plugin}_compile >/dev/null 2>&1; then
+    if declare -f "${plugin}_compile" >/dev/null 2>&1; then
       yetus_debug "Running ${plugin}_compile ${codebase} ${multijdkmode}"
       "${plugin}_compile" "${codebase}" "${multijdkmode}"
       ((result = result + $?))
@@ -3010,11 +3010,9 @@ function compile_cycle
   find_changed_modules "${codebase}"
 
   for plugin in ${PROJECT_NAME} ${BUILDTOOL} ${TESTTYPES} ${TESTFORMATS}; do
-    if declare -f ${plugin}_precompile >/dev/null 2>&1; then
+    if declare -f "${plugin}_precompile" >/dev/null 2>&1; then
       yetus_debug "Running ${plugin}_precompile"
-      #shellcheck disable=SC2086
-      ${plugin}_precompile ${codebase}
-      if [[ $? -gt 0 ]]; then
+      if ! "${plugin}_precompile" "${codebase}"; then
         ((result = result+1))
       fi
       archive
@@ -3024,11 +3022,9 @@ function compile_cycle
   compile "${codebase}"
 
   for plugin in ${PROJECT_NAME} ${BUILDTOOL} ${TESTTYPES} ${TESTFORMATS}; do
-    if declare -f ${plugin}_postcompile >/dev/null 2>&1; then
+    if declare -f "${plugin}_postcompile" >/dev/null 2>&1; then
       yetus_debug "Running ${plugin}_postcompile"
-      #shellcheck disable=SC2086
-      ${plugin}_postcompile ${codebase}
-      if [[ $? -gt 0 ]]; then
+      if ! "${plugin}_postcompile" "${codebase}"; then
         ((result = result+1))
       fi
       archive
@@ -3036,11 +3032,9 @@ function compile_cycle
   done
 
   for plugin in ${PROJECT_NAME} ${BUILDTOOL} ${TESTTYPES} ${TESTFORMATS}; do
-    if declare -f ${plugin}_rebuild >/dev/null 2>&1; then
+    if declare -f "${plugin}_rebuild" >/dev/null 2>&1; then
       yetus_debug "Running ${plugin}_rebuild"
-      #shellcheck disable=SC2086
-      ${plugin}_rebuild ${codebase}
-      if [[ $? -gt 0 ]]; then
+      if ! "${plugin}_rebuild" "${codebase}"; then
         ((result = result+1))
       fi
       archive
@@ -3067,11 +3061,9 @@ function patchfiletests
   declare result=0
 
   for plugin in ${BUILDTOOL} ${TESTTYPES} ${TESTFORMATS}; do
-    if declare -f ${plugin}_patchfile >/dev/null 2>&1; then
+    if declare -f "${plugin}_patchfile" >/dev/null 2>&1; then
       yetus_debug "Running ${plugin}_patchfile"
-      #shellcheck disable=SC2086
-      ${plugin}_patchfile "${PATCH_DIR}/patch"
-      if [[ $? -gt 0 ]]; then
+      if ! "${plugin}_patchfile" "${PATCH_DIR}/patch"; then
         ((result = result+1))
       fi
       archive
@@ -3099,11 +3091,9 @@ function distclean
   big_console_header "Cleaning the source tree"
 
   for plugin in ${TESTTYPES} ${TESTFORMATS}; do
-    if declare -f ${plugin}_clean >/dev/null 2>&1; then
+    if declare -f "${plugin}_clean" >/dev/null 2>&1; then
       yetus_debug "Running ${plugin}_distclean"
-      #shellcheck disable=SC2086
-      ${plugin}_clean
-      if [[ $? -gt 0 ]]; then
+      if ! "${plugin}_clean"; then
         ((result = result+1))
       fi
     fi
@@ -3238,8 +3228,7 @@ function initialize
       echo "Testing ${ISSUE} patch on ${PATCH_BRANCH}."
     fi
 
-    patchfile_dryrun_driver "${PATCH_DIR}/patch"
-    if [[ $? != 0 ]]; then
+    if ! patchfile_dryrun_driver "${PATCH_DIR}/patch"; 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 ${PATCH_NAMING_RULE} for help."
@@ -3276,11 +3265,10 @@ function prechecks
   for plugin in ${BUILDTOOL} ${NEEDED_TESTS} ${TESTFORMATS}; do
     verify_patchdir_still_exists
 
-    if declare -f ${plugin}_precheck >/dev/null 2>&1; then
+    if declare -f "${plugin}_precheck" >/dev/null 2>&1; then
 
       yetus_debug "Running ${plugin}_precheck"
-      #shellcheck disable=SC2086
-      ${plugin}_precheck
+      "${plugin}_precheck"
 
       (( result = result + $? ))
       if [[ ${result} != 0 ]] ; then
@@ -3375,4 +3363,3 @@ finish_footer_table
 
 bugsystem_finalreport ${RESULT}
 cleanup_and_exit ${RESULT}
-

http://git-wip-us.apache.org/repos/asf/yetus/blob/9a2cd581/yetus-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/yetus-maven-plugin/pom.xml b/yetus-maven-plugin/pom.xml
index 13072d4..a73f709 100644
--- a/yetus-maven-plugin/pom.xml
+++ b/yetus-maven-plugin/pom.xml
@@ -78,7 +78,9 @@
             </goals>
             <configuration>
               <sources>
-                <source>../yetus-minimaven-plugin/src/main</source>
+                <source>../yetus-minimaven-plugin/src/main/resources</source>
+                <source>../yetus-minimaven-plugin/src/main/java/org/apache/yetus/maven/plugin/fileops/MakeBins4Libs.java</source>
+                <source>../yetus-minimaven-plugin/src/main/java/org/apache/yetus/maven/plugin/fileops/CreateSymLinkMojo.java</source>
               </sources>
             </configuration>
           </execution>


Mime
View raw message