2017-05-23 18:06:26 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Copyright 2017 Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
#
|
|
|
|
# This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
# General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
# directory for more details.
|
|
|
|
|
2018-06-05 17:06:11 +02:00
|
|
|
: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
|
|
|
|
cd $RIOTBASE
|
|
|
|
|
|
|
|
: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
|
2018-03-22 17:21:09 +01:00
|
|
|
. "${RIOTTOOLS}"/ci/changed_files.sh
|
2017-05-23 18:06:26 +02:00
|
|
|
|
|
|
|
EXIT_CODE=0
|
|
|
|
|
|
|
|
filter() {
|
|
|
|
if [ $QUIET -eq 0 ]; then
|
|
|
|
cat
|
|
|
|
else
|
|
|
|
grep '^---' | cut -f 2 -d ' '
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_headercheck() {
|
2021-01-09 19:13:02 +01:00
|
|
|
OUT=$(${RIOTTOOLS}/headerguards/headerguards.py ${FILES} 2>&1 | filter)
|
2017-05-23 18:06:26 +02:00
|
|
|
if [ -n "$OUT" ]; then
|
|
|
|
EXIT_CODE=1
|
|
|
|
echo "$OUT"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
: ${FILES:=$(FILEREGEX='\.h$' changed_files)}
|
|
|
|
|
|
|
|
if [ -z "${FILES}" ]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
: ${QUIET:=0}
|
|
|
|
|
|
|
|
if [ -z "$*" ]; then
|
|
|
|
_headercheck
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit $EXIT_CODE
|