feat: binary classifier for GCC (#2479)

Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
This commit is contained in:
Laurent Goderre 2024-01-10 10:50:38 -05:00 committed by GitHub
parent 85cc64f7e3
commit e61aac0b53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 0 deletions

View File

@ -805,6 +805,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("openssl-binary"),
},
},
{
logicalFixture: "gcc/12.3.0/linux-amd64",
expected: pkg.Package{
Name: "gcc",
Version: "12.3.0",
Type: "binary",
PURL: "pkg:generic/gcc@12.3.0",
Locations: locations("gcc"),
Metadata: metadata("gcc-binary"),
},
},
}
for _, test := range tests {

View File

@ -350,6 +350,17 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/openssl@version"),
CPEs: singleCPE("cpe:2.3:a:openssl:openssl:*:*:*:*:*:*:*:*"),
},
{
Class: "gcc-binary",
FileGlob: "**/gcc",
EvidenceMatcher: FileContentsVersionMatcher(
// GCC: \(GNU\) 12.3.0'
`GCC: \(GNU\) (?P<version>[0-9]+\.[0-9]+\.[0-9]+)`,
),
Package: "gcc",
PURL: mustPURL("pkg:generic/gcc@version"),
CPEs: singleCPE("cpe:2.3:a:gnu:gcc:*:*:*:*:*:*:*:*"),
},
}
}

View File

@ -24,6 +24,13 @@ from-images:
paths:
- /usr/local/bin/bash
- version: 12.3.0
images:
- ref: gcc:12.3.0-bookworm@sha256:2e3c00752fa23a0993b6618760bbc20263b272a0b34b2d4883159e3ebba9d8b6
platform: linux/amd64
paths:
- /usr/local/bin/gcc
- version: 25.3.2.6
images:
- ref: erlang:25.3.2.6@sha256:0d1e530ec0e8047094f0a1d841754515bad9b0554260a3147fb34df31b3064fe