linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Philippe Ombredanne <pombredanne@nexb.com>,
	Kate Stewart <kstewart@linuxfoundation.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Mauro Carvalho Chehab <mchehab@s-opensource.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [patch V2 7/7] scripts: Add SPDX checker script
Date: Thu, 26 Apr 2018 09:02:46 +0200	[thread overview]
Message-ID: <20180426070246.GL14025@kroah.com> (raw)
In-Reply-To: <20180425203703.650160358@linutronix.de>

On Wed, Apr 25, 2018 at 10:30:27PM +0200, Thomas Gleixner wrote:
> The SPDX-License-Identifiers are growing in the kernel and so grow
> expression failures and license IDs are used which have no corresponding
> license text file in the LICENSES directory.
> 
> Add a script which gathers information from the LICENSES directory,
> i.e. the various tags in the licenses and exception files and then scans
> either input from stdin, which it treats as a single file or if started
> without arguments it scans the full kernel tree.
> 
> It checks whether the license expression syntax is correct and also
> validates whether the license identifiers used in the expressions are
> available in the LICENSES files.
> 
> # scripts/spdxcheck.py -h
> usage: spdxcheck.py [-h] [-m MAXLINES] [-s] [-v]
> 
> SPDX expression checker
> 
> optional arguments:
>   -h, --help            show this help message and exit
>   -m MAXLINES, --maxlines MAXLINES
>                         Maximum number of lines to scan in a file. Default 15
>   -s, --stdin           Read from stdin. If not set scan full git tree.
>   -v, --verbose         Verbose statistics output
> 
> 
> # scripts/spdxcheck.py -s <COPYING
> 
> # scripts/spdxcheck.py -s <include/dt-bindings/reset/amlogic,meson-axg-reset.h
> include/dt-bindings/reset/amlogic,meson-axg-reset.h: 9:41 Invalid License ID: BSD
> 
> # scripts/spdxcheck.py
> arch/arm/mach-s3c24xx/h1940-bluetooth.c: 1:28 Invalid License ID: GPL-1.0
> arch/x86/kernel/jailhouse.c: 1:28 Invalid License ID: GPL2.0
> drivers/pinctrl/sh-pfc/pfc-r8a77965.c: 1:28 Invalid License ID: GPL-2.
> include/dt-bindings/reset/amlogic,meson-axg-reset.h: 9:41 Invalid License ID: BSD
> arch/x86/include/asm/jailhouse_para.h: 1:28 Invalid License ID: GPL2.0
> 
> # time scripts/spdxcheck.py -v
> arch/arm/mach-s3c24xx/h1940-bluetooth.c: 1:28 Invalid License ID: GPL-1.0
> arch/x86/kernel/jailhouse.c: 1:28 Invalid License ID: GPL2.0
> drivers/pinctrl/sh-pfc/pfc-r8a77965.c: 1:28 Invalid License ID: GPL-2.
> include/dt-bindings/reset/amlogic,meson-axg-reset.h: 9:41 Invalid License ID: BSD
> arch/x86/include/asm/jailhouse_para.h: 1:28 Invalid License ID: GPL2.0
> 
> License files:               14
> Exception files:              1
> License IDs                  19
> Exception IDs                 1
> 
> Files checked:            61332
> Lines checked:           669181
> Files with SPDX:          16169
> Files with errors:            5
> 
> real	0m2.642s
> user	0m2.231s
> sys	0m0.467s
> 
> That's a full tree sweep on my laptop. Note, this runs single threaded.
> 
> It scans by default the first 15 lines for a SPDX identifier where the
> current max inside a top comment is at line 10. But that's going to be
> faster once the identifiers are all in the first two lines as documented.
> 
> The python wizards will surely know how to do that smarter and faster, but
> its at least better than no tool at all.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Very nice, thanks for writing this.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

  reply	other threads:[~2018-04-26  7:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 20:30 [patch V2 0/7] LICENSES: Add missing License Text and provide a checker script Thomas Gleixner
2018-04-25 20:30 ` [patch V2 1/7] LICENSES/GPL2.0: Add GPL-2.0-only/or-later as valid identifiers Thomas Gleixner
2018-04-26  7:00   ` Greg Kroah-Hartman
2018-04-26  9:52   ` Mauro Carvalho Chehab
2018-04-25 20:30 ` [patch V2 2/7] LICENSES: Add X11 license Thomas Gleixner
2018-04-26  7:00   ` Greg Kroah-Hartman
2018-04-25 20:30 ` [patch V2 3/7] LICENSES: Add Apache 2.0 license text Thomas Gleixner
2018-04-26  7:00   ` Greg Kroah-Hartman
2018-04-26 14:30     ` Kate Stewart
2018-04-25 20:30 ` [patch V2 4/7] LICENSES: Add CDDL-1.0 " Thomas Gleixner
2018-04-26  7:01   ` Greg Kroah-Hartman
2018-04-26 14:29     ` Kate Stewart
2018-04-25 20:30 ` [patch V2 5/7] LICENSES: Add CC-BY-SA-4.0 " Thomas Gleixner
2018-04-26  7:01   ` Greg Kroah-Hartman
2018-04-26 14:27     ` Kate Stewart
2018-04-25 20:30 ` [patch V2 6/7] LICENSES: Add Linux-OpenIB " Thomas Gleixner
2018-04-26  7:01   ` Greg Kroah-Hartman
2018-04-26 14:24   ` Kate Stewart
2018-04-25 20:30 ` [patch V2 7/7] scripts: Add SPDX checker script Thomas Gleixner
2018-04-26  7:02   ` Greg Kroah-Hartman [this message]
2018-04-26 13:54     ` [patch V3 " Thomas Gleixner
2018-04-26 17:04       ` Greg Kroah-Hartman
2018-04-26 18:43         ` Thomas Gleixner
2018-05-14 14:35   ` [patch V2 " Philippe Ombredanne
2018-08-28  9:19     ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180426070246.GL14025@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=corbet@lwn.net \
    --cc=hans.verkuil@cisco.com \
    --cc=hch@lst.de \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@s-opensource.com \
    --cc=pombredanne@nexb.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).