Skip to content

Commit

Permalink
🐛 Fix Rocky Linux PURLs
Browse files Browse the repository at this point in the history
Align the namespace with the OSV data.

'pkg:rpm/rockylinux/...' -> 'pkg:rpm/rocky-linux/...'

Signed-off-by: Christian Zunker <christian@mondoo.com>
  • Loading branch information
czunker committed Feb 21, 2025
1 parent 03ab221 commit 8a86b9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions providers/os/resources/purl/purl.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ func NewPackageURL(pf *inventory.Platform, t Type, name, version string, modifie
switch purlNamespace {
case "photon":
purlNamespace = "photon os"
case "rockylinux":
purlNamespace = "rocky-linux"
case "opensuse-leap":
purlNamespace = "opensuse"
case "opensuse-tumbleweed":
Expand Down
12 changes: 12 additions & 0 deletions providers/os/resources/purl/purl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,18 @@ func TestPackageURLString(t *testing.T) {
assert.Equal(t, expected, p.String())
})

t.Run("Rocky Linux package", func(t *testing.T) {
platform := &inventory.Platform{
Name: "rockylinux",
Arch: "x86_64",
Version: "8.6",
Labels: nil,
}
p := purl.NewPackageURL(platform, purl.TypeRPM, "testpkg", "1.0.0")
expected := "pkg:rpm/rocky-linux/testpkg@1.0.0?arch=x86_64"
assert.Equal(t, expected, p.String())
})

t.Run("openSUSE package", func(t *testing.T) {
platform := &inventory.Platform{
Name: "opensuse-leap",
Expand Down

0 comments on commit 8a86b9e

Please sign in to comment.