github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/syft/pkg/cataloger/wordpress/package.go (about)

     1  package wordpress
     2  
     3  import (
     4  	"github.com/anchore/syft/syft/file"
     5  	"github.com/anchore/syft/syft/pkg"
     6  )
     7  
     8  func newWordpressPluginPackage(name, version string, m pluginData, location file.Location) pkg.Package {
     9  	meta := pkg.WordpressPluginEntry{
    10  		PluginInstallDirectory: m.PluginInstallDirectory,
    11  		Author:                 m.Author,
    12  		AuthorURI:              m.AuthorURI,
    13  	}
    14  
    15  	p := pkg.Package{
    16  		Name:      name,
    17  		Version:   version,
    18  		Locations: file.NewLocationSet(location.WithAnnotation(pkg.EvidenceAnnotationKey, pkg.PrimaryEvidenceAnnotation)),
    19  		Language:  pkg.PHP,
    20  		Type:      pkg.WordpressPluginPkg,
    21  		Metadata:  meta,
    22  	}
    23  
    24  	if len(m.Licenses) > 0 {
    25  		p.Licenses = pkg.NewLicenseSet(pkg.NewLicense(m.Licenses[0]))
    26  	}
    27  
    28  	p.SetID()
    29  
    30  	return p
    31  }