Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/80585?usp=email )
Change subject: util: Break up spdx identifier text in scripts & makefiles ......................................................................
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 --- M util/cbfstool/Makefile M util/chromeos/update_ec_headers.sh M util/lint/lint-000-license-headers 3 files changed, 25 insertions(+), 21 deletions(-)
Approvals: build bot (Jenkins): Verified Matt DeVillier: Looks good to me, approved Varshit Pandya: Looks good to me, approved
diff --git a/util/cbfstool/Makefile b/util/cbfstool/Makefile index 8dde77b..5a33598 100644 --- a/util/cbfstool/Makefile +++ b/util/cbfstool/Makefile @@ -13,6 +13,7 @@
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 @@ $(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 c3ee13e..23b6418 100755 --- a/util/chromeos/update_ec_headers.sh +++ b/util/chromeos/update_ec_headers.sh @@ -12,6 +12,7 @@ scratch_file='' coreboot_top='' pname='' +SPDX_ID_STRING="SPDX-License-Identifier"
cleanup() { @@ -41,7 +42,7 @@
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 f418a32..44657d2 100755 --- a/util/lint/lint-000-license-headers +++ b/util/lint/lint-000-license-headers @@ -84,13 +84,15 @@ #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 @@ }
#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