Skip to content

Commit

Permalink
fix(downloader): Do not even try empty source code origins
Browse files Browse the repository at this point in the history
For the respective (dummy) packages, set the source code origins to only
the known origin.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Jan 16, 2025
1 parent bd1af69 commit e1889ff
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions plugins/commands/downloader/src/main/kotlin/DownloaderCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import org.ossreviewtoolkit.model.Identifier
import org.ossreviewtoolkit.model.Package
import org.ossreviewtoolkit.model.PackageType
import org.ossreviewtoolkit.model.RemoteArtifact
import org.ossreviewtoolkit.model.SourceCodeOrigin
import org.ossreviewtoolkit.model.VcsInfo
import org.ossreviewtoolkit.model.VcsType
import org.ossreviewtoolkit.model.licenses.LicenseCategorization
Expand Down Expand Up @@ -455,7 +456,12 @@ class DownloaderCommand(descriptor: PluginDescriptor = DownloaderCommandFactory.
runCatching {
val dummyPackage = if (archiveType != ArchiveType.NONE) {
echo("Downloading $archiveType artifact from $projectUrl...")
Package.EMPTY.copy(id = dummyId, sourceArtifact = RemoteArtifact.EMPTY.copy(url = projectUrl))

Package.EMPTY.copy(
id = dummyId,
sourceArtifact = RemoteArtifact.EMPTY.copy(url = projectUrl),
sourceCodeOrigins = listOf(SourceCodeOrigin.ARTIFACT)
)
} else {
val vcs = VersionControlSystem.forUrl(projectUrl)
val vcsType = vcsTypeOption?.let { VcsType.forName(it) } ?: vcs?.type ?: VcsType.UNKNOWN
Expand All @@ -469,7 +475,13 @@ class DownloaderCommand(descriptor: PluginDescriptor = DownloaderCommandFactory.
)

echo("Downloading from $vcsType VCS at $projectUrl...")
Package.EMPTY.copy(id = dummyId, vcs = vcsInfo, vcsProcessed = vcsInfo.normalize())

Package.EMPTY.copy(
id = dummyId,
vcs = vcsInfo,
vcsProcessed = vcsInfo.normalize(),
sourceCodeOrigins = listOf(SourceCodeOrigin.VCS)
)
}

// Always allow moving revisions when directly downloading a single project only. This is for
Expand Down

0 comments on commit e1889ff

Please sign in to comment.