yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [yetus] branch master updated: YETUS-836. add a version field
Date Sat, 06 Apr 2019 16:04:42 GMT
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 ed583bb  YETUS-836. add a version field
ed583bb is described below

commit ed583bb8c5b4ab3f15a7c3f6b283651c5664955a
Author: Allen Wittenauer <aw@apache.org>
AuthorDate: Wed Apr 3 07:42:47 2019 -0700

    YETUS-836. add a version field
    
    Signed-off-by: Allen Wittenauer <aw@apache.org>
---
 precommit/src/main/shell/core.d/01-common.sh       | 25 +++++++++++++++++++---
 precommit/src/main/shell/test-patch.d/ant.sh       |  4 +++-
 precommit/src/main/shell/test-patch.d/cmake.sh     |  2 +-
 precommit/src/main/shell/test-patch.d/gradle.sh    |  2 +-
 precommit/src/main/shell/test-patch.d/hadolint.sh  |  4 ++++
 precommit/src/main/shell/test-patch.d/jshint.sh    |  4 ++++
 precommit/src/main/shell/test-patch.d/make.sh      |  2 +-
 precommit/src/main/shell/test-patch.d/maven.sh     |  3 ++-
 .../src/main/shell/test-patch.d/perlcritic.sh      |  2 +-
 precommit/src/main/shell/test-patch.d/pylint.sh    |  2 +-
 precommit/src/main/shell/test-patch.d/rubocop.sh   |  2 +-
 .../src/main/shell/test-patch.d/shellcheck.sh      |  6 +++---
 precommit/src/main/shell/test-patch.d/spotbugs.sh  |  2 +-
 precommit/src/main/shell/test-patch.d/yamllint.sh  |  5 +++++
 precommit/src/main/shell/test-patch.sh             |  5 +++++
 15 files changed, 55 insertions(+), 15 deletions(-)

diff --git a/precommit/src/main/shell/core.d/01-common.sh b/precommit/src/main/shell/core.d/01-common.sh
index ffd1e67..a175deb 100755
--- a/precommit/src/main/shell/core.d/01-common.sh
+++ b/precommit/src/main/shell/core.d/01-common.sh
@@ -64,6 +64,8 @@ function common_defaults
   TESTTYPES=()
   TESTFORMATS=()
   USER_PLUGIN_DIR=""
+  #shellcheck disable=SC2034
+  VERSION_DATA=()
 
   #shellcheck disable=SC2034
   YETUS_SHELL_SCRIPT_DEBUG=false
@@ -224,15 +226,16 @@ function common_args
   # versions lower than this either have bugs with
   # git apply or don't support all the
   # expected options
-  version=$(${GIT} --version)
+  version=$("${GIT}" --version)
   # shellcheck disable=SC2181
   if [[ $? != 0 ]]; then
     yetus_error "ERROR: ${GIT} failed during version detection."
     exit 1
   fi
 
