github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/pkg/portage_metadata.go (about) 1 package pkg 2 3 import ( 4 "sort" 5 6 "github.com/scylladb/go-set/strset" 7 8 "github.com/anchore/syft/syft/file" 9 ) 10 11 var _ FileOwner = (*PortageMetadata)(nil) 12 13 // PortageMetadata represents all captured data for a Package package DB entry. 14 type PortageMetadata struct { 15 InstalledSize int `mapstructure:"InstalledSize" json:"installedSize" cyclonedx:"installedSize"` 16 Files []PortageFileRecord `json:"files"` 17 } 18 19 // PortageFileRecord represents a single file attributed to a portage package. 20 type PortageFileRecord struct { 21 Path string `json:"path"` 22 Digest *file.Digest `json:"digest,omitempty"` 23 } 24 25 func (m PortageMetadata) OwnedFiles() (result []string) { 26 s := strset.New() 27 for _, f := range m.Files { 28 if f.Path != "" { 29 s.Add(f.Path) 30 } 31 } 32 result = s.List() 33 sort.Strings(result) 34 return result 35 }