blob: bb508d7f04d4e7f6686c1f55e861442b9100b7d6 [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$|\
Martin Rothda1a70e2016-01-12 15:32:50 -070026\.hex$|\
27\.patch$|\
28_shipped$|\
29^util/scripts/no-fsf-addresses.sh|\
30^util/lint/lint-000-license-headers|\
Martin Roth95b5b022022-10-17 07:53:16 -060031^util/lint/lint-stable-009-old-licenses|\
32^util/nvidia/cbootimage|\
33^3rdparty|\
34__pycache__|\
35^payloads/external\
Martin Rothda1a70e2016-01-12 15:32:50 -070036"
37
Martin Roth69667592016-01-19 21:03:04 -070038if [ -z "$HEADER_DIRS" ]; then
Jan Dabrosffa58cf2020-07-16 13:38:01 +020039 HEADER_DIRS="src util tests"
Martin Rothda1a70e2016-01-12 15:32:50 -070040fi
41
Felix Singer74b4bd02023-04-01 14:42:54 +020042headerlist=$(${FIND_FILES} $HEADER_DIRS | grep -E -v "($HEADER_EXCLUDED)")
Martin Rothda1a70e2016-01-12 15:32:50 -070043
44#check for the old style header
45headerlist=$(grep -il "You should have received a copy of the GNU" \
Martin Roth69667592016-01-19 21:03:04 -070046 $headerlist 2>/dev/null)
Martin Rothda1a70e2016-01-12 15:32:50 -070047
48for file in $headerlist; do
49 echo "$file has the old GPL header."
50done