remove "package-of" relationship (in favor of "contains")

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman 2021-11-17 14:49:05 -05:00
parent d52894ce86
commit d20f1010db
No known key found for this signature in database
GPG Key ID: 5CB45AE22BAB7EA7
3 changed files with 8 additions and 9 deletions

View File

@ -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)
} }

View File

@ -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

View File

@ -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,
}) })
} }
} }