Skip to content

Commit

Permalink
fix os handling when trivy sets pkgType on properties
Browse files Browse the repository at this point in the history
Signed-off-by: Marlon Pina Tojal <[email protected]>
  • Loading branch information
Marlon Pina Tojal committed May 17, 2024
1 parent 51108cf commit f254ebc
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,13 @@ public void analyze(final List<Component> components) {
srcVersion = property.getPropertyValue();
} else if (property.getPropertyName().equals("trivy:SrcRelease")) {
srcRelease = property.getPropertyValue();
} else if (property.getPropertyName().equals("trivy:PkgType")) {
pkgType = property.getPropertyValue();
String distro = component.getPurl().getQualifiers().get("distro");

if (distro != null) {
pkgType += "-" + distro;
}
}
}

Expand Down Expand Up @@ -292,6 +299,7 @@ public void analyze(final List<Component> components) {
pkgs.forEach((key, value) -> {
var info = new BlobInfo();
info.setPackageInfos(new PackageInfo[]{value});
LOGGER.debug("looking for os %s".formatted(key));
if (os.get(key) != null) {
info.setOS(os.get(key));
}
Expand Down

0 comments on commit f254ebc

Please sign in to comment.