Skip to content

Commit

Permalink
fix(conan): Do not hard-code the VCS type to "Git"
Browse files Browse the repository at this point in the history
Fixes #6827.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Apr 12, 2023
1 parent b044327 commit 471e1b6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
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
13 changes: 7 additions & 6 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 Down Expand Up @@ -376,12 +377,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

0 comments on commit 471e1b6

Please sign in to comment.