From f8db028a32bf3aae2eb2783802c643a03287d412 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Thu, 21 Jan 2016 13:20:39 -0700 Subject: 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 Reviewed-on: https://review.coreboot.org/13119 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- util/lint/lint-000-license-headers | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'util/lint') 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' -- cgit v1.2.3