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/03/06 02:57:27 UTC
[incubator-dubbo-ops] branch develop updated: Add script to check
the bin distribution
This is an automated email from the ASF dual-hosted git repository.
huxing pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-ops.git
The following commit(s) were added to refs/heads/develop by this push:
new ee3f5e4 Add script to check the bin distribution
ee3f5e4 is described below
commit ee3f5e42ac3e05dfd4619d3ce633eb6fdb2e6af0
Author: Huxing Zhang <hu...@gmail.com>
AuthorDate: Wed Mar 6 10:53:18 2019 +0800
Add script to check the bin distribution
---
.../src/assembly/source-release.xml | 1 +
.../src/bin-distribution-check.sh | 61 ++++++++++++++++++++++
2 files changed, 62 insertions(+)
diff --git a/dubbo-admin-distribution/src/assembly/source-release.xml b/dubbo-admin-distribution/src/assembly/source-release.xml
index 1b67d40..9c83c74 100644
--- a/dubbo-admin-distribution/src/assembly/source-release.xml
+++ b/dubbo-admin-distribution/src/assembly/source-release.xml
@@ -62,6 +62,7 @@
<exclude>dubbo-admin-distribution/src/LICENSE</exclude>
<exclude>dubbo-admin-distribution/src/NOTICE</exclude>
<exclude>dubbo-admin-distribution/src/licenses/**</exclude>
+ <exclude>dubbo-admin-distribution/src/bin-distribution-check.sh</exclude>
</excludes>
</fileSet>
</fileSets>
diff --git a/dubbo-admin-distribution/src/bin-distribution-check.sh b/dubbo-admin-distribution/src/bin-distribution-check.sh
new file mode 100644
index 0000000..40b1b55
--- /dev/null
+++ b/dubbo-admin-distribution/src/bin-distribution-check.sh
@@ -0,0 +1,61 @@
+#!bin/sh
+
+# HOW TO RUN THIS SCRIPT
+# 1. unzip the bin-release file.
+# 2. place this script under your unzipped bin-release directory.
+# 3. if you want to check the javascript dependencies,
+# copy the package.json file to the directory.
+# 4. run this script.
+
+# Step 1: check all the dependendcies list in LICENSE are acutally bundled.
+
+echo "Step 1: check all the dependendcies list in LICENSE are acutally bundled"
+echo "================"
+
+files=($(grep jar LICENSE | awk -F ' ' '{ print $2 }'))
+
+for i in "${files[@]}"; do
+ file=$(echo $i | tr -d '\r')
+ if [ ! -f "BOOT-INF/lib/$file" ]; then
+ echo "jar file $file is listed in LICENSE but not found in BOOT-INF/lib."
+ fi
+done
+
+echo "\n"
+
+# Step 2: check all the jar files under BOOT-INF/lib are listed in LICENSE.
+echo "Step 2: check all the jar files under BOOT-INF/lib are listed in LICENSE."
+echo "================"
+
+for i in BOOT-INF/lib/*.jar; do
+ jar=$(echo $i | awk -F '/' '{print $3}')
+ if [ $(grep -c $jar LICENSE) -eq 0 ]; then
+ echo "Found $i but not listed in LICENSE"
+ fi
+done
+
+echo "\n"
+
+# Step 3: if a project is Apache Licensed and has NOTICE, it should be listed in NOTICE
+echo "Step 3: if a project is Apache Licensed and has NOTICE, it should be listed in NOTICE"
+echo "================="
+
+licenses=($(echo $(grep "Apache 2.0" LICENSE | awk -F ' ' '{if ($0 ~ /^.*\*/) printf "%s,%s\\n",$3,$5}')))
+for i in "${licenses[@]}"; do
+ name=$(echo $i | awk -F ',' '{print $1}')
+ # echo "checking $name..."
+ license=$(echo $i | awk -F ',' '{print $2}' | awk '{if (toupper($0) ~ /.*LICENSE.*/) print $0}')
+ # remove the trailing LICENSE.txt
+ notice="${license%/*}/NOTICE"
+ noticeTxt="$notice.txt"
+ if [ $(curl --write-out %{http_code} --head --output /dev/null -s $notice | grep -c 200) -ne 0 ] \
+ || [ $(curl --write-out %{http_code} --head --output /dev/null -s $noticeTxt | grep -c 200) -ne 0 ]; then
+ # echo "found Notice file, checking it is listed in NOTICE"
+ if [ $(grep -c $name NOTICE) -eq 0 ]; then
+ echo "$name should be added to NOTICE"
+ fi
+ fi
+done
+
+# Step 4: check javascript dependencies, ensure they are listed in LICENSE.
+# TODO