Skip to content

Commit

Permalink
Add support for the Mageia distro
Browse files Browse the repository at this point in the history
  • Loading branch information
dfandrich committed Feb 14, 2025
1 parent bb90ead commit 0e60449
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ For commercial support options with Syft or Grype, please [contact Anchore](http
- CBL-Mariner
- Debian
- Distroless
- Mageia
- Oracle Linux
- Red Hat (RHEL)
- Ubuntu
Expand Down
8 changes: 8 additions & 0 deletions grype/db/v5/namespace/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func TestIndex_NamespacesForDistro(t *testing.T) {
"wolfi:distro:wolfi:rolling",
"chainguard:distro:chainguard:rolling",
"archlinux:distro:archlinux:rolling",
"mageia:distro:mageia:9",
})

assert.NoError(t, err)
Expand Down Expand Up @@ -393,6 +394,13 @@ func TestIndex_NamespacesForDistro(t *testing.T) {
distro.NewNamespace("debian", osDistro.Debian, "unstable"),
},
},
{
name: "Mageia 9 matches mageia namespace",
distro: newDistro(t, osDistro.Mageia, "9", []string{}),
namespaces: []*distro.Namespace{
distro.NewNamespace("mageia", "mageia", "9"),
},
},
}

for _, test := range tests {
Expand Down
5 changes: 5 additions & 0 deletions grype/distro/distro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ func Test_NewDistroFromRelease_Coverage(t *testing.T) {
fixture: "test-fixtures/os/chainguard",
Type: Chainguard,
},
{
fixture: "test-fixtures/os/mageia",
Type: Mageia,
Version: "9.0.0",
},
}

observedDistros := stringutil.NewStringSet()
Expand Down
3 changes: 3 additions & 0 deletions grype/distro/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
Gentoo Type = "gentoo"
Wolfi Type = "wolfi"
Chainguard Type = "chainguard"
Mageia Type = "mageia"
)

// All contains all Linux distribution options
Expand All @@ -56,6 +57,7 @@ var All = []Type{
Gentoo,
Wolfi,
Chainguard,
Mageia,
}

// IDMapping connects a distro ID like "ubuntu" to a Distro type
Expand All @@ -82,6 +84,7 @@ var IDMapping = map[string]Type{
"gentoo": Gentoo,
"wolfi": Wolfi,
"chainguard": Chainguard,
"mageia": Mageia,
}

func TypeFromRelease(release linux.Release) Type {
Expand Down

0 comments on commit 0e60449

Please sign in to comment.