diff options
author | Vincenzo Frascino <vincenzo.frascino@arm.com> | 2019-06-01 01:30:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-06-01 18:51:31 -0400 |
commit | 8d7a7abfc6b42621adc070c7c29b013d7727ed6f (patch) | |
tree | 4820c3c3900c25b41cd00f590e755681f7216f6c | |
parent | 0600597c854e53d2f9b7a6a718c1da2b8b4cb4db (diff) |
spdxcheck.py: fix directory structures
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 <module>
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 <vincenzo.frascino@arm.com>
Cc: Joe Perches <joe@perches.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jeremy Cline <jcline@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rwxr-xr-x | scripts/spdxcheck.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py index 33df646618e2..6374e078a5f2 100755 --- a/scripts/spdxcheck.py +++ b/scripts/spdxcheck.py | |||
@@ -32,7 +32,8 @@ class SPDXdata(object): | |||
32 | def read_spdxdata(repo): | 32 | def read_spdxdata(repo): |
33 | 33 | ||
34 | # The subdirectories of LICENSES in the kernel source | 34 | # The subdirectories of LICENSES in the kernel source |
35 | license_dirs = [ "preferred", "deprecated", "exceptions", "dual" ] | 35 | # Note: exceptions needs to be parsed as last directory. |
36 | license_dirs = [ "preferred", "dual", "deprecated", "exceptions" ] | ||
36 | lictree = repo.head.commit.tree['LICENSES'] | 37 | lictree = repo.head.commit.tree['LICENSES'] |
37 | 38 | ||
38 | spdx = SPDXdata() | 39 | spdx = SPDXdata() |
@@ -58,13 +59,13 @@ def read_spdxdata(repo): | |||
58 | elif l.startswith('SPDX-Licenses:'): | 59 | elif l.startswith('SPDX-Licenses:'): |
59 | for lic in l.split(':')[1].upper().strip().replace(' ', '').replace('\t', '').split(','): | 60 | for lic in l.split(':')[1].upper().strip().replace(' ', '').replace('\t', '').split(','): |
60 | if not lic in spdx.licenses: | 61 | if not lic in spdx.licenses: |
61 | raise SPDXException(None, 'Exception %s missing license %s' %(ex, lic)) | 62 | raise SPDXException(None, 'Exception %s missing license %s' %(exception, lic)) |
62 | spdx.exceptions[exception].append(lic) | 63 | spdx.exceptions[exception].append(lic) |
63 | 64 | ||
64 | elif l.startswith("License-Text:"): | 65 | elif l.startswith("License-Text:"): |
65 | if exception: | 66 | if exception: |
66 | if not len(spdx.exceptions[exception]): | 67 | if not len(spdx.exceptions[exception]): |
67 | raise SPDXException(el, 'Exception %s is missing SPDX-Licenses' %excid) | 68 | raise SPDXException(el, 'Exception %s is missing SPDX-Licenses' %exception) |
68 | spdx.exception_files += 1 | 69 | spdx.exception_files += 1 |
69 | else: | 70 | else: |
70 | spdx.license_files += 1 | 71 | spdx.license_files += 1 |