allow for RPM modularity to be optional (#2540)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman 2024-01-24 13:21:59 -05:00 committed by GitHub
parent ad2843bf50
commit bf3cd9ed3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 2174 additions and 20 deletions

View file

@ -3,5 +3,5 @@ package internal
const (
// JSONSchemaVersion is the current schema version output by the JSON encoder
// This is roughly following the "SchemaVer" guidelines for versioning the JSON schema. Please see schema/json/README.md for details on how to increment.
JSONSchemaVersion = "13.0.0"
JSONSchemaVersion = "14.0.0"
)

File diff suppressed because it is too large Load diff

View file

@ -66,7 +66,7 @@ func parseRpmDB(_ context.Context, resolver file.Resolver, env *generic.Environm
SourceRpm: entry.SourceRpm,
Vendor: entry.Vendor,
Size: entry.Size,
ModularityLabel: entry.Modularitylabel,
ModularityLabel: &entry.Modularitylabel,
Files: extractRpmFileRecords(resolver, *entry),
}

View file

@ -101,15 +101,16 @@ func TestParseRpmDB(t *testing.T) {
pkg.NewLicenseFromLocations("MIT", packagesLocation),
),
Metadata: pkg.RpmDBEntry{
Name: "dive",
Epoch: nil,
Arch: "x86_64",
Release: "1",
Version: "0.9.2",
SourceRpm: "dive-0.9.2-1.src.rpm",
Size: 12406784,
Vendor: "",
Files: []pkg.RpmFileRecord{},
Name: "dive",
Epoch: nil,
Arch: "x86_64",
Release: "1",
Version: "0.9.2",
SourceRpm: "dive-0.9.2-1.src.rpm",
Size: 12406784,
Vendor: "",
ModularityLabel: strRef(""),
Files: []pkg.RpmFileRecord{},
},
},
},
@ -129,14 +130,15 @@ func TestParseRpmDB(t *testing.T) {
pkg.NewLicenseFromLocations("MIT", packagesLocation),
),
Metadata: pkg.RpmDBEntry{
Name: "dive",
Epoch: nil,
Arch: "x86_64",
Release: "1",
Version: "0.9.2",
SourceRpm: "dive-0.9.2-1.src.rpm",
Size: 12406784,
Vendor: "",
Name: "dive",
Epoch: nil,
Arch: "x86_64",
Release: "1",
Version: "0.9.2",
SourceRpm: "dive-0.9.2-1.src.rpm",
Size: 12406784,
Vendor: "",
ModularityLabel: strRef(""),
Files: []pkg.RpmFileRecord{
{
Path: "/usr/local/bin/dive",
@ -213,3 +215,7 @@ func TestToElVersion(t *testing.T) {
func intRef(i int) *int {
return &i
}
func strRef(s string) *string {
return &s
}

View file

@ -34,7 +34,7 @@ type RpmDBEntry struct {
SourceRpm string `json:"sourceRpm" cyclonedx:"sourceRpm"`
Size int `json:"size" cyclonedx:"size"`
Vendor string `json:"vendor"`
ModularityLabel string `json:"modularityLabel"`
ModularityLabel *string `json:"modularityLabel,omitempty"`
Files []RpmFileRecord `json:"files"`
}