Skip to content

Commit

Permalink
fix: dart classifier for 2.x and ARM (#3475)
Browse files Browse the repository at this point in the history
Signed-off-by: witchcraze <[email protected]>
  • Loading branch information
witchcraze authored Nov 22, 2024
1 parent 21df387 commit 2118295
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
22 changes: 22 additions & 0 deletions syft/pkg/cataloger/binary/classifier_cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("swipl-binary"),
},
},
{
logicalFixture: "dart/2.12.4/linux-amd64",
expected: pkg.Package{
Name: "dart",
Version: "2.12.4",
Type: "binary",
PURL: "pkg:generic/[email protected]",
Locations: locations("dart"),
Metadata: metadata("dart-binary"),
},
},
{
logicalFixture: "dart/3.0.0/linux-arm",
expected: pkg.Package{
Name: "dart",
Version: "3.0.0",
Type: "binary",
PURL: "pkg:generic/[email protected]",
Locations: locations("dart"),
Metadata: metadata("dart-binary"),
},
},
{
logicalFixture: "dart/3.5.2/linux-amd64",
expected: pkg.Package{
Expand Down
6 changes: 5 additions & 1 deletion syft/pkg/cataloger/binary/classifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,11 @@ func DefaultClassifiers() []Classifier {
Class: "dart-binary",
FileGlob: "**/dart",
EvidenceMatcher: FileContentsVersionMatcher(
`(?m)Dart,GC"\x00(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+(\.[0-9]+)?\.beta)?) `,
// MathAtan[NUL]2.12.4 (stable)
// "%s"[NUL]3.0.0 (stable)
// Dart,GC"[NUL]3.5.2 (stable)
// Dart,GC"[NUL]3.6.0-216.1.beta (beta)
`(?m)\x00(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+(\.[0-9]+)?\.beta)?) `,
),
Package: "dart",
PURL: mustPURL("pkg:generic/dart@version"),
Expand Down
Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions syft/pkg/cataloger/binary/test-fixtures/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@ from-images:
paths:
- /usr/lib/swipl/bin/x86_64-linux/swipl

- version: 2.12.4
images:
- ref: dart:2.12.4-sdk@sha256:0da5d8c9727f5b90e585bcc55a078d981029f4e13044f206299e00f23993a4a8
platform: linux/amd64

paths:
- /usr/lib/dart/bin/dart

- version: 3.0.0
images:
- ref: dart:3.0.0-sdk@sha256:67708c6011199d59336bf6cd0f9e618e55dd3632c79a43375f5a082795f0b724
platform: linux/arm
paths:
- /usr/lib/dart/bin/dart

- version: 3.5.2
images:
- ref: dart:3.5.2@sha256:1fd62cb5036bdc42de89bdae747683277986639be9b0b0a0751d2c50bbd9441f
Expand Down

0 comments on commit 2118295

Please sign in to comment.