aboutsummaryrefslogtreecommitdiff
path: root/util/lint
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2016-01-21 13:20:39 -0700
committerMartin Roth <martinroth@google.com>2016-02-02 03:24:57 +0100
commitf8db028a32bf3aae2eb2783802c643a03287d412 (patch)
tree797791fdf87817b9def03b75dc771b686d45d908 /util/lint
parent50943b15a35020b5f411e380c413abe337ab2b69 (diff)
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>
Diffstat (limited to 'util/lint')
-rwxr-xr-xutil/lint/lint-000-license-headers20
1 files changed, 18 insertions, 2 deletions
diff --git a/util/lint/lint-000-license-headers b/util/lint/lint-000-license-headers
index ad764b8e9b..884875ec29 100755
--- a/util/lint/lint-000-license-headers
+++ b/util/lint/lint-000-license-headers
@@ -58,11 +58,27 @@ headerlist=$(git ls-files $HEADER_DIRS | egrep -v "($HEADER_EXCLUDED)")
#update headerlist by removing files that match the license string
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
-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 "IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE"
check_for_license '"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES'