aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2024-02-16 10:19:07 -0700
committerFelix Held <felix-coreboot@felixheld.de>2024-06-19 17:42:43 +0000
commit1eccf77a78c49e1026ccbaca03cdb1f04f424368 (patch)
treeb4f34b73e43126a7370f785c21e789d8d8fa93a7 /util
parent3fc7a8f507046e9d52d0329b3f367374737d379a (diff)
util: Break up spdx identifier text in scripts & makefiles
The SPDX parsers can find the SPDX identifiers in the scripts and makefiles if they aren't broken up. This unnecessarily confuses things when we're doing license parsing. Change-Id: I215ed047397f342c912f1a969315fa184a124f6a Signed-off-by: Martin Roth <gaumless@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80585 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Reviewed-by: Varshit Pandya <pandyavarshit@gmail.com>
Diffstat (limited to 'util')
-rw-r--r--util/cbfstool/Makefile3
-rwxr-xr-xutil/chromeos/update_ec_headers.sh3
-rwxr-xr-xutil/lint/lint-000-license-headers40
3 files changed, 25 insertions, 21 deletions
diff --git a/util/cbfstool/Makefile b/util/cbfstool/Makefile
index 8dde77ba52..5a33598c84 100644
--- a/util/cbfstool/Makefile
+++ b/util/cbfstool/Makefile
@@ -13,6 +13,7 @@ override objutil := ..
VBOOT_SOURCE ?= $(top)/3rdparty/vboot
VBOOT_HOST_BUILD ?= $(abspath $(objutil)/vboot_lib)
+SPDX_ID_STRING := SPDX-License-Identifier
.PHONY: all
all: cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool elogtool cse_fpt cse_serger
@@ -54,7 +55,7 @@ linux_trampoline.c: linux_trampoline.S
$(CC) -m32 -o linux_trampoline linux_trampoline.S -ffreestanding -nostdlib -nostdinc -Wl,--defsym=_start=0
$(OBJCOPY) -Obinary -j .data linux_trampoline trampoline
echo "/* This file is automatically generated. Do not manually change */" > trampoline.c
- echo "/* SPDX-License-Identifier: GPL-2.0-only */" >> trampoline.c
+ echo "/* $(SPDX_ID_STRING): GPL-2.0-only */" >> trampoline.c
xxd -c 16 -i trampoline >> trampoline.c
mv trampoline.c linux_trampoline.c
rm linux_trampoline trampoline
diff --git a/util/chromeos/update_ec_headers.sh b/util/chromeos/update_ec_headers.sh
index c3ee13e5f7..23b6418983 100755
--- a/util/chromeos/update_ec_headers.sh
+++ b/util/chromeos/update_ec_headers.sh
@@ -12,6 +12,7 @@ set -u
scratch_file=''
coreboot_top=''
pname=''
+SPDX_ID_STRING="SPDX-License-Identifier"
cleanup()
{
@@ -41,7 +42,7 @@ usage()
update_copyright()
{
- local spdx='/* SPDX-License-Identifier: BSD-3-Clause */'
+ local spdx="/* ${SPDX_ID_STRING}: BSD-3-Clause */"
local f=$1
# replace existing copyright with empty lines
diff --git a/util/lint/lint-000-license-headers b/util/lint/lint-000-license-headers
index f418a326ac..44657d27c9 100755
--- a/util/lint/lint-000-license-headers
+++ b/util/lint/lint-000-license-headers
@@ -84,13 +84,15 @@ fi
#make a copy to check for the old style header later.
headerlist=$(${FIND_FILES} $HEADER_DIRS | grep -E -v "($HEADER_EXCLUDED)")
+LICENSE_ID_STRING="SPDX-License-Identifier"
+
#update headerlist by removing files that match the license string
check_for_license() {
if [ -n "$headerlist" ] && [ -z "$2" ]; then
- headerlist="$(grep -iL "$1" $headerlist 2>/dev/null)"
+ headerlist="$(grep -iL "${LICENSE_ID_STRING}: $1" $headerlist 2>/dev/null)"
elif [ -n "$headerlist" ]; then
- p1list="$(grep -il "$1" $headerlist 2>/dev/null)"
- p2list="$(grep -il "$2" $headerlist 2>/dev/null)"
+ p1list="$(grep -il "${LICENSE_ID_STRING}: $1" $headerlist 2>/dev/null)"
+ p2list="$(grep -il "${LICENSE_ID_STRING}: $2" $headerlist 2>/dev/null)"
# Make list of files that were in both previous lists
pbothlist="$(echo $p1list $p2list | tr ' ' "\n" | \
@@ -105,33 +107,33 @@ check_for_license() {
}
#search the files for license headers
-check_for_license 'SPDX-License-Identifier: Apache-2.0'
-check_for_license 'SPDX-License-Identifier: BSD-2-Clause'
-check_for_license 'SPDX-License-Identifier: BSD-3-Clause'
-check_for_license 'SPDX-License-Identifier: GPL-2.0-only'
-check_for_license 'SPDX-License-Identifier: GPL-2.0-or-later'
-check_for_license 'SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note'
-check_for_license 'SPDX-License-Identifier: GPL-3.0-only'
-check_for_license 'SPDX-License-Identifier: GPL-3.0-only WITH GCC-exception-3.1'
-check_for_license 'SPDX-License-Identifier: GPL-3.0-or-later'
-check_for_license 'SPDX-License-Identifier: HPND'
-check_for_license 'SPDX-License-Identifier: HPND-sell-variant'
-check_for_license 'SPDX-License-Identifier: ISC'
-check_for_license 'SPDX-License-Identifier: MIT'
-check_for_license 'SPDX-License-Identifier: X11'
+check_for_license 'Apache-2.0'
+check_for_license 'BSD-2-Clause'
+check_for_license 'BSD-3-Clause'
+check_for_license 'GPL-2.0-only'
+check_for_license 'GPL-2.0-or-later'
+check_for_license 'GPL-2.0-only WITH Linux-syscall-note'
+check_for_license 'GPL-3.0-only'
+check_for_license 'GPL-3.0-only WITH GCC-exception-3.1'
+check_for_license 'GPL-3.0-or-later'
+check_for_license 'HPND'
+check_for_license 'HPND-sell-variant'
+check_for_license 'ISC'
+check_for_license 'MIT'
+check_for_license 'X11'
# This is 4 clause ("with advertising") but the University of Berkeley
# declared that 4th clause void, see
# ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
# With this, BSD-4-Clause-UC becomes GPLv2 compatible, and so SPDX doesn't
# differentiate between this license with or without advertising.
-check_for_license 'SPDX-License-Identifier: BSD-4-Clause-UC'
+check_for_license 'BSD-4-Clause-UC'
# This is the Creative Commons Public Domain Dedication and Certification
# for files that are already in the public domain. This includes files
# that cannot be licensed such as blank files or files with no "creative"
# content.
-check_for_license 'SPDX-License-Identifier: CC-PDDC'
+check_for_license 'CC-PDDC'
for file in $headerlist; do
# Verify the file actually exists