-  # shellcheck disable=SC2016
-  version=$(echo "${version}" | "${AWK}" '{print $NF}')
+  version=${version##* }
+  add_version_data git "${version}"
+
   if [[ ${version} =~ ^0
      || ${version} =~ ^1.[0-6]
      || ${version} =~ ^1.7.[0-2]$
@@ -757,4 +760,20 @@ function module_file_fragment
     #shellcheck disable=SC1003
     echo "$1" | tr '/' '_' | tr '\\' '_'
   fi
+}
+
+## @description  Report on executable versions
+## @audience     public
+## @stability    stable
+## @replaceable  no
+## @param        executable name
+## @param        version
+function add_version_data
+{
+  declare name=$1
+  declare version=$2
+
+  if [[ -n "${name}" ]] && [[ -n "${version}" ]]; then
+    VERSION_DATA+=("$1=$2")
+  fi
 }
\ No newline at end of file
diff --git a/precommit/src/main/shell/test-patch.d/ant.sh b/precommit/src/main/shell/test-patch.d/ant.sh
index 7171d26..d7ab534 100755
--- a/precommit/src/main/shell/test-patch.d/ant.sh
+++ b/precommit/src/main/shell/test-patch.d/ant.sh
@@ -73,7 +73,9 @@ function ant_precheck
   fi
   # finally let folks know what version they'll be dealing with.
   ant_version=$(${ANT} -version 2>/dev/null)
-  add_footer_table ant "version: ${ant_version}"
+  ant_version=${ant_version#* version }
+  ant_version=${ant_version% compiled *}
+  add_footer_table ant "${ant_version}"
   return 0
 }
 
diff --git a/precommit/src/main/shell/test-patch.d/cmake.sh b/precommit/src/main/shell/test-patch.d/cmake.sh
index c3c72ab..a77da38 100755
--- a/precommit/src/main/shell/test-patch.d/cmake.sh
+++ b/precommit/src/main/shell/test-patch.d/cmake.sh
@@ -79,7 +79,7 @@ function cmake_precheck
   fi
   # finally let folks know what version they'll be dealing with.
   cmake_version=$("${CMAKE}" --version 2>/dev/null | head -n 1 2>/dev/null)
-  add_footer_table cmake "version: ${cmake_version}"
+  add_version_data cmake "${cmake_version}"
 
   make_precheck
 }
diff --git a/precommit/src/main/shell/test-patch.d/gradle.sh b/precommit/src/main/shell/test-patch.d/gradle.sh
index 6e2382c..45142e9 100755
--- a/precommit/src/main/shell/test-patch.d/gradle.sh
+++ b/precommit/src/main/shell/test-patch.d/gradle.sh
@@ -60,7 +60,7 @@ function gradle_precheck
   fi
   # finally let folks know what version they'll be dealing with.
   gradle_version=$("${GRADLE}" --version 2>/dev/null | grep Gradle 2>/dev/null)
-  add_footer_table gradle "version: ${gradle_version}"
+  add_version_data gradle "${gradle_version##* }"
   return 0
 }
 
diff --git a/precommit/src/main/shell/test-patch.d/hadolint.sh b/precommit/src/main/shell/test-patch.d/hadolint.sh
index 9e1ce93..89e53d7 100755
--- a/precommit/src/main/shell/test-patch.d/hadolint.sh
+++ b/precommit/src/main/shell/test-patch.d/hadolint.sh
@@ -141,6 +141,7 @@ function hadolint_postapply
   declare diffPostpatch
   declare fixedpatch
   declare statstring
+  declare version
 
   if ! verify_needed_test hadolint; then
     return 0
@@ -162,6 +163,9 @@ function hadolint_postapply
     hadolint \
       > "${PATCH_DIR}/diff-patch-hadolint.txt"
 
+  version=$("${HADOLINT}" --version)
+  add_version_data hadolint "${version##* v}"
+
   # shellcheck disable=SC2016
   numPrepatch=$(wc -l "${PATCH_DIR}/branch-hadolint-result.txt" | "${AWK}" '{print $1}')
 
diff --git a/precommit/src/main/shell/test-patch.d/jshint.sh b/precommit/src/main/shell/test-patch.d/jshint.sh
index 0646a30..cc4efc5 100755
--- a/precommit/src/main/shell/test-patch.d/jshint.sh
+++ b/precommit/src/main/shell/test-patch.d/jshint.sh
@@ -146,6 +146,7 @@ function jshint_postapply
   declare diffPostpatch
   declare fixedpatch
   declare statstring
+  declare version
 
   if ! verify_needed_test jshint; then
     return 0
@@ -161,6 +162,9 @@ function jshint_postapply
 
   jshint_logic patch
 
+  version=$("${JSHINT}" --version 2>&1)
+  add_version_data jshint "${version#*v}"
+
   calcdiffs \
     "${PATCH_DIR}/branch-jshint-result.txt" \
     "${PATCH_DIR}/patch-jshint-result.txt" \
