From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 16FBF45E68; Tue, 10 Dec 2024 10:11:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0307D40264; Tue, 10 Dec 2024 10:11:02 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id A787E4025A for ; Tue, 10 Dec 2024 10:11:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733821860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zSfs3bQ6fGYX51Tdd3+ieZAYKnSMPCMgD9S4eDZYAaI=; b=JCmabXlzbqJcY8POT8H7AJkzYAyhuLu3vegZACuykus+fn+zerZ9iKwyTUj7CXq4XDBmwb ZX3UWxWaqNe8ei2vf0W1MFHVS3/JwQCTaVcIzM3Qn1V+dpFbrHozibSaSrg0yoV/9ou1mV pdJm1KHkKUy13WNiH523M2/3P5qcxAg= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-457-gGk_XR9NNeukNA3Tc7NMig-1; Tue, 10 Dec 2024 04:10:56 -0500 X-MC-Unique: gGk_XR9NNeukNA3Tc7NMig-1 X-Mimecast-MFC-AGG-ID: gGk_XR9NNeukNA3Tc7NMig Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A6A6319560B6; Tue, 10 Dec 2024 09:10:55 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.225.129]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 10F88195605A; Tue, 10 Dec 2024 09:10:53 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, techboard@dpdk.org Subject: [PATCH] devtools: enhance the license check Date: Tue, 10 Dec 2024 10:10:39 +0100 Message-ID: <20241210091039.3439504-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ibCADcjlGJF5wDFRPD4R83eux5kFKAEgS3LKUuIZ1j8_1733821856 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Reformat the license/exceptions.txt file to make it easier to build a list of exempted files. Display all files committed in DPDK that are non compliant with BSD-3 license. Signed-off-by: David Marchand --- devtools/check-spdx-tag.sh | 59 +++++++++++++++++++++++++++----------- license/exceptions.txt | 11 ++++--- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/devtools/check-spdx-tag.sh b/devtools/check-spdx-tag.sh index b983268b1e..f893003af6 100755 --- a/devtools/check-spdx-tag.sh +++ b/devtools/check-spdx-tag.sh @@ -4,7 +4,8 @@ # # Produce a list of files with incorrect license tags -errors=0 +missing_spdx=0 +wrong_license=0 warnings=0 quiet=false verbose=false @@ -14,23 +15,44 @@ print_usage () { exit 1 } +no_license_list=\ +':^.git* :^.mailmap :^.ci/* :^README :^MAINTAINERS :^VERSION :^ABI_VERSION :^*/Kbuild '\ +':^*/README* :^license/ :^config/ :^buildtools/ :^*/poetry.lock '\ +':^kernel/linux/uapi/.gitignore :^kernel/linux/uapi/version :^*.cocci :^*.abignore '\ +':^*.map :^*.ini :^*.data :^*.json :^*.cfg :^*.txt :^*.svg :^*.png' + check_spdx() { - if $verbose; then + if $verbose ; then echo "Files without SPDX License" echo "--------------------------" fi - git grep -L SPDX-License-Identifier -- \ - ':^.git*' ':^.mailmap' ':^.ci/*' \ - ':^README' ':^MAINTAINERS' ':^VERSION' ':^ABI_VERSION' \ - ':^*/Kbuild' ':^*/README*' \ - ':^license/' ':^config/' ':^buildtools/' ':^*/poetry.lock' \ - ':^kernel/linux/uapi/.gitignore' ':^kernel/linux/uapi/version' \ - ':^*.cocci' ':^*.abignore' \ - ':^*.map' ':^*.ini' ':^*.data' ':^*.json' ':^*.cfg' ':^*.txt' \ - ':^*.svg' ':^*.png' \ - > $tmpfile - - errors=$(wc -l < $tmpfile) + git grep -L SPDX-License-Identifier -- $no_license_list > $tmpfile + + missing_spdx=$(wc -l < $tmpfile) + $quiet || cat $tmpfile +} + +build_exceptions_list() { + grep '.*|.*|.*|.*' license/exceptions.txt | grep -v 'TB Approval Date' | + while IFS='|' read license tb_date gb_date pattern ; do + unset IFS + license=${license## *} + license=${license%% *} + git grep -l "SPDX-License-Identifier:[[:space:]]*$license" $pattern | + sed -e 's/^/:^/' + done +} + +check_licenses() { + if $verbose ; then + echo "Files with wrong license and no exception" + echo "-----------------------------------------" + fi + exceptions=$(build_exceptions_list) + git grep -l SPDX-License-Identifier: -- $no_license_list $exceptions | + xargs grep -L -E 'SPDX-License-Identifier:[[:space:]]*\(?BSD-3-Clause' > $tmpfile + + wrong_license=$(wc -l < $tmpfile) $quiet || cat $tmpfile } @@ -64,8 +86,11 @@ trap 'rm -f -- "$tmpfile"' INT TERM HUP EXIT check_spdx $quiet || echo -check_boilerplate +check_licenses +$quiet || echo +check_boilerplate $quiet || echo -echo "total: $errors errors, $warnings warnings" -exit $errors + +echo "total: $missing_spdx missing SPDX errors, $wrong_license license errors, $warnings warnings" +exit $((missing_spdx + wrong_license)) diff --git a/license/exceptions.txt b/license/exceptions.txt index 1ded290eee..d12fac2034 100644 --- a/license/exceptions.txt +++ b/license/exceptions.txt @@ -10,11 +10,10 @@ Note that following licenses are not exceptions:- - GPL-2.0 (*Only for kernel code*) --------------------------------------------------------------------------------------------------- -SPDX Identifier TB Approval Date GB Approval Date File name +SPDX Identifier | TB Approval Date | GB Approval Date | File name --------------------------------------------------------------------------------------------------- -1.MIT 10/23/2019 02/10/2020 lib/eal/windows/include/dirent.h -2.BSD-2-Clause 10/23/2019 12/18/2019 lib/eal/windows/include/getopt.h -3.ISC AND - BSD-2-Clause 10/23/2019 12/18/2019 lib/eal/windows/getopt.c -4. MIT 10/19/2022 10/18/2022 drivers/net/gve/base/* +MIT | 10/23/2019 | 02/10/2020 | lib/eal/windows/include/dirent.h +BSD-2-Clause | 10/23/2019 | 12/18/2019 | lib/eal/windows/include/getopt.h +ISC AND BSD-2-Clause | 10/23/2019 | 12/18/2019 | lib/eal/windows/getopt.c +MIT | 10/19/2022 | 10/18/2022 | drivers/net/gve/base/* --------------------------------------------------------------------------------------------------- -- 2.47.0