mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
* add dpkg evidence support Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * use path over filepath Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
30 lines
640 B
Go
30 lines
640 B
Go
package relationship
|
|
|
|
import (
|
|
"github.com/anchore/syft/syft/artifact"
|
|
"github.com/anchore/syft/syft/pkg"
|
|
)
|
|
|
|
func EvidentBy(catalog *pkg.Collection) []artifact.Relationship {
|
|
var edges []artifact.Relationship
|
|
for _, p := range catalog.Sorted() {
|
|
for _, l := range p.Locations.ToSlice() {
|
|
kind := pkg.SupportingEvidenceAnnotation
|
|
if v, exists := l.Annotations[pkg.EvidenceAnnotationKey]; exists {
|
|
kind = v
|
|
}
|
|
|
|
edges = append(edges, artifact.Relationship{
|
|
From: p,
|
|
To: l.Coordinates,
|
|
Type: artifact.EvidentByRelationship,
|
|
Data: map[string]string{
|
|
"kind": kind,
|
|
},
|
|
})
|
|
}
|
|
}
|
|
|
|
return edges
|
|
}
|