02 Oct, 2020
1 commit
-
Commit cc9539e7884c ("media: docs: use the new SPDX header for GFDL-1.1 on
*.svg files") adds SPDX-License-Identifiers enclosed in XML comments,
i.e., <!-- ... -->, for svg files.Unfortunately, ./scripts/spdxcheck.py does not handle
SPDX-License-Identifiers in XML comments, so it simply fails on checking
these files with 'Invalid License ID: --'.Strip the XML comment ending simply by copying how it was done for comments
in C. With that, ./scripts/spdxcheck.py handles the svg files properly.Signed-off-by: Lukas Bulwahn
Signed-off-by: Greg Kroah-Hartman
02 Jun, 2019
1 commit
-
The LICENSE directory has recently changed structure and this makes
spdxcheck fails as per below:FAIL: "Blob or Tree named 'other' not found"
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 240, in
spdx = read_spdxdata(repo)
File "scripts/spdxcheck.py", line 41, in read_spdxdata
for el in lictree[d].traverse():
[...]
KeyError: "Blob or Tree named 'other' not found"Fix the script to restore the correctness on checkpatch License checking.
References: 62be257e986d ("LICENSES: Rename other to deprecated")
References: 8ea8814fcdcb ("LICENSES: Clearly mark dual license only licenses")
Link: http://lkml.kernel.org/r/20190523084755.56739-1-vincenzo.frascino@arm.com
Signed-off-by: Vincenzo Frascino
Cc: Joe Perches
Cc: Christoph Hellwig
Cc: Thomas Gleixner
Cc: Jeremy Cline
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
21 May, 2019
2 commits
-
The licenses from the other directory were partially moved to the dual
directory in commit 8ea8814fcdcb ("LICENSES: Clearly mark dual license only
licenses"). checkpatch therefore rejected files like
drivers/staging/android/ashmem.h withWARNING: 'SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 */' is not supported in LICENSES/...
#1: FILE: drivers/staging/android/ashmem.h:1:
+/* SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 */Fixes: 8ea8814fcdcb ("LICENSES: Clearly mark dual license only licenses")
Signed-off-by: Sven Eckelmann
Reviewed-by: Christoph Hellwig
Signed-off-by: Jonathan Corbet -
The directory name for other licenses was changed to "deprecated" in
commit 62be257e986d ("LICENSES: Rename other to deprecated"). But it was
not changed for spdxcheck.py. As result, checkpatch failed withFAIL: "Blob or Tree named 'other' not found"
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 240, in
spdx = read_spdxdata(repo)
File "scripts/spdxcheck.py", line 41, in read_spdxdata
for el in lictree[d].traverse():
File "/usr/lib/python2.7/dist-packages/git/objects/tree.py", line 298, in __getitem__
return self.join(item)
File "/usr/lib/python2.7/dist-packages/git/objects/tree.py", line 244, in join
raise KeyError(msg % file)
KeyError: "Blob or Tree named 'other' not found"Fixes: 62be257e986d ("LICENSES: Rename other to deprecated")
Signed-off-by: Sven Eckelmann
Reviewed-by: Christoph Hellwig
Signed-off-by: Jonathan Corbet
22 Feb, 2019
1 commit
-
With the last commit to support the SuperH boot code files, we have the
following regression:$ ./scripts/checkpatch.pl -f
Signed-off-by: Jonathan Corbet
17 Jan, 2019
1 commit
-
The SuperH boot code files use a magic format for the SPDX identifier
comment:LIST "SPDX-License-Identifier: .... "
The trailing quotation mark is not stripped before the token parser is
invoked and causes the scan to fail. Handle it gracefully.Fixes: 6a0abce4c4cc ("sh: include: convert to SPDX identifiers")
Signed-off-by: Thomas Gleixner
Cc: Kuninori Morimoto
Cc: Simon Horman
Cc: Yoshinori Sato
Cc: Rich Felker
Cc: Andrew Morton
Cc: Kate Stewart
Reviewed-by: Greg Kroah-Hartman
Signed-off-by: Jonathan Corbet
15 Dec, 2018
1 commit
-
The spdxcheck script currently falls over when confronted with a binary
file (such as Documentation/logo.gif). To avoid that, always open files
in binary mode and decode line-by-line, ignoring encoding errors.One tricky case is when piping data into the script and reading it from
standard input. By default, standard input will be opened in text mode,
so we need to reopen it in binary mode.The breakage only happens with python3 and results in a
UnicodeDecodeError (according to Uwe).Link: http://lkml.kernel.org/r/20181212131210.28024-1-thierry.reding@gmail.com
Fixes: 6f4d29df66ac ("scripts/spdxcheck.py: make python3 compliant")
Signed-off-by: Thierry Reding
Reviewed-by: Jeremy Cline
Cc: Thomas Gleixner
Cc: Jonathan Corbet
Cc: Joe Perches
Cc: Uwe Kleine-König
Cc:
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
19 Nov, 2018
1 commit
-
Without this change the following happens when using Python3 (3.6.6):
$ echo "GPL-2.0" | python3 scripts/spdxcheck.py -
FAIL: 'str' object has no attribute 'decode'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 253, in
parser.parse_lines(sys.stdin, args.maxlines, '-')
File "scripts/spdxcheck.py", line 171, in parse_lines
line = line.decode(locale.getpreferredencoding(False), errors='ignore')
AttributeError: 'str' object has no attribute 'decode'So as the line is already a string, there is no need to decode it and
the line can be dropped./usr/bin/python on Arch is Python 3. So this would indeed be worth
going into 4.19.Link: http://lkml.kernel.org/r/20181023070802.22558-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König
Cc: Thomas Gleixner
Cc: Joe Perches
Cc: Greg Kroah-Hartman
Cc:
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
18 Aug, 2018
2 commits
-
"dict.has_key(key)" on dictionaries has been replaced with "key in
dict". Additionally, when run under Python 3 some files don't decode
with the default encoding (tested with UTF-8). To handle that, don't
open the file in text mode and decode text line-by-line, ignoring
encoding errors.This remains compatible with Python 2 and should have no functional
change.Link: http://lkml.kernel.org/r/20180717190635.29467-1-jcline@redhat.com
Signed-off-by: Jeremy Cline
Acked-by: Thomas Gleixner
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Depending on how old your -next tree is, it may not have a master that
has the LICENSES directory.Change the lookup to HEAD and find whatever LICENSE directory files are
used in that branch.Miscellanea:
- Remove the checkpatch test as it will have its own SPDX license
identifier.Link: http://lkml.kernel.org/r/7eeefc862194930c773e662cb2152e178441d3b8.camel@perches.com
Signed-off-by: Joe Perches
Reviewed-by: Thomas Gleixner
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
28 Apr, 2018
1 commit
-
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] [-v] [path [path ...]]SPDX expression checker
positional arguments:
path Check path or file. If not given full git tree scan.
For stdin use "-"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
-v, --verbose Verbose statistics outputinclude/dt-bindings/reset/amlogic,meson-axg-reset.h: 9:41 Invalid License ID: BSD
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: BSDarch/x86/kernel/jailhouse.c: 1:28 Invalid License ID: GPL2.0
include/dt-bindings/reset/amlogic,meson-axg-reset.h: 9:41 Invalid License ID: BSDarch/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.0arch/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.0License files: 14
Exception files: 1
License IDs 19
Exception IDs 1Files checked: 61332
Lines checked: 669181
Files with SPDX: 16169
Files with errors: 5real 0m2.642s
user 0m2.231s
sys 0m0.467sThat'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
Reviewed-by: Greg Kroah-Hartman
[jc: Fixed ironically erroneous SPDX tag and did chmod +x ]
Signed-off-by: Jonathan Corbet