Skip to content

Commit

Permalink
dist/licenses: add and use --error-exitcode
Browse files Browse the repository at this point in the history
  • Loading branch information
LudwigKnuepfer committed Nov 24, 2014
1 parent 1574c2b commit d716f2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ script:
- make -s -C ./examples/default info-concurrency
- git rebase riot/master || git rebase --abort

- ./dist/tools/licenses/check.sh master --diff-filter=MR
- ./dist/tools/licenses/check.sh master --diff-filter=MR --error-exitcode=0 || exit
- ./dist/tools/licenses/check.sh master --diff-filter=AC || exit

# TODO:
Expand Down
10 changes: 9 additions & 1 deletion dist/tools/licenses/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ TMP="${CHECKROOT}/.tmp"
ROOT=$(git rev-parse --show-toplevel)
LICENSES=$(ls "${LICENSEDIR}")
EXIT_CODE=0
ERROR_EXIT_CODE="1"

# reset output dir
rm -fr "${OUTPUT}"
Expand Down Expand Up @@ -39,6 +40,13 @@ else
DIFFFILTER="--diff-filter=ACMR"
fi

# If the --error-exitcode option is given, consume this parameter
# and overwrite the default ERROR_EXIT_CODE.
if echo "${1}" | grep -q '^--error-exitcode='; then
ERROR_EXIT_CODE=$(echo ${1} | sed -e 's/--error-exitcode=//')
shift 1
fi

# select files to check
if [ -z "${BRANCH}" ]; then
FILES="$(git ls-tree -r --full-tree --name-only HEAD | grep -E '\.([sSch]|cpp)$')"
Expand All @@ -60,7 +68,7 @@ for FILE in ${FILES}; do
if [ ${FAIL} = 1 ]; then
echo "${FILE}" >> "${UNKNOWN}"
echo "file has an unknown license header: '${FILE}'"
EXIT_CODE=1
EXIT_CODE=${ERROR_EXIT_CODE}
fi
done

Expand Down

0 comments on commit d716f2d

Please sign in to comment.