Add detection of Erlang in Alpine linux (#2996)

Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
This commit is contained in:
Laurent Goderre 2024-06-25 17:40:40 -04:00 committed by GitHub
parent 7da15890eb
commit ceced5eb27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 0 deletions

View File

@ -907,6 +907,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("erlang-library"), Metadata: metadata("erlang-library"),
}, },
}, },
{
logicalFixture: "erlang/27.0/linux-amd64",
expected: pkg.Package{
Name: "erlang",
Version: "27.0",
Type: "binary",
PURL: "pkg:generic/erlang@27.0",
Locations: locations("beam.smp"),
Metadata: metadata("erlang-alpine-binary"),
},
},
{ {
logicalFixture: "nginx/1.25.1/linux-amd64", logicalFixture: "nginx/1.25.1/linux-amd64",
expected: pkg.Package{ expected: pkg.Package{

View File

@ -393,6 +393,23 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/erlang@version"), PURL: mustPURL("pkg:generic/erlang@version"),
CPEs: singleCPE("cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*"), CPEs: singleCPE("cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*"),
}, },
{
Class: "erlang-alpine-binary",
FileGlob: "**/beam.smp",
EvidenceMatcher: evidenceMatchers(
FileContentsVersionMatcher(
// <artificial>[NUL]/usr/src/otp_src_25.3.2.6/erts/
`(?m)/src/otp_src_(?P<version>[0-9]+\.[0-9]+(\.[0-9]+){0,2}(-rc[0-9])?)/erts/`,
),
FileContentsVersionMatcher(
// <artificial>[NUL]/usr/local/src/otp-25.3.2.7/erts/
`(?m)/usr/local/src/otp-(?P<version>[0-9]+\.[0-9]+(\.[0-9]+){0,2}(-rc[0-9])?)/erts/`,
),
),
Package: "erlang",
PURL: mustPURL("pkg:generic/erlang@version"),
CPEs: singleCPE("cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*"),
},
{ {
Class: "erlang-library", Class: "erlang-library",
FileGlob: "**/liberts_internal.a", FileGlob: "**/liberts_internal.a",

View File

@ -63,6 +63,14 @@ from-images:
paths: paths:
- /usr/local/lib/erlang/erts-14.2.4/lib/internal/liberts_internal.a - /usr/local/lib/erlang/erts-14.2.4/lib/internal/liberts_internal.a
- name: erlang
version: 27.0
images:
- ref: erlang:27.0.0.0-alpine@sha256:82064a65eb1f9901a479d8ada5f622be3bfac8b474dfc876dc00c28fdef4b1b8
platform: linux/amd64
paths:
- /usr/local/lib/erlang/erts-15.0/bin/beam.smp
- version: 1.21.3 - version: 1.21.3
images: images:
- ref: golang:1.21.3@sha256:3ce8313c3513515040870c55e0c041a2b94f3576a58cfd3948633604214aa811 - ref: golang:1.21.3@sha256:3ce8313c3513515040870c55e0c041a2b94f3576a58cfd3948633604214aa811