mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 07:56:36 +01:00
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
/*
|
|
Package apkdb provides a concrete Cataloger implementation for Alpine DB files.
|
|
*/
|
|
package apkdb
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/anchore/stereoscope/pkg/file"
|
|
"github.com/anchore/syft/syft/cataloger/common"
|
|
"github.com/anchore/syft/syft/pkg"
|
|
"github.com/anchore/syft/syft/scope"
|
|
)
|
|
|
|
// Cataloger catalogs pkg.ApkPkg Package Types defined in Alpine DB files.
|
|
type Cataloger struct {
|
|
cataloger common.GenericCataloger
|
|
}
|
|
|
|
// New returns a new Alpine DB cataloger object.
|
|
func New() *Cataloger {
|
|
globParsers := map[string]common.ParserFn{
|
|
"**/lib/apk/db/installed": parseApkDB,
|
|
}
|
|
|
|
return &Cataloger{
|
|
cataloger: common.NewGenericCataloger(nil, globParsers),
|
|
}
|
|
}
|
|
|
|
// Name returns a string that uniquely describes this cataloger.
|
|
func (c *Cataloger) Name() string {
|
|
return "apkdb-cataloger"
|
|
}
|
|
|
|
// SelectFiles returns a set of discovered Alpine DB files from the user content source.
|
|
func (c *Cataloger) SelectFiles(resolver scope.FileResolver) []file.Reference {
|
|
return c.cataloger.SelectFiles(resolver)
|
|
}
|
|
|
|
// Catalog returns the Packages indexed from all Alpine DB files discovered.
|
|
func (c *Cataloger) Catalog(contents map[file.Reference]io.Reader) ([]pkg.Package, error) {
|
|
return c.cataloger.Catalog(contents)
|
|
}
|