Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1587061

Re: [PATCH] checkpatch.pl: Add SPDX license tag check for dts files and headers

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] checkpatch.pl: Add SPDX license tag check for dts files and headers
Date 2017-02-23 19:10 +0100
Message-ID <te601-4S6-1@gated-at.bofh.it> (permalink)
References <te47U-3xP-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 2017-02-23 at 09:56 -0600, Rob Herring wrote:
> Add a check for using SPDX-License-Identifier tags to define the license of
> .dts{i} and DT header files rather than using free form license text. This
> check looks for GPL, BSD, or X11(really incorrectly labeled MIT license)
> license text which are the commonly used DT licenses.

Hi Rob.

> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Andy Whitcroft <apw@canonical.com>
> Cc: Joe Perches <joe@perches.com>
> ---
>  scripts/checkpatch.pl | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 982c52ca6473..ce802b3146e3 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2139,6 +2139,7 @@ sub process {
>  	my $commit_log_has_diff = 0;
>  	my $reported_maintainer_file = 0;
>  	my $non_utf8_charset = 0;
> +	my $licensefile = '';

Maybe this should be $spdx_license_file
but what's the actual reason to check if
multiple license bits are in a single file?

> +# check for using SPDX tag instead of free form license text in dts and binding header files
> +		if ($licensefile ne $realfile &&
> +		    ($realfile =~ /\.dtsi?$/ || $realfile =~ /dt-bindings\/.*\.h$/) &&

It's nicer to use a non / leading char like @
so you don't have to escape the /.

maybe
	$realfile =~ m@/dt-bindings/.*\.h$@

> +		    $rawline !~ /\bSPDX-License-Identifier/ &&
> +		    ($rawline =~ /^\+.*\bGeneral\s+Public\s+License/i ||
> +		    $rawline =~ /^\+.*\bTHE\s+SOFTWARE\s+IS\s+PROVIDED\s+\"AS\s+IS\"/i ||
> +		    $rawline =~ /^\+.*\b(GPL|BSD|X11)/)) {

nicer to indent these last 2 lines one more space
to keep alignment to open parenthesis.

> +			$licensefile = $realfile;
> +			WARN("SPDX_LICENSE_TAG",
> +			     "Use SPDX-License-Identifier tags instead of full license text\n" . $herecurr);
> +		}
> +
>  # check we are in a valid source file if not then ignore this hunk
>  		next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] checkpatch.pl: Add SPDX license tag check for dts files and headers Rob Herring <robh@kernel.org> - 2017-02-23 17:10 +0100
  Re: [PATCH] checkpatch.pl: Add SPDX license tag check for dts files  and headers Joe Perches <joe@perches.com> - 2017-02-23 19:10 +0100
    Re: [PATCH] checkpatch.pl: Add SPDX license tag check for dts files  and headers Rob Herring <robh@kernel.org> - 2017-02-23 19:50 +0100
      Re: [PATCH] checkpatch.pl: Add SPDX license tag check for dts files  and headers Joe Perches <joe@perches.com> - 2017-02-23 20:20 +0100

csiph-web