This is an automated email from the ASF dual-hosted git repository.

aw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/main by this push:
     new 79ac652  YETUS-1053. Add Apache Creadur RAT to the docker image (#179)
79ac652 is described below

commit 79ac6525b19f79b0ae1760d2394c5f03d1d2ad4e
Author: Allen Wittenauer <[email protected]>
AuthorDate: Thu Oct 29 10:29:16 2020 -0700

    YETUS-1053. Add Apache Creadur RAT to the docker image (#179)
---
 .../in-progress/precommit/plugins/asflicense.html.md         |  6 ++++--
 precommit/src/main/shell/test-patch-docker/Dockerfile        | 12 ++++++++++++
 precommit/src/main/shell/test-patch.d/asflicense.sh          |  4 +++-
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git 
a/asf-site-src/source/documentation/in-progress/precommit/plugins/asflicense.html.md
 
b/asf-site-src/source/documentation/in-progress/precommit/plugins/asflicense.html.md
index b7c8f3f..40829b9 100644
--- 
a/asf-site-src/source/documentation/in-progress/precommit/plugins/asflicense.html.md
+++ 
b/asf-site-src/source/documentation/in-progress/precommit/plugins/asflicense.html.md
@@ -27,7 +27,9 @@ Test
 
 # Description
 
-Runs the [Apache Creadur](http://creadur.apache.org) project's 
[Rat](http://creadur.apache.org/rat/) code to verify software licensing.  
Currently, `ant`, `gradle`, and `maven` have built-in support. For other build 
tools, the rat jar will need to be provided.
+Runs the [Apache Creadur](http://creadur.apache.org) project's 
[Rat](http://creadur.apache.org/rat/) code to verify software licensing.
+Currently, `ant`, `gradle`, and `maven` have built-in support.  The Apache 
Yetus container image also provides the jar file in /opt/apache-rat.
+For other build tools/scenarios, the rat jar will need to be provided.
 
 # Environment Variables
 
@@ -38,7 +40,7 @@ None
 | Option | Notes |
 |:---------|:------|
 | `--asflicense-rat-excludes=<path>` | When running rat outside of a build 
tool, specify the location of the exclusion file |
-| `--asflicense-rat-jar=<path` | When running rat outside of a build tool, 
specify the location of the Java jar file to execute |
+| `--asflicense-rat-jar=<path>` | When running rat outside of a build tool, 
specify the location of the Java jar file to execute. Defaults to 
/opt/apache-rat/apache-rat.jar |
 
 # Docker Notes
 
diff --git a/precommit/src/main/shell/test-patch-docker/Dockerfile 
b/precommit/src/main/shell/test-patch-docker/Dockerfile
index 097b26b..bb0f7d8 100644
--- a/precommit/src/main/shell/test-patch-docker/Dockerfile
+++ b/precommit/src/main/shell/test-patch-docker/Dockerfile
@@ -100,6 +100,18 @@ RUN apt-get -q update && apt-get -q install 
--no-install-recommends -y ant \
     && rm -rf /var/lib/apt/lists/*
 
 ####
+# Install Apache Creadur RAT jar
+####
+RUN mkdir -p /opt/apache-rat \
+    && curl -f -s -L -o /tmp/rat.tgz \
+        
'https://www.apache.org/dyn/closer.cgi?action=download&filename=/creadur/apache-rat-0.13/apache-rat-0.13-bin.tar.gz'
 \
+    && shasum -a 512 /tmp/rat.tgz \
+        | awk 
'$1!="2c1e12eace7b80a9b6373c2f5080fbf63d3fa8d9248f3a17bd05de961cd3ca3c4549817b8b7320a84f0c323194edad0abdb86bdfec3976227a228e2143e14a54"
 {exit(1)}' \
+    && tar --strip-components 1 -C /opt/apache-rat -xpzf /tmp/rat.tgz \
+    && rm /tmp/rat.tgz \
+    && mv /opt/apache-rat/apache-rat-0.13.jar /opt/apache-rat/apache-rat.jar
+
+####
 # Install GNU automake, GNU make, and related
 ####
 RUN apt-get -q update && apt-get -q install --no-install-recommends -y 
autoconf automake libtool make \
diff --git a/precommit/src/main/shell/test-patch.d/asflicense.sh 
b/precommit/src/main/shell/test-patch.d/asflicense.sh
index 5b17549..d98466d 100755
--- a/precommit/src/main/shell/test-patch.d/asflicense.sh
+++ b/precommit/src/main/shell/test-patch.d/asflicense.sh
@@ -18,6 +18,8 @@
 
 add_test_type asflicense
 
+ASFLICENSE_RAT_JAR=/opt/apache-rat/apache-rat.jar
+
 function asflicense_usage
 {
   yetus_add_option "--asflicense-rat-excludes=<file>" "path to file containing 
exclusion patterns"
@@ -86,7 +88,7 @@ function asflicense_tests
       btfails=false
     ;;
     *)
-      if [[ -z "${ASFLICENSE_RAT_JAR}" ]]; then
+      if [[ ! -f "${ASFLICENSE_RAT_JAR}" ]]; then
         return 0
       fi
 

Reply via email to