mirror of
https://github.com/anchore/syft.git
synced 2026-02-12 18:46:41 +01:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89b901b20b |
@ -84,13 +84,13 @@ func newMetadataFromManifestLine(entry string) (*pkg.RpmDBEntry, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// packageURL returns the PURL for the specific RHEL package (see https://github.com/package-url/purl-spec)
|
// packageURL returns the PURL for the specific RHEL or Hummingbird package (see https://github.com/package-url/purl-spec)
|
||||||
func packageURL(name, arch string, epoch *int, srpm string, version, release string, distro *linux.Release) string {
|
func packageURL(name, arch string, epoch *int, srpm string, version, release string, distro *linux.Release) string {
|
||||||
var namespace string
|
var namespace string
|
||||||
if distro != nil {
|
if distro != nil {
|
||||||
namespace = distro.ID
|
namespace = distro.ID
|
||||||
}
|
}
|
||||||
if namespace == "rhel" {
|
if namespace == "rhel" || namespace == "hummingbird" {
|
||||||
namespace = "redhat"
|
namespace = "redhat"
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(namespace, "opensuse") {
|
if strings.HasPrefix(namespace, "opensuse") {
|
||||||
|
|||||||
@ -55,6 +55,20 @@ func Test_packageURL(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expected: "pkg:rpm/p@v-r",
|
expected: "pkg:rpm/p@v-r",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "hummingbird distro maps to redhat namespace",
|
||||||
|
distro: &linux.Release{
|
||||||
|
ID: "hummingbird",
|
||||||
|
VersionID: "1.0",
|
||||||
|
},
|
||||||
|
metadata: pkg.RpmDBEntry{
|
||||||
|
Name: "p",
|
||||||
|
Version: "v",
|
||||||
|
Release: "r",
|
||||||
|
Epoch: nil,
|
||||||
|
},
|
||||||
|
expected: "pkg:rpm/redhat/p@v-r?distro=hummingbird-1.0",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "with upstream source rpm info",
|
name: "with upstream source rpm info",
|
||||||
distro: &linux.Release{
|
distro: &linux.Release{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user