Skip to content

Commit

Permalink
[CE-241] Test build error of license check
Browse files Browse the repository at this point in the history
Change-Id: Ib8110c4db8446346a296aa1cc4a4cd0e1be0df92
Signed-off-by: sally <lujjiang@cn.ibm.com>
  • Loading branch information
lujjiang committed Jan 18, 2018
1 parent ab76cd0 commit c3d84da
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/check_license.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@
# SPDX-License-Identifier: Apache-2.0
#

CHECK=$(git diff --name-only HEAD * | grep -v .json$ | grep -v .jpg$ | grep -v .JPG$ | grep -v .png$ | grep -v .ico$ \
CHECK=$(git diff --name-only HEAD * | grep -v check_license.sh | grep -v .json$ | grep -v .jpg$ | grep -v .JPG$ | grep -v .png$ | grep -v .ico$ \
| grep -v .graffle$ | grep -v .svg$ | grep -v .pug$ | grep -v .rst$ | grep -v .git \
| grep -v .pem$ | grep -v .crt$ | grep -v .key$ | grep -v lib/ | grep -v fonts/ | grep -v .min.css$ \
| grep -v .block$ | grep -v .less$ | grep -v crypto-config/ | grep -v .min.js$ \
| grep -v .md$ | grep -v ^vendor/ | grep -v ^build/ | grep -v .pb.go$ | grep -v .txt | grep -v .env | sort -u)

if [[ -z "$CHECK" ]]; then
CHECK=$(git diff-tree --no-commit-id --name-only -r $(git log -2 \
--pretty=format:"%h") | grep -v .json$ | grep -v .jpg$ | grep -v .JPG$ | grep -v .png$ | grep -v .ico$ \
--pretty=format:"%h") | grep -v check_license.sh | grep -v .json$ | grep -v .jpg$ | grep -v .JPG$ | grep -v .png$ | grep -v .ico$ \
| grep -v .graffle$ | grep -v .svg$ | grep -v .pug$ | grep -v .rst$ | grep -v .git \
| grep -v .pem$ | grep -v .crt$ | grep -v .key$ | grep -v lib/ | grep -v fonts/ | grep -v .min.css$ \
| grep -v .block$ | grep -v .less$ | grep -v crypto-config/ | grep -v .min.js$ \
| grep -v .md$ | grep -v ^vendor/ | grep -v ^build/ | grep -v .pb.go$ | grep -v .txt | grep -v .env | sort -u)
fi

echo "Checking committed files for SPDX-License-Identifier headers ..."
if [ -z "$CHECK" ]; then
echo "All files have SPDX-License-Identifier headers"
exit 0
fi
missing=`echo $CHECK | xargs grep -L "SPDX-License-Identifier"`
if [ -z "$missing" ]; then
echo "All files have SPDX-License-Identifier headers"
Expand Down

0 comments on commit c3d84da

Please sign in to comment.