@@ -26,6 +26,34 @@ import org.ossreviewtoolkit.clients.fossid.model.summary.Summarizable
26
26
import org.ossreviewtoolkit.model.CopyrightFinding
27
27
import org.ossreviewtoolkit.model.LicenseFinding
28
28
import org.ossreviewtoolkit.model.TextLocation
29
+ import org.ossreviewtoolkit.utils.spdx.toSpdx
30
+
31
+ /* *
32
+ * Collection of problematic FossID license expressions. Compiled from FossID's list of licenses. May be updated if
33
+ * FossID adds new licenses.
34
+ */
35
+ private val fossIdLicenseMappings = mapOf (
36
+ " BSD (Three Clause License)" to " BSD-3-clause" .toSpdx(),
37
+ " BSD-Acknowledgment-(Carrot2)" to " LicenseRef-scancode-bsd-ack-carrot2" .toSpdx(),
38
+ " Freeware-Public-(FPL)" to " LicenseRef-scancode-fpl" .toSpdx(),
39
+ " MediaInfo(Lib)" to " LicenseRef-scancode-mediainfo-lib" .toSpdx(),
40
+ " Oracle-Master-Agreement-(OMA)" to " LicenseRef-scancode-oracle-master-agreement" .toSpdx(),
41
+ " Things-I-Made-(TIM)-Public" to " LicenseRef-scancode-things-i-made-public-license" .toSpdx(),
42
+ " X11-Style-(Adobe)" to " LicenseRef-scancode-x11-adobe" .toSpdx(),
43
+ " X11-Style-(Adobe-DEC)" to " LicenseRef-scancode-x11-adobe-dec" .toSpdx(),
44
+ " X11-Style-(Bitstream-Charter)" to " LicenseRef-scancode-x11-bitstream" .toSpdx(),
45
+ " X11-Style-(DEC-1)" to " LicenseRef-scancode-x11-dec1" .toSpdx(),
46
+ " X11-Style-(DEC-2)" to " LicenseRef-scancode-x11-dec2" .toSpdx(),
47
+ " X11-Style-(DSC-Technologies)" to " LicenseRef-scancode-x11-dsc" .toSpdx(),
48
+ " X11-Style-(David-R.-Hanson)" to " LicenseRef-scancode-x11-hanson" .toSpdx(),
49
+ " X11-Style-(Lucent)" to " LicenseRef-scancode-x11-lucent" .toSpdx(),
50
+ " X11-Style-(OAR)" to " LicenseRef-scancode-x11-oar" .toSpdx(),
51
+ " X11-Style-(Open-Group)" to " MIT-open-group" .toSpdx(),
52
+ " X11-Style-(Quarterdeck)" to " LicenseRef-scancode-x11-quarterdeck" .toSpdx(),
53
+ " X11-Style-(Realmode)" to " LicenseRef-scancode-x11-realmode" .toSpdx(),
54
+ " X11-Style-(Silicon-Graphics)" to " LicenseRef-scancode-x11-sg" .toSpdx(),
55
+ " X11-Style-(Tektronix)" to " LicenseRef-scancode-x11-tektronix" .toSpdx()
56
+ )
29
57
30
58
/* *
31
59
* A data class to hold FossID raw results.
@@ -58,7 +86,9 @@ internal fun <T : Summarizable> List<T>.mapSummary(ignoredFiles: Map<String, Ign
58
86
val location = TextLocation (summary.path, TextLocation .UNKNOWN_LINE , TextLocation .UNKNOWN_LINE )
59
87
60
88
summary.licences.forEach {
61
- val finding = LicenseFinding (it.identifier, location)
89
+ val license = fossIdLicenseMappings[it.identifier] ? : it.identifier.toSpdx()
90
+
91
+ val finding = LicenseFinding (license, location)
62
92
licenseFindings + = finding
63
93
}
64
94
0 commit comments