.. | .. |
---|
32 | 32 | def read_spdxdata(repo): |
---|
33 | 33 | |
---|
34 | 34 | # The subdirectories of LICENSES in the kernel source |
---|
35 | | - license_dirs = [ "preferred", "other", "exceptions" ] |
---|
| 35 | + # Note: exceptions needs to be parsed as last directory. |
---|
| 36 | + license_dirs = [ "preferred", "dual", "deprecated", "exceptions" ] |
---|
36 | 37 | lictree = repo.head.commit.tree['LICENSES'] |
---|
37 | 38 | |
---|
38 | 39 | spdx = SPDXdata() |
---|
.. | .. |
---|
58 | 59 | elif l.startswith('SPDX-Licenses:'): |
---|
59 | 60 | for lic in l.split(':')[1].upper().strip().replace(' ', '').replace('\t', '').split(','): |
---|
60 | 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 | 63 | spdx.exceptions[exception].append(lic) |
---|
63 | 64 | |
---|
64 | 65 | elif l.startswith("License-Text:"): |
---|
65 | 66 | if exception: |
---|
66 | 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 | 69 | spdx.exception_files += 1 |
---|
69 | 70 | else: |
---|
70 | 71 | spdx.license_files += 1 |
---|
.. | .. |
---|
175 | 176 | self.lines_checked += 1 |
---|
176 | 177 | if line.find("SPDX-License-Identifier:") < 0: |
---|
177 | 178 | continue |
---|
178 | | - expr = line.split(':')[1].replace('*/', '').strip() |
---|
| 179 | + expr = line.split(':')[1].strip() |
---|
| 180 | + # Remove trailing comment closure |
---|
| 181 | + if line.strip().endswith('*/'): |
---|
| 182 | + expr = expr.rstrip('*/').strip() |
---|
| 183 | + # Remove trailing xml comment closure |
---|
| 184 | + if line.strip().endswith('-->'): |
---|
| 185 | + expr = expr.rstrip('-->').strip() |
---|
| 186 | + # Special case for SH magic boot code files |
---|
| 187 | + if line.startswith('LIST \"'): |
---|
| 188 | + expr = expr.rstrip('\"').strip() |
---|
179 | 189 | self.parse(expr) |
---|
180 | 190 | self.spdx_valid += 1 |
---|
181 | 191 | # |
---|