Skip to content

fix(conan): Do not hard-code the VCS type to "Git" #6839

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

Merged
merged 1 commit into from
Apr 13, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ projects:
- "The Boost Software License 1.0"
vcs:
type: "Git"
url: "http://github.com/ossreviewtoolkit/ort"
url: "http://github.com/ossreviewtoolkit/ort.git"
revision: ""
path: ""
vcs_processed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ project:
- "The Boost Software License 1.0"
vcs:
type: "Git"
url: "http://github.com/pocoproject/conan-poco"
url: "http://github.com/pocoproject/conan-poco.git"
revision: ""
path: ""
vcs_processed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ project:
declared_licenses: []
declared_licenses_processed: {}
vcs:
type: "Git"
type: ""
url: ""
revision: ""
path: ""
Expand Down
14 changes: 7 additions & 7 deletions plugins/package-managers/conan/src/main/kotlin/Conan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import org.apache.logging.log4j.kotlin.Logging
import org.ossreviewtoolkit.analyzer.AbstractPackageManagerFactory
import org.ossreviewtoolkit.analyzer.PackageManager
import org.ossreviewtoolkit.analyzer.parseAuthorString
import org.ossreviewtoolkit.downloader.VcsHost
import org.ossreviewtoolkit.downloader.VersionControlSystem
import org.ossreviewtoolkit.model.Hash
import org.ossreviewtoolkit.model.Identifier
Expand All @@ -40,7 +41,6 @@ import org.ossreviewtoolkit.model.ProjectAnalyzerResult
import org.ossreviewtoolkit.model.RemoteArtifact
import org.ossreviewtoolkit.model.Scope
import org.ossreviewtoolkit.model.VcsInfo
import org.ossreviewtoolkit.model.VcsType
import org.ossreviewtoolkit.model.config.AnalyzerConfiguration
import org.ossreviewtoolkit.model.config.PackageManagerConfiguration
import org.ossreviewtoolkit.model.config.RepositoryConfiguration
Expand Down Expand Up @@ -376,12 +376,12 @@ class Conan(
/**
* Return the [VcsInfo] contained in [node].
*/
private fun parseVcsInfo(node: JsonNode) =
VcsInfo(
type = VcsType.GIT,
url = node["url"].textValueOrEmpty(),
revision = node["revision"].textValueOrEmpty().takeUnless { it == "0" }.orEmpty()
)
private fun parseVcsInfo(node: JsonNode): VcsInfo {
val revision = node["revision"].textValueOrEmpty()
val url = node["url"].textValueOrEmpty()
val vcsInfo = VcsHost.parseUrl(url)
return if (revision == "0") vcsInfo else vcsInfo.copy(revision = revision)
}

/**
* Return the value of [field] from the output of `conan inspect --raw` for the package in [node].
Expand Down