yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [01/14] yetus git commit: YETUS-50. asflicense is easily tricked (aw)
Date Wed, 07 Oct 2015 15:25:03 GMT
Repository: yetus
Updated Branches:
  refs/heads/master 8db8c5718 -> 142dc995f


YETUS-50. asflicense is easily tricked (aw)


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

Branch: refs/heads/master
Commit: c44ce1e381ddacd2321cc9f445ce0c3ef4cc3f23
Parents: 8db8c57
Author: Allen Wittenauer <aw@apache.org>
Authored: Wed Oct 7 08:09:00 2015 -0700
Committer: Allen Wittenauer <aw@apache.org>
Committed: Wed Oct 7 08:09:00 2015 -0700

----------------------------------------------------------------------
 dev-support/test-patch.d/asflicense.sh | 49 +++++++++++++++++------------
 1 file changed, 29 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/c44ce1e3/dev-support/test-patch.d/asflicense.sh
----------------------------------------------------------------------
diff --git a/dev-support/test-patch.d/asflicense.sh b/dev-support/test-patch.d/asflicense.sh
index d839d5f..255c257 100755
--- a/dev-support/test-patch.d/asflicense.sh
+++ b/dev-support/test-patch.d/asflicense.sh
@@ -27,6 +27,7 @@ add_test asflicense
 function asflicense_tests
 {
   local numpatch
+  local btfails=true
 
   big_console_header "Determining number of patched ASF License errors"
 
@@ -38,6 +39,7 @@ function asflicense_tests
       modules_workers patch asflicense releaseaudit
     ;;
     gradle)
+      btfails=false
       modules_workers patch asflicense rat
     ;;
     maven)
@@ -50,7 +52,7 @@ function asflicense_tests
 
   # RAT fails the build if there are license problems.
   # so let's take advantage of that a bit.
-  if [[ $? == 0 ]]; then
+  if [[ $? == 0 && ${btfails} = true ]]; then
     add_vote_table 1 asflicense "Patch does not generate ASF License warnings."
     return 0
   fi
@@ -61,27 +63,34 @@ function asflicense_tests
         -o -name rat-report.txt \
     | xargs cat > "${PATCH_DIR}/patch-asflicense.txt"
 
-  if [[ -s "${PATCH_DIR}/patch-asflicense.txt" ]] ; then
-    numpatch=$("${GREP}" -c '\!?????' "${PATCH_DIR}/patch-asflicense.txt")
-    echo ""
-    echo ""
-    echo "There appear to be ${numpatch} ASF License warnings after applying the patch."
-    if [[ -n ${numpatch}
-       && ${numpatch} -gt 0 ]] ; then
-      add_vote_table -1 asflicense "Patch generated ${numpatch} ASF License warnings."
+  if [[ ! -s "${PATCH_DIR}/patch-asflicense.txt" ]]; then
+    if [[ ${btfails} = true ]]; then
+      # if we're here, then build actually failed
+      modules_messages patch asflicense true
+    else
+      add_vote_table 0 asflicense "ASF License check generated no output?"
+      return 0
+    fi
+  fi
 
-      echo "Lines that start with ????? in the ASF License "\
-          "report indicate files that do not have an Apache license header:" \
-            > "${PATCH_DIR}/patch-asflicense-problems.txt"
+  numpatch=$("${GREP}" -c '\!?????' "${PATCH_DIR}/patch-asflicense.txt")
+  echo ""
+  echo ""
+  echo "There appear to be ${numpatch} ASF License warnings after applying the patch."
+  if [[ -n ${numpatch}
+     && ${numpatch} -gt 0 ]] ; then
+    add_vote_table -1 asflicense "Patch generated ${numpatch} ASF License warnings."
 
-      ${GREP} '\!?????' "${PATCH_DIR}/patch-asflicense.txt" \
-      >>  "${PATCH_DIR}/patch-asflicense-problems.txt"
+    echo "Lines that start with ????? in the ASF License "\
+        "report indicate files that do not have an Apache license header:" \
+          > "${PATCH_DIR}/patch-asflicense-problems.txt"
 
-      add_footer_table asflicense "@@BASE@@/patch-asflicense-problems.txt"
-    fi
-  else
-    # if we're here, then build actually failed
-    modules_messages patch asflicense true
+    ${GREP} '\!?????' "${PATCH_DIR}/patch-asflicense.txt" \
+    >>  "${PATCH_DIR}/patch-asflicense-problems.txt"
+
+    add_footer_table asflicense "@@BASE@@/patch-asflicense-problems.txt"
+    return 1
   fi
-  return 1
+  add_vote_table 1 asflicense "Patch does not generate ASF License warnings."
+  return 0
 }


Mime
View raw message