aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/spdxcheck.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/spdxcheck.py')
-rwxr-xr-xscripts/spdxcheck.py7
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):
32def read_spdxdata(repo): 32def 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