Skip to content

Fix ConanComponent.PackageURL #1414

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -29,7 +29,7 @@ public ConanComponent(string name, string version, string previous, string packa

public override ComponentType Type => ComponentType.Conan;

public override PackageURL PackageUrl => new PackageURL("conan", string.Empty, this.Name, this.Version, null, string.Empty);
public override PackageURL PackageUrl => new PackageURL("conan", null, this.Name, this.Version, null, null);

protected override string ComputeId() => $"{this.Name} {this.Version} - {this.Type}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,15 @@ public void CocoaPodNameShouldPurlWithCustomQualifier()

packageOne.PackageUrl.ToString().Should().Be("pkg:cocoapods/[email protected]?repository_url=https://custom_repo.example.com/path/to/repo/specs.git");
}

[TestMethod]
public void ConanShouldSupportPurl()
{
// https://github.com/package-url/purl-spec/blob/main/PURL-TYPES.rst#conan
var packageOne = new ConanComponent("openssl", "3.4.1", "afcaa66ae3020340af2d5641a475b5ae", "80626e45106f252f73093b8b9376039358185fb4");

packageOne.PackageUrl.Type.Should().Be("conan");
packageOne.PackageUrl.Name.Should().Be("openssl");
packageOne.PackageUrl.ToString().Should().Be("pkg:conan/[email protected]");
}
}