You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by hu...@apache.org on 2019/08/04 02:40:05 UTC
[dubbo] branch master updated: Improve license check script (#4196)
This is an automated email from the ASF dual-hosted git repository.
huxing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 9bf51e5 Improve license check script (#4196)
9bf51e5 is described below
commit 9bf51e5ec1c41a7febfad3fc28579237e849be9d
Author: Huxing Zhang <hu...@gmail.com>
AuthorDate: Sun Aug 4 10:39:50 2019 +0800
Improve license check script (#4196)
---
.gitignore | 2 +-
licenseCheck.sh | 24 ++++++++++++++++++------
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/.gitignore b/.gitignore
index 8989935..1614fdc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,4 +34,4 @@ Thumbs.db
.flattened-pom.xml
# license check result
-license-list.txt
\ No newline at end of file
+license-list
diff --git a/licenseCheck.sh b/licenseCheck.sh
index 9992f10..a2d3565 100755
--- a/licenseCheck.sh
+++ b/licenseCheck.sh
@@ -3,7 +3,7 @@
APPEND_ARG=""
FOLDER="./"
LINE_FLAG="=============================================="
-TARGET_FILE="./license-list.txt"
+TARGET_FILE="./license-list"
red=`tput setaf 1`
green=`tput setaf 2`
@@ -57,9 +57,13 @@ missingLicense=(
for i in "${missingLicense[@]}"; do
search=`echo $i |awk -F: '{print $1}'`
replace=`echo $i |awk -F: '{print $2}'`
- sed -i -e 's/'"$search"'/'"$replace"'/g' $TARGET_FILE
+ sed -i.bak 's/'"$search"'/'"$replace"'/g' $TARGET_FILE
done
+if [ -f $TARGET_FILE.bak ]; then
+ rm -rf $TARGET_FILE.bak
+fi
+
check_unknown_license=`cat $TARGET_FILE | grep "Unknown license"`
#checking unknown license
@@ -78,6 +82,12 @@ allowLicense=(
"MIT"
"The 3-Clause BSD License"
"Public domain"
+ "JSR.*107"
+ "Common Public License Version 1.0"
+ "org.scijava:native-lib-loader"
+ "org.codehaus.woodstox:stax2-api"
+ "wsdl4j:wsdl4j"
+ "net.jcip:jcip-annotations"
)
#filter allow license
@@ -87,10 +97,12 @@ for i in "${allowLicense[@]}"; do
license_need_check=`echo "$license_need_check"|grep -vi "$i"`
done
-if test -z "$license_need_check"
-then
+# remove empty lines
+echo $license_need_check | sed '/^[[:space:]]*$/d' > license-need-check
+
+if [ ! -s license-need-check ]; then
echo "${green}All dependencies license looks good${reset}"
else
echo "${red}Please check below license${reset}"
- echo "$license_need_check"
-fi
\ No newline at end of file
+ cat license-need-check
+fi