diff --git a/precommit/src/main/shell/test-patch.d/make.sh b/precommit/src/main/shell/test-patch.d/make.sh
index 76ab6af..7093029 100755
--- a/precommit/src/main/shell/test-patch.d/make.sh
+++ b/precommit/src/main/shell/test-patch.d/make.sh
@@ -42,7 +42,7 @@ function make_precheck
   fi
   # finally let folks know what version they'll be dealing with.
   if make_version=$(set -o pipefail; ${MAKE} --version 2>/dev/null | head -n 1  2>/dev/null)
&& [ -n "${make_version}" ]; then
-    add_footer_table make "version: ${make_version}"
+    add_version_data make "${make_version}"
   fi
   return 0
 }
diff --git a/precommit/src/main/shell/test-patch.d/maven.sh b/precommit/src/main/shell/test-patch.d/maven.sh
index 5b2d9ab..53d3417 100755
--- a/precommit/src/main/shell/test-patch.d/maven.sh
+++ b/precommit/src/main/shell/test-patch.d/maven.sh
@@ -250,7 +250,8 @@ function maven_precheck
 
   # finally let folks know what version they'll be dealing with.
   maven_version=$(${MAVEN} --offline --version 2>/dev/null | head -n 1 2>/dev/null)
-  add_footer_table maven "version: ${maven_version}"
+  maven_version=${maven_version##* }
+  add_version_data maven "${maven_version}"
 }
 
 ## @description  maven trigger
diff --git a/precommit/src/main/shell/test-patch.d/perlcritic.sh b/precommit/src/main/shell/test-patch.d/perlcritic.sh
index f2ee183..5c09a05 100755
--- a/precommit/src/main/shell/test-patch.d/perlcritic.sh
+++ b/precommit/src/main/shell/test-patch.d/perlcritic.sh
@@ -127,7 +127,7 @@ function perlcritic_postapply
   popd >/dev/null || return 1
 
   PERLCRITIC_VERSION=$(${PERLCRITIC} --version 2>/dev/null)
-  add_footer_table perlcritic "v${PERLCRITIC_VERSION}"
+  add_version_data perlcritic "${PERLCRITIC_VERSION}"
 
   calcdiffs \
     "${PATCH_DIR}/branch-perlcritic-result.txt" \
diff --git a/precommit/src/main/shell/test-patch.d/pylint.sh b/precommit/src/main/shell/test-patch.d/pylint.sh
index ed549d4..d32dd7d 100755
--- a/precommit/src/main/shell/test-patch.d/pylint.sh
+++ b/precommit/src/main/shell/test-patch.d/pylint.sh
@@ -204,7 +204,7 @@ function pylint_postapply
 
   # shellcheck disable=SC2016
   PYLINT_VERSION=$("${PYLINT}" --version 2>/dev/null | "${GREP}" pylint | "${AWK}" '{print
$NF}')
-  add_footer_table pylint "v${PYLINT_VERSION%,}"
+  add_version_data pylint "${PYLINT_VERSION%,}"
 
   calcdiffs "${PATCH_DIR}/branch-pylint-result.txt" \
             "${PATCH_DIR}/patch-pylint-result.txt" \
diff --git a/precommit/src/main/shell/test-patch.d/rubocop.sh b/precommit/src/main/shell/test-patch.d/rubocop.sh
index dd1a322..84a9fe0 100755
--- a/precommit/src/main/shell/test-patch.d/rubocop.sh
+++ b/precommit/src/main/shell/test-patch.d/rubocop.sh
@@ -142,7 +142,7 @@ function rubocop_postapply
 
   # shellcheck disable=SC2016
   RUBOCOP_VERSION=$("${RUBOCOP}" -v | "${AWK}" '{print $NF}')
-  add_footer_table rubocop "v${RUBOCOP_VERSION}"
+  add_version_data rubocop "${RUBOCOP_VERSION}"
 
   calcdiffs \
     "${PATCH_DIR}/branch-rubocop-result.txt" \
diff --git a/precommit/src/main/shell/test-patch.d/shellcheck.sh b/precommit/src/main/shell/test-patch.d/shellcheck.sh
index 795466a..b5d7855 100755
--- a/precommit/src/main/shell/test-patch.d/shellcheck.sh
+++ b/precommit/src/main/shell/test-patch.d/shellcheck.sh
@@ -171,11 +171,11 @@ function shellcheck_preapply
 
   shellcheck_logic branch
 
-  msg="v${SHELLCHECK_VERSION}"
   if [[ ${SHELLCHECK_VERSION} =~ 0.[0-3].[0-5] ]]; then
-    msg="${msg} (This is an old version that has serious bugs. Consider upgrading.)"
+    msg="v${SHELLCHECK_VERSION} is an old version that has serious bugs. Consider upgrading."
+    add_footer_table shellcheck "${msg}"
   fi
-  add_footer_table shellcheck "${msg}"
+  add_version_data shellcheck "${SHELLCHECK_VERSION}"
 
   # keep track of how much as elapsed for us already
   SHELLCHECK_TIMER=$(stop_clock)
diff --git a/precommit/src/main/shell/test-patch.d/spotbugs.sh b/precommit/src/main/shell/test-patch.d/spotbugs.sh
index 57c5815..e43bab4 100755
--- a/precommit/src/main/shell/test-patch.d/spotbugs.sh
+++ b/precommit/src/main/shell/test-patch.d/spotbugs.sh
@@ -241,7 +241,7 @@ function spotbugs_runner
         | cut -f2 -d\" \
         | cut -f1 -d\" )
       if [[ -n ${SPOTBUGS_VERSION} ]]; then
-        add_footer_table "${SPOTBUGS_MODE}" "v${SPOTBUGS_VERSION}"
+        add_version_data "${SPOTBUGS_MODE}" "${SPOTBUGS_VERSION}"
       fi
     fi
 
diff --git a/precommit/src/main/shell/test-patch.d/yamllint.sh b/precommit/src/main/shell/test-patch.d/yamllint.sh
index 3d852d8..06d6a10 100755
--- a/precommit/src/main/shell/test-patch.d/yamllint.sh
+++ b/precommit/src/main/shell/test-patch.d/yamllint.sh
@@ -103,6 +103,7 @@ function yamllint_postapply
   declare diffPostpatch
   declare fixedpatch
   declare statstring
+  declare version
 
   if ! verify_needed_test yamllint; then
     return 0
@@ -118,6 +119,10 @@ function yamllint_postapply
 
   yamllint_logic patch
 
+  # shellcheck disable=SC2016
+  version=$("${YAMLLINT}" --version 2>&1)
+  add_version_data yamllint "${version#* }"
+
   calcdiffs \
     "${PATCH_DIR}/branch-yamllint-result.txt" \
     "${PATCH_DIR}/patch-yamllint-result.txt" \
diff --git a/precommit/src/main/shell/test-patch.sh b/precommit/src/main/shell/test-patch.sh
index 2d2d532..124dde1 100755
--- a/precommit/src/main/shell/test-patch.sh
+++ b/precommit/src/main/shell/test-patch.sh
@@ -2236,6 +2236,11 @@ function bugsystem_finalreport
       "${ROBOTTYPE}"_finalreport
     fi
   fi
+
+  if [[ "${#VERSION_DATA[@]}" -gt 0 ]]; then
+    add_footer_table "versions" "${VERSION_DATA[@]}"
+  fi
+
   add_footer_table "Powered by" "Apache Yetus ${VERSION} http://yetus.apache.org"
 
   bugsystem_linecomments_trigger


Mime
View raw message