diff options
author | June.He <jun.hejun@huawei.com> | 2015-04-10 20:02:35 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2015-04-10 20:02:35 +0100 |
commit | 9f5ed99d644949443d19c4895de6e0ece4be24d0 (patch) | |
tree | 8383d874403dce9e341f92a5e38f0678bb9267e0 /dev/check-license | |
parent | 18ca089bed41ce3e87deeb14206317863518c12c (diff) | |
download | spark-9f5ed99d644949443d19c4895de6e0ece4be24d0.tar.gz spark-9f5ed99d644949443d19c4895de6e0ece4be24d0.tar.bz2 spark-9f5ed99d644949443d19c4895de6e0ece4be24d0.zip |
[SPARK-6773][Tests]Fix RAT checks still passed issue when download rat jar failed
check -license will passed in next time when rat jar download failed.
Add 2 step to fix this:
1. Clean the rat.jar if download failed.
2. Add a check logic after run rat checking.
Author: June.He <jun.hejun@huawei.com>
Closes #5421 from sisihj/rat-issue and squashes the following commits:
4958302 [June.He] delete redundant check and add quoted
66f7088 [June.He] Fix RAT checks still passed issue when download rat jar failed
7311e83 [June.He] Fix RAT checks still passed issue when download rat jar failed
Diffstat (limited to 'dev/check-license')
-rwxr-xr-x | dev/check-license | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/dev/check-license b/dev/check-license index 39943f882b..10740cfdc5 100755 --- a/dev/check-license +++ b/dev/check-license @@ -24,29 +24,27 @@ acquire_rat_jar () { JAR="$rat_jar" - if [[ ! -f "$rat_jar" ]]; then - # Download rat launch jar if it hasn't been downloaded yet - if [ ! -f "$JAR" ]; then - # Download - printf "Attempting to fetch rat\n" - JAR_DL="${JAR}.part" - if [ $(command -v curl) ]; then - curl -L --silent "${URL}" > "$JAR_DL" && mv "$JAR_DL" "$JAR" - elif [ $(command -v wget) ]; then - wget --quiet ${URL} -O "$JAR_DL" && mv "$JAR_DL" "$JAR" - else - printf "You do not have curl or wget installed, please install rat manually.\n" - exit -1 - fi - fi - - unzip -tq $JAR &> /dev/null - if [ $? -ne 0 ]; then - # We failed to download - printf "Our attempt to download rat locally to ${JAR} failed. Please install rat manually.\n" + # Download rat launch jar if it hasn't been downloaded yet + if [ ! -f "$JAR" ]; then + # Download + printf "Attempting to fetch rat\n" + JAR_DL="${JAR}.part" + if [ $(command -v curl) ]; then + curl -L --silent "${URL}" > "$JAR_DL" && mv "$JAR_DL" "$JAR" + elif [ $(command -v wget) ]; then + wget --quiet ${URL} -O "$JAR_DL" && mv "$JAR_DL" "$JAR" + else + printf "You do not have curl or wget installed, please install rat manually.\n" exit -1 fi - printf "Launching rat from ${JAR}\n" + fi + + unzip -tq "$JAR" &> /dev/null + if [ $? -ne 0 ]; then + # We failed to download + rm "$JAR" + printf "Our attempt to download rat locally to ${JAR} failed. Please install rat manually.\n" + exit -1 fi } @@ -71,6 +69,11 @@ mkdir -p "$FWDIR"/lib $java_cmd -jar "$rat_jar" -E "$FWDIR"/.rat-excludes -d "$FWDIR" > rat-results.txt +if [ $? -ne 0 ]; then + echo "RAT exited abnormally" + exit 1 +fi + ERRORS="$(cat rat-results.txt | grep -e "??")" if test ! -z "$ERRORS"; then |