util/lint: update lint-000-license-headers

- Add some additional filters for files that do not require
license headers.
- Add an alternative wording for the BSD license that is used
in several files.
- Add string for dummy files
- Stop checking if there are no files left.
- Remove 'local' keyword which is not posix compliant.

Change-Id: I2ed1b0572b5fbe84ea86173b7ec2106454399547
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/14324
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2016-04-11 13:35:59 -06:00
parent e69d6c2e7b
commit 84129b8c68
1 changed files with 15 additions and 6 deletions

View File

@ -40,7 +40,14 @@ EXAMPLE|\
_shipped$|\
/microcode-[^/]*.h$|\
/sdram-.*\.inc$|\
Makefile\.inc\
Makefile\.inc|\
\.fmd|\
devicetree.cb|\
\.cfg$|\
\.spd|\
config|\
cmos\.layout|\
cmos\.default\
"
#space separated list of directories to test
@ -58,14 +65,14 @@ headerlist=$(git ls-files $HEADER_DIRS | egrep -v "($HEADER_EXCLUDED)")
#update headerlist by removing files that match the license string
check_for_license() {
if [ -z "$2" ]; then
if [ -n "$headerlist" ] && [ -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)"
elif [ -n "$headerlist" ]; then
p1list="$(grep -il "$1" $headerlist 2>/dev/null)"
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" | \
pbothlist="$(echo $p1list $p2list | tr ' ' "\n" | \
sort | uniq -d)"
# Remove all files that were in both of the previous lists
@ -80,8 +87,10 @@ check_for_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 DISTRIBUTED .*"AS IS"'
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 'No license required'
for file in $headerlist; do
#verify the file exists, and has content that requires a header