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 2016/04/22 22:25:33 UTC

[15/22] yetus git commit: YETUS-385. test plugin for author tag detection should have a way to opt-out of specific instances

YETUS-385. test plugin for author tag detection should have a way to opt-out of specific instances

Signed-off-by: Allen Wittenauer <aw...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/7501b403
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/7501b403
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/7501b403

Branch: refs/heads/YETUS-156
Commit: 7501b40367069cc0a15cd898f326b8a0d3dd7568
Parents: daf411f
Author: Allen Wittenauer <aw...@apache.org>
Authored: Mon Apr 18 13:40:37 2016 -0700
Committer: Allen Wittenauer <aw...@apache.org>
Committed: Fri Apr 22 13:25:07 2016 -0700

----------------------------------------------------------------------
 precommit/test-patch.d/author.sh | 43 ++++++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/7501b403/precommit/test-patch.d/author.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/author.sh b/precommit/test-patch.d/author.sh
index 0e00c80..dccd504 100755
--- a/precommit/test-patch.d/author.sh
+++ b/precommit/test-patch.d/author.sh
@@ -16,6 +16,32 @@
 
 add_test_type author
 
+## @description  author usage hook
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function author_usage
+{
+  yetus_add_option "--author-ignore-list=<list>" "list of filenames to ignore (full build mode only)"
+}
+
+## @description  author parse args hook
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function author_parse_args
+{
+  declare i
+
+  for i in "$@"; do
+    case ${i} in
+      --author-ignore-list=*)
+        yetus_comma_to_array AUTHOR_IGNORE_LIST "${i#*=}"
+      ;;
+    esac
+  done
+}
+
 ## @description  helper function for @author tags check
 ## @audience     private
 ## @stability    evolving
@@ -93,7 +119,7 @@ function author_postcompile
 {
   # shellcheck disable=SC2155
   declare -r appname=$(basename "${BASH_SOURCE-$0}")
-  declare i
+  declare fn
 
   if [[ "${BUILDMODE}" != full ]]; then
     return
@@ -103,9 +129,20 @@ function author_postcompile
 
   start_clock
 
-  "${GIT}" grep -n -I --extended-regexp -i '^[^-].*@author' \
+  "${GIT}" grep -n -I --extended-regexp -i -e '^[^-].*@author' \
     | ${GREP} -v "${appname}" \
-    >> "${PATCH_DIR}/author-tags.txt"
+    >> "${PATCH_DIR}/author-tags-git.txt"
+
+  if [[ -z "${AUTHOR_IGNORE_LIST[0]}" ]]; then
+    cp -p "${PATCH_DIR}/author-tags-git.txt" "${PATCH_DIR}/author-tags.txt"
+  else
+    cp -p "${PATCH_DIR}/author-tags-git.txt" "${PATCH_DIR}/author-tags.1"
+    for fn in "${AUTHOR_IGNORE_LIST[@]}"; do
+      ${GREP} -v -E "^${fn}" "${PATCH_DIR}/author-tags.1" >> "${PATCH_DIR}/author-tags.2"
+      mv "${PATCH_DIR}/author-tags.2" "${PATCH_DIR}/author-tags.1"
+    done
+    mv "${PATCH_DIR}/author-tags.1" "${PATCH_DIR}/author-tags.txt"
+  fi
 
   author_generic
 }