Skip to content

Commit

Permalink
fix(redhat): include arch in PURL qualifiers
Browse files Browse the repository at this point in the history
Signed-off-by: knqyf263 <[email protected]>
  • Loading branch information
knqyf263 committed Oct 4, 2024
1 parent 2c87f0c commit f7ecbae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/fanal/analyzer/pkg/rpm/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,13 @@ func (a *rpmArchiveAnalyzer) generatePURL(pkg *types.Package) *packageurl.Packag
case strings.Contains(vendor, "suse"):
ns = "suse"
}
return packageurl.NewPackageURL(packageurl.TypeRPM, ns, pkg.Name, utils.FormatVersion(*pkg), nil, "")
return packageurl.NewPackageURL(packageurl.TypeRPM, ns, pkg.Name, utils.FormatVersion(*pkg),
packageurl.Qualifiers{
{
Key: "arch",
Value: pkg.Arch,
},
}, "")
}

func (a *rpmArchiveAnalyzer) unexpectedError(err error) error {
Expand Down
6 changes: 6 additions & 0 deletions pkg/fanal/analyzer/pkg/rpm/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ func Test_rpmArchiveAnalyzer_Analyze(t *testing.T) {
Namespace: "redhat",
Name: "socat",
Version: "1.7.3.2-2.el7",
Qualifiers: packageurl.Qualifiers{
{
Key: "arch",
Value: "x86_64",
},
},
},
},
},
Expand Down

0 comments on commit f7ecbae

Please sign in to comment.