Skip to content

Commit 7df497b

Browse files
committed
fix(conan): Do not hard-code the VCS type to "Git"
Fixes #6827. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 3487731 commit 7df497b

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

cli/src/funTest/assets/projects/synthetic/spdx-project-xyz-expected-output-subproject-conan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ projects:
1111
- "The Boost Software License 1.0"
1212
vcs:
1313
type: "Git"
14-
url: "http://github.com/ossreviewtoolkit/ort"
14+
url: "http://github.com/ossreviewtoolkit/ort.git"
1515
revision: ""
1616
path: ""
1717
vcs_processed:

plugins/package-managers/conan/src/funTest/assets/projects/synthetic/conan-expected-output-py.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ project:
1111
- "The Boost Software License 1.0"
1212
vcs:
1313
type: "Git"
14-
url: "http://github.com/pocoproject/conan-poco"
14+
url: "http://github.com/pocoproject/conan-poco.git"
1515
revision: ""
1616
path: ""
1717
vcs_processed:

plugins/package-managers/conan/src/funTest/assets/projects/synthetic/conan-expected-output-txt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project:
55
declared_licenses: []
66
declared_licenses_processed: {}
77
vcs:
8-
type: "Git"
8+
type: ""
99
url: ""
1010
revision: ""
1111
path: ""

plugins/package-managers/conan/src/main/kotlin/Conan.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import org.apache.logging.log4j.kotlin.Logging
3030
import org.ossreviewtoolkit.analyzer.AbstractPackageManagerFactory
3131
import org.ossreviewtoolkit.analyzer.PackageManager
3232
import org.ossreviewtoolkit.analyzer.parseAuthorString
33+
import org.ossreviewtoolkit.downloader.VcsHost
3334
import org.ossreviewtoolkit.downloader.VersionControlSystem
3435
import org.ossreviewtoolkit.model.Hash
3536
import org.ossreviewtoolkit.model.Identifier
@@ -40,7 +41,6 @@ import org.ossreviewtoolkit.model.ProjectAnalyzerResult
4041
import org.ossreviewtoolkit.model.RemoteArtifact
4142
import org.ossreviewtoolkit.model.Scope
4243
import org.ossreviewtoolkit.model.VcsInfo
43-
import org.ossreviewtoolkit.model.VcsType
4444
import org.ossreviewtoolkit.model.config.AnalyzerConfiguration
4545
import org.ossreviewtoolkit.model.config.PackageManagerConfiguration
4646
import org.ossreviewtoolkit.model.config.RepositoryConfiguration
@@ -376,12 +376,12 @@ class Conan(
376376
/**
377377
* Return the [VcsInfo] contained in [node].
378378
*/
379-
private fun parseVcsInfo(node: JsonNode) =
380-
VcsInfo(
381-
type = VcsType.GIT,
382-
url = node["url"].textValueOrEmpty(),
383-
revision = node["revision"].textValueOrEmpty().takeUnless { it == "0" }.orEmpty()
384-
)
379+
private fun parseVcsInfo(node: JsonNode): VcsInfo {
380+
val revision = node["revision"].textValueOrEmpty()
381+
val url = node["url"].textValueOrEmpty()
382+
val vcsInfo = VcsHost.parseUrl(url)
383+
return if (revision == "0") vcsInfo else vcsInfo.copy(revision = revision)
384+
}
385385

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

0 commit comments

Comments
 (0)