lint: Check license headers for both paragraphs of the GPL

If the GPLv2 or GPLv2+ license header is being used on a
coreboot file, make sure it has two paragraphs as specified by
the Common License Header section in the developer guidelines
in the coreboot wiki.

Change-Id: Ifffa0fa7272f5a4b129d4b7b8a515f8795bc2401
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/13119
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Martin Roth 2016-01-21 13:20:39 -07:00
parent 50943b15a3
commit f8db028a32
1 changed files with 18 additions and 2 deletions

View File

@ -58,11 +58,27 @@ headerlist=$(git ls-files $HEADER_DIRS | egrep -v "($HEADER_EXCLUDED)")
#update headerlist by removing files that match the license string #update headerlist by removing files that match the license string
check_for_license() { check_for_license() {
headerlist=$(grep -iL "$1" $headerlist 2>/dev/null) if [ -z "$2" ]; then
headerlist="$(grep -iL "$1" $headerlist 2>/dev/null)"
else
local p1list="$(grep -il "$1" $headerlist 2>/dev/null)"
local p2list="$(grep -il "$2" $headerlist 2>/dev/null)"
# Make list of files that were in both previous lists
local pbothlist="$(echo $p1list $p2list | tr ' ' "\n" | \
sort | uniq -d)"
# Remove all files that were in both of the previous lists
# Note that this is unstable if we ever get any filenames
# with spaces.
headerlist="$(echo $headerlist $pbothlist | tr ' ' "\n" | \
sort | uniq -u)"
fi
} }
#search the files for license headers #search the files for license headers
check_for_license "GNU General Public License" check_for_license "under the terms of the GNU General Public License" \
"WITHOUT ANY WARRANTY"
check_for_license 'IS PROVIDED .*"AS IS"' check_for_license 'IS PROVIDED .*"AS IS"'
check_for_license "IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE" check_for_license "IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE"
check_for_license '"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES' check_for_license '"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES'