mirror of
https://github.com/anchore/syft.git
synced 2026-05-20 12:15:27 +02:00
fix: improve haskell classifiers (#4793)
Signed-off-by: witchcraze <witchcraze@gmail.com>
This commit is contained in:
parent
66ba575ae2
commit
ff6c34de7e
@ -1364,6 +1364,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
|||||||
Metadata: metadata("deno-binary"),
|
Metadata: metadata("deno-binary"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
logicalFixture: "haskell-ghc/7.10.3/linux-amd64",
|
||||||
|
expected: pkg.Package{
|
||||||
|
Name: "haskell/ghc",
|
||||||
|
Version: "7.10.3",
|
||||||
|
Type: "binary",
|
||||||
|
PURL: "pkg:generic/haskell/ghc@7.10.3",
|
||||||
|
Locations: locations("ghc"),
|
||||||
|
Metadata: metadata("haskell-ghc-binary"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
logicalFixture: "haskell-ghc/8.10.4/linux-amd64",
|
||||||
|
expected: pkg.Package{
|
||||||
|
Name: "haskell/ghc",
|
||||||
|
Version: "8.10.4",
|
||||||
|
Type: "binary",
|
||||||
|
PURL: "pkg:generic/haskell/ghc@8.10.4",
|
||||||
|
Locations: locations("ghc"),
|
||||||
|
Metadata: metadata("haskell-ghc-binary"),
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
logicalFixture: "haskell-ghc/9.6.5/linux-amd64",
|
logicalFixture: "haskell-ghc/9.6.5/linux-amd64",
|
||||||
expected: pkg.Package{
|
expected: pkg.Package{
|
||||||
@ -1375,6 +1397,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
|||||||
Metadata: metadata("haskell-ghc-binary"),
|
Metadata: metadata("haskell-ghc-binary"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
logicalFixture: "haskell-cabal/1.22.6.0/linux-amd64",
|
||||||
|
expected: pkg.Package{
|
||||||
|
Name: "haskell/cabal",
|
||||||
|
Version: "1.22.6.0",
|
||||||
|
Type: "binary",
|
||||||
|
PURL: "pkg:generic/haskell/cabal@1.22.6.0",
|
||||||
|
Locations: locations("cabal"),
|
||||||
|
Metadata: metadata("haskell-cabal-binary"),
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
logicalFixture: "haskell-cabal/3.10.3.0/linux-amd64",
|
logicalFixture: "haskell-cabal/3.10.3.0/linux-amd64",
|
||||||
expected: pkg.Package{
|
expected: pkg.Package{
|
||||||
|
|||||||
@ -438,9 +438,16 @@ func DefaultClassifiers() []binutils.Classifier {
|
|||||||
{
|
{
|
||||||
Class: "haskell-ghc-binary",
|
Class: "haskell-ghc-binary",
|
||||||
FileGlob: "**/ghc*",
|
FileGlob: "**/ghc*",
|
||||||
EvidenceMatcher: m.FileContentsVersionMatcher(
|
EvidenceMatcher: binutils.MatchAny(
|
||||||
|
m.FileContentsVersionMatcher(
|
||||||
`(?m)\x00GHC (?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00`,
|
`(?m)\x00GHC (?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00`,
|
||||||
),
|
),
|
||||||
|
m.FileContentsVersionMatcher(
|
||||||
|
// [NUL]libHSghc-7.10.3-0AG9TOjDEtx4Ji3wSwHOBe-ghc7.10.3.so[NUL]
|
||||||
|
// [NUL]libHSghc-8.10.4-ghc8.10.4.so[NUL]
|
||||||
|
`\x00libHSghc\-(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\-([a-zA-Z0-9]+\-)?ghc[0-9]+\.[0-9]+\.[0-9]+\.so\x00`,
|
||||||
|
),
|
||||||
|
),
|
||||||
Package: "haskell/ghc",
|
Package: "haskell/ghc",
|
||||||
PURL: mustPURL("pkg:generic/haskell/ghc@version"),
|
PURL: mustPURL("pkg:generic/haskell/ghc@version"),
|
||||||
CPEs: singleCPE("cpe:2.3:a:haskell:ghc:*:*:*:*:*:*:*:*"),
|
CPEs: singleCPE("cpe:2.3:a:haskell:ghc:*:*:*:*:*:*:*:*"),
|
||||||
@ -448,9 +455,15 @@ func DefaultClassifiers() []binutils.Classifier {
|
|||||||
{
|
{
|
||||||
Class: "haskell-cabal-binary",
|
Class: "haskell-cabal-binary",
|
||||||
FileGlob: "**/cabal",
|
FileGlob: "**/cabal",
|
||||||
EvidenceMatcher: m.FileContentsVersionMatcher(
|
EvidenceMatcher: binutils.MatchAny(
|
||||||
|
m.FileContentsVersionMatcher(
|
||||||
`(?m)\x00Cabal-(?P<version>[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)-`,
|
`(?m)\x00Cabal-(?P<version>[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)-`,
|
||||||
),
|
),
|
||||||
|
m.FileContentsVersionMatcher(
|
||||||
|
// [NUL][NUL][NUL]/opt/cabal/1.22/lib/x86_64-linux-ghc-7.10.2/cabal-install-1.22.6.0-AfxbHivcmw40BMGrAXG3jJ[NUL][NUL][NUL]
|
||||||
|
`\x00.{0,50}cabal\-install\-(?P<version>[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)\-[a-zA-Z0-9]+\x00+`,
|
||||||
|
),
|
||||||
|
),
|
||||||
Package: "haskell/cabal",
|
Package: "haskell/cabal",
|
||||||
PURL: mustPURL("pkg:generic/haskell/cabal@version"),
|
PURL: mustPURL("pkg:generic/haskell/cabal@version"),
|
||||||
CPEs: singleCPE("cpe:2.3:a:haskell:cabal:*:*:*:*:*:*:*:*"),
|
CPEs: singleCPE("cpe:2.3:a:haskell:cabal:*:*:*:*:*:*:*:*"),
|
||||||
|
|||||||
BIN
syft/pkg/cataloger/binary/testdata/classifiers/snippets/haskell-cabal/1.22.6.0/linux-amd64/cabal
vendored
Normal file
BIN
syft/pkg/cataloger/binary/testdata/classifiers/snippets/haskell-cabal/1.22.6.0/linux-amd64/cabal
vendored
Normal file
Binary file not shown.
BIN
syft/pkg/cataloger/binary/testdata/classifiers/snippets/haskell-ghc/7.10.3/linux-amd64/ghc
vendored
Normal file
BIN
syft/pkg/cataloger/binary/testdata/classifiers/snippets/haskell-ghc/7.10.3/linux-amd64/ghc
vendored
Normal file
Binary file not shown.
BIN
syft/pkg/cataloger/binary/testdata/classifiers/snippets/haskell-ghc/8.10.4/linux-amd64/ghc
vendored
Normal file
BIN
syft/pkg/cataloger/binary/testdata/classifiers/snippets/haskell-ghc/8.10.4/linux-amd64/ghc
vendored
Normal file
Binary file not shown.
26
syft/pkg/cataloger/binary/testdata/config.yaml
vendored
26
syft/pkg/cataloger/binary/testdata/config.yaml
vendored
@ -147,6 +147,23 @@ from-images:
|
|||||||
paths:
|
paths:
|
||||||
- /usr/bin/deno
|
- /usr/bin/deno
|
||||||
|
|
||||||
|
# haskell:7.10.3 detail information is missing.
|
||||||
|
- name: haskell-ghc
|
||||||
|
version: 7.10.3
|
||||||
|
images:
|
||||||
|
- ref: haskell:7.10.3
|
||||||
|
platform: linux/amd64
|
||||||
|
paths:
|
||||||
|
- /opt/ghc/7.10.3/lib/ghc-7.10.3/bin/ghc
|
||||||
|
|
||||||
|
- name: haskell-ghc
|
||||||
|
version: 8.10.4
|
||||||
|
images:
|
||||||
|
- ref: haskell:8.10.4@sha256:30ecdaee0fd59cdcddf004a68c2d8995ba4212a64106abc3e411742c606e59ac
|
||||||
|
platform: linux/amd64
|
||||||
|
paths:
|
||||||
|
- /opt/ghc/8.10.4/lib/ghc-8.10.4/bin/ghc
|
||||||
|
|
||||||
- name: haskell-ghc
|
- name: haskell-ghc
|
||||||
version: 9.6.5
|
version: 9.6.5
|
||||||
images:
|
images:
|
||||||
@ -155,6 +172,15 @@ from-images:
|
|||||||
paths:
|
paths:
|
||||||
- /opt/ghc/9.6.5/lib/ghc-9.6.5/bin/ghc-9.6.5
|
- /opt/ghc/9.6.5/lib/ghc-9.6.5/bin/ghc-9.6.5
|
||||||
|
|
||||||
|
# haskell:7.10.3 detail information is missing.
|
||||||
|
- name: haskell-cabal
|
||||||
|
version: 1.22.6.0
|
||||||
|
images:
|
||||||
|
- ref: haskell:7.10.3
|
||||||
|
platform: linux/amd64
|
||||||
|
paths:
|
||||||
|
- /opt/cabal/1.22/bin/cabal
|
||||||
|
|
||||||
- name: haskell-cabal
|
- name: haskell-cabal
|
||||||
version: 3.10.3.0
|
version: 3.10.3.0
|
||||||
images:
|
images:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user