Repository: yetus
Updated Branches:
  refs/heads/master 32c9b5401 -> e94d8c4b3


YETUS-699. HTML report doesn't generate links when console-urls is turned on

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


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

Branch: refs/heads/master
Commit: 13487fdffa58cec06f14de4cfc260eb746cc653c
Parents: 32c9b54
Author: Allen Wittenauer <a...@apache.org>
Authored: Wed Nov 14 14:03:40 2018 -0800
Committer: Allen Wittenauer <a...@apache.org>
Committed: Mon Dec 10 00:05:29 2018 -0800

----------------------------------------------------------------------
 .../src/main/shell/test-patch.d/htmlout.sh      | 28 +++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/13487fdf/precommit/src/main/shell/test-patch.d/htmlout.sh
----------------------------------------------------------------------
diff --git a/precommit/src/main/shell/test-patch.d/htmlout.sh 
b/precommit/src/main/shell/test-patch.d/htmlout.sh
index f637d1a..9439412 100755
--- a/precommit/src/main/shell/test-patch.d/htmlout.sh
+++ b/precommit/src/main/shell/test-patch.d/htmlout.sh
@@ -225,11 +225,33 @@ function htmlout_finalreport
 
   i=0
   until [[ $i -eq ${#TP_FOOTER_TABLE[@]} ]]; do
-    ourstring=$(echo "${TP_FOOTER_TABLE[${i}]}" |
-              ${SED} -e "s,@@BASE@@,${BUILD_URL}${BUILD_URL_ARTIFACTS},g" |
-              tr -s ' ')
+
+    # turn off file globbing. break apart the string by spaces.
+    # if our string begins with @@BASE@@, then create a substring
+    # without the base url, and one with the base, but replace
+    # it with the URL magic.  then use those strings in an href
+    # structure.
+    # otherwise, copy it unmodified.  this also acts to strip
+    # excess spaces
+    set -f
+    ourstring=""
+    for j in ${TP_FOOTER_TABLE[${i}]}; do
+      if [[ "${j}" =~ ^@@BASE@@ ]]; then
+        t1=${j#@@BASE@@/}
+        t2=$(echo "${j}" | "${SED}" -e 
"s,@@BASE@@,${BUILD_URL}${BUILD_URL_ARTIFACTS},g")
+        if [[ -n "${BUILD_URL}" ]]; then
+          t2="<a href=\"${t2}\">${t1}</a>"
+        fi
+        ourstring="${ourstring} ${t2}"
+      else
+        ourstring="${ourstring} ${j}"
+      fi
+    done
+    set +f
+
     subs=$(echo "${ourstring}"  | cut -f2 -d\|)
     comment=$(echo "${ourstring}"  | cut -f3 -d\|)
+
     {
       echo "<tr>"
       printf "<td><font color=\"%s\">%s</font></td>" "${color}" "${subs}"

Reply via email to