@@ -71,23 +71,38 @@ matrix:
71
71
# scancode does not support list of files, only one file or directory
72
72
# we use SCANCODE directory for all changed files (their copies with full tree)
73
73
- >-
74
- git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \
74
+ git diff --name-only --diff-filter=ad FETCH_HEAD..HEAD \
75
75
| ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) \
76
76
| ( grep -v '^tools/test/toolchains/api_test.py' || true ) \
77
77
| while read file; do cp --parents "${file}" SCANCODE; done
78
78
- scancode -l --json-pp scancode.json SCANCODE
79
79
- python ./tools/test/travis-ci/scancode-evaluate.py -f scancode.json || true
80
+ # run the same but for new files. All new files must have SPDX
81
+ - >-
82
+ git diff --name-only --diff-filter=A FETCH_HEAD..HEAD \
83
+ | ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) \
84
+ | ( grep -v '^tools/test/toolchains/api_test.py' || true ) \
85
+ | while read file; do cp --parents "${file}" SCANCODE_NEW_FILES; done
86
+ - scancode -l --json-pp scancode_new_files.json SCANCODE_NEW_FILES
87
+ - python ./tools/test/travis-ci/scancode-evaluate.py -f scancode_new_files.json || true
80
88
after_success :
81
89
- python ./tools/test/travis-ci/scancode-evaluate.py -f scancode.json
82
90
- cat scancode-evaluate.log
83
91
- COUNT=$(cat scancode-evaluate.log | grep 'File:' | wc -l)
92
+ - python ./tools/test/travis-ci/scancode-evaluate.py -f scancode_new_files.json
93
+ - cat scancode-evaluate.log
94
+ - COUNT_NEW_FILES=$(cat scancode-evaluate.log | grep 'File:' | wc -l)
84
95
- |
85
- if [ $COUNT == 0 ]; then
96
+ if [ $COUNT == 0 && $COUNT_NEW_FILES == 0 ]; then
86
97
echo "License check OK";
87
98
STATUSM="All licenses OK";
88
99
set_status "success" "$STATUSM";
100
+ elif [ $COUNT_NEW_FILES != 0 ]; then
101
+ echo "License check failed, new files with the license issues found";
102
+ STATUSM="Needs review, ${COUNT} license issues found";
103
+ set_status "failure" "$STATUSM";
89
104
else
90
- echo "License check failed, please review license issues found";
105
+ echo "License check failed, please review license issues found in modified files ";
91
106
STATUSM="Needs review, ${COUNT} license issues found";
92
107
set_status "success" "$STATUSM";
93
108
fi
0 commit comments