mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
allow ability to catalog packages from /var/lib/dpkg/status.d/
Some debian-based variants (such as Google's Distroless images) don't write a single file to `/var/lib/dpkg/status`, but rather write a file per package to `/var/lib/dpkg/status.d/` related to #44 Signed-off-by: Weston Steimel <weston.steimel@gmail.com>
This commit is contained in:
parent
40e9c4b146
commit
b963be219b
@ -38,6 +38,7 @@ func (c *Cataloger) Catalog(resolver source.Resolver) ([]pkg.Package, error) {
|
||||
return nil, fmt.Errorf("failed to find dpkg status files's by glob: %w", err)
|
||||
}
|
||||
|
||||
var results []pkg.Package
|
||||
var pkgs []pkg.Package
|
||||
for _, dbLocation := range dbFileMatches {
|
||||
dbContents, err := resolver.FileContentsByLocation(dbLocation)
|
||||
@ -94,8 +95,10 @@ func (c *Cataloger) Catalog(resolver source.Resolver) ([]pkg.Package, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
results = append(results, pkgs...)
|
||||
}
|
||||
return pkgs, nil
|
||||
return results, nil
|
||||
}
|
||||
|
||||
func fetchMd5Contents(resolver source.Resolver, dbLocation source.Location, pkgs []pkg.Package) (map[string]io.Reader, map[string]source.Location, error) {
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"github.com/scylladb/go-set/strset"
|
||||
)
|
||||
|
||||
const DpkgDbGlob = "**/var/lib/dpkg/status"
|
||||
const DpkgDbGlob = "**/var/lib/dpkg/{status,status.d/**}"
|
||||
|
||||
var _ fileOwner = (*DpkgMetadata)(nil)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user