Skip to content

Commit

Permalink
Conan: Try to get the VCS info from the homepage
Browse files Browse the repository at this point in the history
Do not parse the VCS info from the output of "conan info", because this
only ever points to the recipe of the package, but not to the source
code. Usually this points to the ConanCenter index [1].

Instead, try to parse the VCS info from the homepage URL of the package.

This partly addresses #2037.

[1] https://github.com/conan-io/conan-center-index

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
  • Loading branch information
mnonnenmacher committed Oct 5, 2021
1 parent 4f502b0 commit 9af7b89
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ packages:
algorithm: ""
vcs:
type: "Git"
url: "https://github.com/conan-io/conan-center-index"
url: "https://github.com/openssl/openssl.git"
revision: ""
path: ""
vcs_processed:
type: "Git"
url: "https://github.com/conan-io/conan-center-index.git"
url: "https://github.com/openssl/openssl.git"
revision: ""
path: ""
- id: "Conan::zlib:1.2.11"
Expand All @@ -78,12 +78,12 @@ packages:
value: ""
algorithm: ""
vcs:
type: "Git"
url: "https://github.com/conan-io/conan-center-index"
type: ""
url: ""
revision: ""
path: ""
vcs_processed:
type: "Git"
url: "https://github.com/conan-io/conan-center-index.git"
type: ""
url: ""
revision: ""
path: ""
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ packages:
value: ""
algorithm: ""
vcs:
type: "Git"
url: "https://github.com/conan-io/conan-center-index"
type: ""
url: ""
revision: ""
path: ""
vcs_processed:
type: "Git"
url: "https://github.com/conan-io/conan-center-index.git"
type: ""
url: ""
revision: ""
path: ""
- id: "Conan::libiconv:1.16"
Expand All @@ -80,13 +80,13 @@ packages:
value: ""
algorithm: ""
vcs:
type: "Git"
url: "https://github.com/conan-io/conan-center-index"
type: ""
url: ""
revision: ""
path: ""
vcs_processed:
type: "Git"
url: "https://github.com/conan-io/conan-center-index.git"
type: ""
url: ""
revision: ""
path: ""
- id: "Conan::libxml2:2.9.12"
Expand All @@ -108,13 +108,13 @@ packages:
value: ""
algorithm: ""
vcs:
type: "Git"
url: "https://github.com/conan-io/conan-center-index"
type: ""
url: ""
revision: ""
path: ""
vcs_processed:
type: "Git"
url: "https://github.com/conan-io/conan-center-index.git"
type: ""
url: ""
revision: ""
path: ""
- id: "Conan::libxslt:1.1.34"
Expand All @@ -137,13 +137,13 @@ packages:
value: ""
algorithm: ""
vcs:
type: "Git"
url: "https://github.com/conan-io/conan-center-index"
type: ""
url: ""
revision: ""
path: ""
vcs_processed:
type: "Git"
url: "https://github.com/conan-io/conan-center-index.git"
type: ""
url: ""
revision: ""
path: ""
- id: "Conan::openssl:1.1.1l"
Expand All @@ -167,12 +167,12 @@ packages:
algorithm: ""
vcs:
type: "Git"
url: "https://github.com/conan-io/conan-center-index"
url: "https://github.com/openssl/openssl.git"
revision: ""
path: ""
vcs_processed:
type: "Git"
url: "https://github.com/conan-io/conan-center-index.git"
url: "https://github.com/openssl/openssl.git"
revision: ""
path: ""
- id: "Conan::zlib:1.2.11"
Expand All @@ -195,12 +195,12 @@ packages:
value: ""
algorithm: ""
vcs:
type: "Git"
url: "https://github.com/conan-io/conan-center-index"
type: ""
url: ""
revision: ""
path: ""
vcs_processed:
type: "Git"
url: "https://github.com/conan-io/conan-center-index.git"
type: ""
url: ""
revision: ""
path: ""
11 changes: 7 additions & 4 deletions analyzer/src/main/kotlin/managers/Conan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,20 @@ class Conan(
/**
* Return the [Package] parsed from the given [node].
*/
private fun parsePackage(node: JsonNode, workingDir: File) =
Package(
private fun parsePackage(node: JsonNode, workingDir: File): Package {
val homepageUrl = node["homepage"].textValueOrEmpty()

return Package(
id = parsePackageId(node, workingDir),
authors = parseAuthors(node),
declaredLicenses = parseDeclaredLicenses(node),
description = parsePackageField(node, workingDir, "description"),
homepageUrl = node["homepage"].textValueOrEmpty(),
homepageUrl = homepageUrl,
binaryArtifact = RemoteArtifact.EMPTY, // TODO: implement me!
sourceArtifact = RemoteArtifact.EMPTY, // TODO: implement me!
vcs = parseVcsInfo(node)
vcs = processPackageVcs(VcsInfo.EMPTY, homepageUrl)
)
}

/**
* Return the value `conan inspect` reports for the given [field].
Expand Down

0 comments on commit 9af7b89

Please sign in to comment.