-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to latest version of Component-Detection Libraries. (#436)
* Update to latest version of Component-Detection Libraries. * Fix formatting. * Remove accidental import. * Fix cd version. * Rename method and add xml doc. * Add Conan support. * Use same logger template for all logs. * Fix DirectoryExclusionList bug and remove pre-release spectre version * Ensure duplicates aren't passed to DirectoryExclusionList * Rename lst to checksums. --------- Co-authored-by: Sebastian Gomez <segomez@microsoft.com>
- Loading branch information
1 parent
7bb13d7
commit fe1e2e0
Showing
19 changed files
with
298 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/Microsoft.Sbom.Adapters/Adapters/ComponentDetection/ConanComponentExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.ComponentDetection.Contracts.TypedComponent; | ||
using Microsoft.Sbom.Contracts; | ||
|
||
namespace Microsoft.Sbom.Adapters.ComponentDetection; | ||
|
||
internal static class ConanComponentExtensions | ||
{ | ||
public static SbomPackage? ToSbomPackage(this ConanComponent conanComponent) | ||
{ | ||
var checksums = new List<Checksum>(); | ||
if (!string.IsNullOrEmpty(conanComponent.Md5Hash)) | ||
{ | ||
checksums.Add(new Checksum | ||
{ | ||
Algorithm = Contracts.Enums.AlgorithmName.MD5, | ||
ChecksumValue = conanComponent.Md5Hash | ||
}); | ||
} | ||
|
||
if (!string.IsNullOrEmpty(conanComponent.Sha1Hash)) | ||
{ | ||
checksums.Add(new Checksum | ||
{ | ||
Algorithm = Contracts.Enums.AlgorithmName.SHA1, | ||
ChecksumValue = conanComponent.Sha1Hash | ||
}); | ||
} | ||
|
||
return new() | ||
{ | ||
Id = conanComponent.Id, | ||
PackageUrl = conanComponent.PackageUrl?.ToString(), | ||
PackageName = conanComponent.Name, | ||
PackageVersion = conanComponent.Version, | ||
PackageSource = conanComponent.PackageSourceURL, | ||
FilesAnalyzed = false, | ||
Checksum = checksums, | ||
Type = "conan" | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Microsoft.Sbom.Api/Config/Extensions/ConfigurationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.