From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6396BA0540; Wed, 15 Jul 2020 01:21:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 994131C1B2; Wed, 15 Jul 2020 01:21:12 +0200 (CEST) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by dpdk.org (Postfix) with ESMTP id A4A371C115 for ; Wed, 15 Jul 2020 01:21:11 +0200 (CEST) Received: by mail-pj1-f67.google.com with SMTP id k71so141495pje.0 for ; Tue, 14 Jul 2020 16:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iAH05qDFUk2RYGfNs3U066xY2DWlmv4tMDummuyukQM=; b=MzanTq5qJcuBAVEfUgHHl1YTsIk7KfZdqX4URHwYOeTwx6LEWMZ47+w6AV721406re si3ZrTMc0b0m3xWjXg+NeiqPzCcYGeGNy6D3yhfuaVeJRGfcrxKEoDrSpA0c5OiG3tcw aBMZwXlbz3fOLahTMAG1zypQ4TaayZ3qAitbK1GxfqkFimR/XF8niyhuAEOs3h2kp7Ci FXgV0WxTqDAOTn7G6LRA8Tb92tkny+vyz6GG/m1vq0c9x95p7F2ks5qBhUFpkvXg4ab/ UcDTbzUEYXBqlOEKwKBkZaIWOa9DPa9KmBI6JNcmnBSzFw98O3vyTWBaWRYIUEEEBb9E 1caQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iAH05qDFUk2RYGfNs3U066xY2DWlmv4tMDummuyukQM=; b=QmBYnNGykIu3d4Dd1MbI8ydTGoOfuSR0/SIbMBjcBaBqGhqgMOmm1ypp0BC1zaouHR JSaatI6aBP69xCzgPi/Hp1xuEJFfsWWAkUtR/MUxl9lHLsMizJ6U6809qzBsMBHurevr HOrHfbufn5GsJtEqj89CHdR18ZsB8+BVEb4TyWQ2l/LMBH63PUWCtXoeLSr5/KasoRXI bwiVCHvH5K1g28dZvytAGdFWcXAqyaQmFYl7nupPzA6M/8W1KsSTeNAdnxSudcL0DdkS k8OgM3ueZpjnLVXEJmQb7M5aIdnVTW+bef+5o6ddX1BwU5jXr12dr7oOdwu2MBOxuLvn mcow== X-Gm-Message-State: AOAM533k4xrDkftA6iCp/5ieoxIO9fldvNqqqibzuHdkqCDaCYzZ6Dun yNxArL83KJ2WRC5V2h49uP8CiSoRwk4/cw== X-Google-Smtp-Source: ABdhPJw0KdEdFC99XKJlOJMdEgEoEyFBBfS34bjtUpQq8hjnWrWaVxAMnnHXIqR91Cp3zT7Sv5Zmeg== X-Received: by 2002:a17:90b:94f:: with SMTP id dw15mr7200734pjb.199.1594768870078; Tue, 14 Jul 2020 16:21:10 -0700 (PDT) Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d5sm145703pju.15.2020.07.14.16.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 16:21:08 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Tue, 14 Jul 2020 16:21:01 -0700 Message-Id: <20200714232101.32544-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200129155907.20556-1-stephen@networkplumber.org> References: <20200129155907.20556-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5] devtools: add new SPDX license compliance checker X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Simple script to look for drivers and scripts that are missing requires SPDX header. Signed-off-by: Stephen Hemminger --- v5 - address review comments simplify the display logic scan doc and buildtools as well MAINTAINERS | 1 + devtools/check-spdx-tag.sh | 70 ++++++++++++++++++++++++ doc/guides/contributing/coding_style.rst | 9 ++- 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100755 devtools/check-spdx-tag.sh diff --git a/MAINTAINERS b/MAINTAINERS index 3cd402b34c91..a9e01330a71e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -90,6 +90,7 @@ F: devtools/check-maintainers.sh F: devtools/check-forbidden-tokens.awk F: devtools/check-git-log.sh F: devtools/check-includes.sh +F: devtools/check-spdx-tag.sh F: devtools/check-symbol-maps.sh F: devtools/checkpatches.sh F: devtools/get-maintainer.sh diff --git a/devtools/check-spdx-tag.sh b/devtools/check-spdx-tag.sh new file mode 100755 index 000000000000..ff9e9c61b697 --- /dev/null +++ b/devtools/check-spdx-tag.sh @@ -0,0 +1,70 @@ +#! /bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2020 Microsoft Corporation +# +# Produce a list of files with incorrect license tags + +errors=0 +warnings=0 +quiet=false +verbose=false + +print_usage () { + echo "usage: $(basename $0) [-q] [-v]" + exit 1 +} + +check_spdx() { + if $verbose; then + echo "Files without SPDX License" + echo "--------------------------" + fi + git grep -L SPDX-License-Identifier -- \ + ':^.git*' ':^.ci/*' ':^.travis.yml' \ + ':^README' ':^MAINTAINERS' ':^VERSION' ':^ABI_VERSION' \ + ':^*/Kbuild' ':^*/README' \ + ':^license/' ':^config/' ':^buildtools/' \ + ':^*.cocci' ':^*.abignore' \ + ':^*.def' ':^*.map' ':^*.ini' ':^*.data' ':^*.cfg' ':^*.txt' \ + ':^*.svg' ':^*.png'\ + > $tmpfile + + errors=$(wc -l < $tmpfile) + $quiet || cat $tmpfile +} + +check_boilerplate() { + if $verbose ; then + echo + echo "Files with redundant license text" + echo "---------------------------------" + fi + + git grep -l Redistribution -- \ + ':^license/' ':^/devtools/check-spdx-tag.sh' > $tmpfile + + warnings=$(wc -l <$tmpfile) + $quiet || cat $tmpfile +} + +while getopts qvh ARG ; do + case $ARG in + q ) quiet=true ;; + v ) verbose=true ;; + h ) print_usage ; exit 0 ;; + ? ) print_usage ; exit 1 ;; + esac +done +shift $(($OPTIND - 1)) + +tmpfile=$(mktemp) +trap 'rm -f -- "$tmpfile"' INT TERM HUP EXIT + +check_spdx +$quiet || echo + +check_boilerplate + +$quiet || echo +echo "total: $errors errors, $warnings warnings" +exit $errors diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contributing/coding_style.rst index 4efde93f6af0..b55075eaa240 100644 --- a/doc/guides/contributing/coding_style.rst +++ b/doc/guides/contributing/coding_style.rst @@ -54,8 +54,13 @@ To document a public API, a doxygen-like format must be used: refer to :ref:`dox License Header ~~~~~~~~~~~~~~ -Each file should begin with a special comment containing the appropriate copyright and license for the file. -Generally this is the BSD License, except for code for Linux Kernel modules. +Each file must begin with a special comment containing the +`Software Package Data Exchange (SPDX) License Identfier `_. + +Generally this is the BSD License, except for code granted special exceptions. +The SPDX licences identifier is sufficient, a file should not contain +an additional text version of the license (boilerplate). + After any copyright header, a blank line should be left before any other contents, e.g. include statements in a C file. C Preprocessor Directives -- 2.27.0