mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
* binary(pe): canonicalize Ghostscript CPE to artifex:ghostscript and add generic purl for PE (#4275)\n\n- Detect Ghostscript via PE version resources and set purl pkg:generic/ghostscript@<version>\n- Add PE-specific CPE candidates: vendor 'artifex', product 'ghostscript'\n- Add focused unit tests for purl and CPE generation Signed-off-by: kdt523 <krushna.datir231@vit.edu> * fix: gofmt formatting for static analysis pass (pe-ghostscript-cpe-purl-4275) Signed-off-by: kdt523 <krushna.datir231@vit.edu> --------- Signed-off-by: kdt523 <krushna.datir231@vit.edu>
25 lines
544 B
Go
25 lines
544 B
Go
package binary
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/anchore/syft/syft/file"
|
|
)
|
|
|
|
func TestGhostscriptPEGeneratesGenericPURL(t *testing.T) {
|
|
vr := map[string]string{
|
|
"CompanyName": "Artifex Software, Inc.",
|
|
"ProductName": "GPL Ghostscript",
|
|
"FileDescription": "Ghostscript Interpreter",
|
|
"ProductVersion": "9.54.0",
|
|
}
|
|
|
|
loc := file.NewLocation("/usr/bin/gswin64c.exe")
|
|
p := newPEPackage(vr, loc)
|
|
|
|
expected := "pkg:generic/ghostscript@9.54.0"
|
|
if p.PURL != expected {
|
|
t.Fatalf("expected purl %q, got %q", expected, p.PURL)
|
|
}
|
|
}
|