mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 17:03:17 +01:00
remove "package-of" relationship (in favor of "contains")
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
parent
d52894ce86
commit
d20f1010db
@ -129,7 +129,7 @@ func toPackages(catalog *pkg.Catalog, relationships []artifact.Relationship) []m
|
|||||||
|
|
||||||
func fileIDsForPackage(packageSpdxID string, relationships []artifact.Relationship) (fileIDs []string) {
|
func fileIDsForPackage(packageSpdxID string, relationships []artifact.Relationship) (fileIDs []string) {
|
||||||
for _, relationship := range relationships {
|
for _, relationship := range relationships {
|
||||||
if relationship.Type != artifact.PackageOfRelationship {
|
if relationship.Type != artifact.ContainsRelationship {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,8 +252,8 @@ func toRelationships(relationships []artifact.Relationship) (result []model.Rela
|
|||||||
|
|
||||||
func lookupRelationship(ty artifact.RelationshipType) (bool, model.RelationshipType, string) {
|
func lookupRelationship(ty artifact.RelationshipType) (bool, model.RelationshipType, string) {
|
||||||
switch ty {
|
switch ty {
|
||||||
case artifact.PackageOfRelationship:
|
case artifact.ContainsRelationship:
|
||||||
return true, model.PackageOfRelationship, ""
|
return true, model.ContainsRelationship, ""
|
||||||
case artifact.OwnershipByFileOverlapRelationship:
|
case artifact.OwnershipByFileOverlapRelationship:
|
||||||
return true, model.OtherRelationship, fmt.Sprintf("%s: indicates that the parent package claims ownership of a child package since the parent metadata indicates overlap with a location that a cataloger found the child package by", ty)
|
return true, model.OtherRelationship, fmt.Sprintf("%s: indicates that the parent package claims ownership of a child package since the parent metadata indicates overlap with a location that a cataloger found the child package by", ty)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,9 +7,8 @@ const (
|
|||||||
// has been completed.
|
// has been completed.
|
||||||
OwnershipByFileOverlapRelationship RelationshipType = "ownership-by-file-overlap"
|
OwnershipByFileOverlapRelationship RelationshipType = "ownership-by-file-overlap"
|
||||||
|
|
||||||
// PackageOfRelationship (supports any-to-package linkages) is a proxy for the SPDX 2.2 PACKAGE_OF
|
// ContainsRelationship (supports any-to-any linkages) is a proxy for the SPDX 2.2 CONTAINS relationship.
|
||||||
// relationship which is defined as: "to be used when artifact X is used as a package as part of package Y"
|
ContainsRelationship RelationshipType = "contains"
|
||||||
PackageOfRelationship RelationshipType = "package-of"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type RelationshipType string
|
type RelationshipType string
|
||||||
|
|||||||
@ -119,9 +119,9 @@ func packageFileOwnershipRelationships(p pkg.Package, resolver source.FilePathRe
|
|||||||
|
|
||||||
for _, l := range locations {
|
for _, l := range locations {
|
||||||
relationships = append(relationships, artifact.Relationship{
|
relationships = append(relationships, artifact.Relationship{
|
||||||
From: l.Coordinates,
|
From: p,
|
||||||
To: p,
|
To: l.Coordinates,
|
||||||
Type: artifact.PackageOfRelationship,
|
Type: artifact.ContainsRelationship,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user