Skip to content

Commit

Permalink
fix(aosd): Only set the selectedLicense if it actually selects some…
Browse files Browse the repository at this point in the history
…thing

Omit the `selectedLicense` if it is the same as `spdxId` and might still
offer a choice. Also, an absent `selectedLicense` should be encoded as
the empty string, not as SPDX `NOASSERTION`.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Dec 16, 2024
1 parent 6db8eae commit 66d3984
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/reporters/aosd/src/main/kotlin/Aosd21Reporter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ private fun Map<Identifier, IndexedValue<CuratedPackage>>.toComponents(
.applyChoices(input.ortResult.getRepositoryLicenseChoices())

val selectedExpressions = selectedLicenseInfo.toSimplifiedCompoundExpression()
.takeUnless { it == licenseExpressions }

val licenseTexts = licenseExpressions.licenses().mapNotNullTo(mutableSetOf()) { license ->
input.licenseTextProvider.getLicenseText(license)
Expand All @@ -116,7 +117,7 @@ private fun Map<Identifier, IndexedValue<CuratedPackage>>.toComponents(
licenseText = licenseTexts,
// Can be empty as the license information is the result of a file level scan.
licenseTextUrl = "",
selectedLicense = selectedExpressions.nullOrBlankToSpdxNoassertionOrNone()
selectedLicense = selectedExpressions?.toString().orEmpty()
).validate()
)
).validate()
Expand Down

0 comments on commit 66d3984

Please sign in to comment.