mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 07:56:36 +01:00
Add source-distribution external reference to components
Signed-off-by: swadaptive <268603322+swadaptive@users.noreply.github.com>
This commit is contained in:
@@ -47,6 +47,14 @@ func EncodeComponent(p pkg.Package, supplier string, locationSorter func(a, b fi
|
|||||||
componentType = cyclonedx.ComponentTypeMachineLearningModel
|
componentType = cyclonedx.ComponentTypeMachineLearningModel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
externalRefs := encodeExternalReferences(p)
|
||||||
|
if srcRef := encodeSourcePackageExternalReference(p); srcRef != nil {
|
||||||
|
if externalRefs == nil {
|
||||||
|
externalRefs = &[]cyclonedx.ExternalReference{}
|
||||||
|
}
|
||||||
|
*externalRefs = append(*externalRefs, *srcRef)
|
||||||
|
}
|
||||||
|
|
||||||
return cyclonedx.Component{
|
return cyclonedx.Component{
|
||||||
Type: componentType,
|
Type: componentType,
|
||||||
Name: p.Name,
|
Name: p.Name,
|
||||||
@@ -59,7 +67,7 @@ func EncodeComponent(p pkg.Package, supplier string, locationSorter func(a, b fi
|
|||||||
Author: encodeAuthor(p),
|
Author: encodeAuthor(p),
|
||||||
Publisher: encodePublisher(p),
|
Publisher: encodePublisher(p),
|
||||||
Description: encodeDescription(p),
|
Description: encodeDescription(p),
|
||||||
ExternalReferences: encodeExternalReferences(p),
|
ExternalReferences: externalRefs,
|
||||||
Properties: properties,
|
Properties: properties,
|
||||||
BOMRef: DeriveBomRef(p),
|
BOMRef: DeriveBomRef(p),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ func encodeExternalReferences(p pkg.Package) *[]cyclonedx.ExternalReference {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(refs) > 0 {
|
if len(refs) > 0 {
|
||||||
return &refs
|
return &refs
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user