blob: 45c01c73a6e3523c15443caf5ca9c832db6da2cf [file] [log] [blame]
Martin Roth0ad5fbd2020-12-24 12:06:38 -07001#!/usr/bin/env sh
Martin Rothda1a70e2016-01-12 15:32:50 -07002#
Patrick Georgi7333a112020-05-08 20:48:04 +02003# SPDX-License-Identifier: GPL-2.0-only
4
Angel Pons04bf41b2020-10-13 01:07:27 +02005# DESCR: Verify that files don't have the old style header
Martin Rothda1a70e2016-01-12 15:32:50 -07006
7# regex list of files and directories to exclude from the search
Martin Rothd81debd2022-06-03 00:06:57 -06008
9LINTDIR="$(
10 cd -- "$(dirname "$0")" > /dev/null 2>&1 || return
11 pwd -P
12)"
13
14# shellcheck source=helper_functions.sh
15. "${LINTDIR}/helper_functions.sh"
16
Martin Rothda1a70e2016-01-12 15:32:50 -070017HEADER_EXCLUDED="\
Nico Huberbe5492a2015-09-29 16:41:19 +020018^src/lib/gnat/|\
Martin Rothda1a70e2016-01-12 15:32:50 -070019^src/vendorcode/|\
20^util/kconfig/|\
21\<COPYING\>|\
22\.jpg$|\
23\.cksum$|\
24\.bin$|\
Martin Rothdea13332018-05-04 09:19:07 -060025\.vbt$|\
Matt DeVillier024c5c92023-12-15 15:44:23 -060026\.apcb$|\
Martin Rothda1a70e2016-01-12 15:32:50 -070027\.hex$|\
28\.patch$|\
29_shipped$|\
30^util/scripts/no-fsf-addresses.sh|\
31^util/lint/lint-000-license-headers|\
Martin Roth95b5b022022-10-17 07:53:16 -060032^util/lint/lint-stable-009-old-licenses|\
33^util/nvidia/cbootimage|\
34^3rdparty|\
35__pycache__|\
36^payloads/external\
Martin Rothda1a70e2016-01-12 15:32:50 -070037"
38
Martin Roth69667592016-01-19 21:03:04 -070039if [ -z "$HEADER_DIRS" ]; then
Jan Dabrosffa58cf2020-07-16 13:38:01 +020040 HEADER_DIRS="src util tests"
Martin Rothda1a70e2016-01-12 15:32:50 -070041fi
42
Felix Singer74b4bd02023-04-01 14:42:54 +020043headerlist=$(${FIND_FILES} $HEADER_DIRS | grep -E -v "($HEADER_EXCLUDED)")
Martin Rothda1a70e2016-01-12 15:32:50 -070044
45#check for the old style header
46headerlist=$(grep -il "You should have received a copy of the GNU" \
Martin Roth69667592016-01-19 21:03:04 -070047 $headerlist 2>/dev/null)
Martin Rothda1a70e2016-01-12 15:32:50 -070048
49for file in $headerlist; do
50 echo "$file has the old GPL header."
51done