1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #2279 from Farthen/pr@licensecheck-bsd

dist/tools/licenses: support BSD sed
This commit is contained in:
Ludwig Ortmann 2015-01-12 09:19:57 +01:00
commit d8d3e7e4e5

View File

@ -13,6 +13,9 @@ OUTPUT="${CHECKROOT}/out"
UNKNOWN="${OUTPUT}/unknown" UNKNOWN="${OUTPUT}/unknown"
TMP="${CHECKROOT}/.tmp" TMP="${CHECKROOT}/.tmp"
# Needed for compatibility with BSD sed
TAB_CHAR="$(printf '\t')"
# prepare # prepare
ROOT=$(git rev-parse --show-toplevel) ROOT=$(git rev-parse --show-toplevel)
LICENSES=$(ls "${LICENSEDIR}") LICENSES=$(ls "${LICENSEDIR}")
@ -63,7 +66,7 @@ fi
# categorize files # categorize files
for FILE in ${FILES}; do for FILE in ${FILES}; do
FAIL=1 FAIL=1
head -100 "${ROOT}/${FILE}" | sed -e 's/[\/\*\t]/ /g' -e 's/$/ /' | tr -d '\r\n' | sed -e 's/ */ /g' > "${TMP}" head -100 "${ROOT}/${FILE}" | sed -e 's/[\/\*'"${TAB_CHAR}"']/ /g' -e 's/$/ /' | tr -d '\r\n' | sed -e 's/ */ /g' > "${TMP}"
for LICENSE in ${LICENSES}; do for LICENSE in ${LICENSES}; do
if pcregrep -q -f "${LICENSEDIR}/${LICENSE}" "${TMP}"; then if pcregrep -q -f "${LICENSEDIR}/${LICENSE}" "${TMP}"; then
echo "${FILE}" >> "${OUTPUT}/${LICENSE}" echo "${FILE}" >> "${OUTPUT}/${LICENSE}"