Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helper-cli: Allow to specify purls in package lists used for creating analyzer results #9529

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependabot[bot] <dependabot[bot]@users.noreply.github.com> <49699333+dependabot[
Frank Viernau <[email protected]> <[email protected]>
Frank Viernau <[email protected]> <[email protected]>
Frank Viernau <[email protected]> <[email protected]>
Frank Viernau <[email protected]> <[email protected]>
François Barbe <[email protected]>
François Barbe <[email protected]> <[email protected]>
François Barbe <[email protected]> <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ analyzer:
linkage: "STATIC"
packages:
- id: "NPM::example-dependency-one:1.0.0"
purl: ""
purl: "pkg:npm/[email protected]"
declared_licenses: []
declared_licenses_processed: {}
description: ""
Expand All @@ -82,7 +82,7 @@ analyzer:
revision: "0000000000000000000000000000000000000000"
path: "vcs-path/dependency-one"
- id: "NPM::example-dependency-two:2.0.0"
purl: ""
purl: "pkg:github/example-org/[email protected]"
declared_licenses: []
declared_licenses_processed: {}
description: ""
Expand Down
1 change: 1 addition & 0 deletions helper-cli/src/funTest/assets/package-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
isExcluded: true
isDynamicallyLinked: true
- id: "NPM::example-dependency-two:2.0.0"
purl: "pkg:github/example-org/[email protected]"
vcs:
type: "Git"
url: "https://github.com/example/depedency-1.git"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.ossreviewtoolkit.model.config.ScopeExcludeReason
import org.ossreviewtoolkit.model.mapper
import org.ossreviewtoolkit.model.orEmpty
import org.ossreviewtoolkit.model.utils.toPurl
mnonnenmacher marked this conversation as resolved.
Show resolved Hide resolved
import org.ossreviewtoolkit.plugins.packagecurationproviders.api.PackageCurationProviderFactory
import org.ossreviewtoolkit.utils.common.expandTilde
import org.ossreviewtoolkit.utils.config.setPackageCurations
Expand Down Expand Up @@ -146,6 +147,7 @@

private data class Dependency(
val id: Identifier,
val purl: String?,

Check warning on line 150 in helper-cli/src/main/kotlin/commands/CreateAnalyzerResultFromPackageListCommand.kt

View check run for this annotation

Codecov / codecov/patch

helper-cli/src/main/kotlin/commands/CreateAnalyzerResultFromPackageListCommand.kt#L150

Added line #L150 was not covered by tests
val vcs: Vcs? = null,
val sourceArtifact: SourceArtifact? = null,
val isExcluded: Boolean = false,
Expand Down Expand Up @@ -190,10 +192,14 @@
private fun Dependency.toPackage(): Package {
val vcsInfo = vcs.toVcsInfo()

return Package.EMPTY.copy(
return Package(

Check warning on line 195 in helper-cli/src/main/kotlin/commands/CreateAnalyzerResultFromPackageListCommand.kt

View check run for this annotation

Codecov / codecov/patch

helper-cli/src/main/kotlin/commands/CreateAnalyzerResultFromPackageListCommand.kt#L195

Added line #L195 was not covered by tests
mnonnenmacher marked this conversation as resolved.
Show resolved Hide resolved
id = id,
purl = purl ?: id.toPurl(),
sourceArtifact = sourceArtifact?.let { RemoteArtifact(url = it.url, it.hash ?: Hash.NONE) }.orEmpty(),
vcs = vcsInfo,
vcsProcessed = vcsInfo.normalize()
declaredLicenses = emptySet(),
description = "",
homepageUrl = "",
binaryArtifact = RemoteArtifact.EMPTY

Check warning on line 203 in helper-cli/src/main/kotlin/commands/CreateAnalyzerResultFromPackageListCommand.kt

View check run for this annotation

Codecov / codecov/patch

helper-cli/src/main/kotlin/commands/CreateAnalyzerResultFromPackageListCommand.kt#L200-L203

Added lines #L200 - L203 were not covered by tests
)
}
Loading