hide digests for rpm dirs

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman 2022-04-08 08:57:59 -04:00
parent e415bb21e7
commit 1c2254f5cf
No known key found for this signature in database
GPG key ID: 5CB45AE22BAB7EA7
2 changed files with 12 additions and 7 deletions

View file

@ -97,14 +97,19 @@ func extractRpmdbFileRecords(resolver source.FilePathResolver, entry *rpmdb.Pack
for _, record := range entry.Files {
// only persist RPMDB file records which exist in the image/directory, otherwise ignore them
if resolver.HasPath(record.Path) {
records = append(records, pkg.RpmdbFileRecord{
Path: record.Path,
Mode: pkg.RpmdbFileMode(record.Mode),
Size: int(record.Size),
Digest: file.Digest{
var digest *file.Digest
if record.Digest != "" {
digest = &file.Digest{
Value: record.Digest,
Algorithm: entry.DigestAlgorithm.String(),
},
}
}
records = append(records, pkg.RpmdbFileRecord{
Path: record.Path,
Mode: pkg.RpmdbFileMode(record.Mode),
Size: int(record.Size),
Digest: digest,
UserName: record.Username,
GroupName: record.Groupname,
Flags: record.Flags.String(),

View file

@ -37,7 +37,7 @@ type RpmdbFileRecord struct {
Path string `json:"path"`
Mode RpmdbFileMode `json:"mode"`
Size int `json:"size"`
Digest file.Digest `json:"digest"`
Digest *file.Digest `json:"digest,omitempty"`
UserName string `json:"userName"`
GroupName string `json:"groupName"`
Flags string `json:"flags"`