syft/syft/pkg/cataloger/debian/cataloger.go
Keith Zantow 7c644ea3d1
chore: update tests & naming conventions
Signed-off-by: Keith Zantow <kzantow@gmail.com>
2025-10-23 14:14:23 -04:00

36 lines
1.6 KiB
Go

/*
Package debian provides a concrete Cataloger implementation relating to packages within the Debian linux distribution.
*/
package debian
import (
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger/generic"
"github.com/anchore/syft/syft/pkg/cataloger/internal/dependency"
)
// NewDBCataloger returns a new Deb package cataloger capable of parsing DPKG status DB flat-file stores.
func NewDBCataloger() pkg.Cataloger {
return NewDpkgDBCataloger(DefaultCatalogerConfig())
}
// NewDpkgDBCataloger returns a new Deb package cataloger capable of parsing DPKG status DB flat-file stores with syft configuration.
func NewDpkgDBCataloger(cfg CatalogerConfig) pkg.Cataloger {
return generic.NewCataloger("dpkg-db-cataloger").
// note: these globs have been intentionally split up in order to improve search performance,
// please do NOT combine into: "**/var/lib/dpkg/{status,status.d/*}"
WithParserByGlobs(parseDpkgDB(cfg), "**/lib/dpkg/status", "**/lib/dpkg/status.d/*", "**/lib/opkg/info/*.control", "**/lib/opkg/status").
WithProcessors(dependency.Processor(dbEntryDependencySpecifier))
}
// NewArchiveCataloger returns a new Debian package cataloger object capable of parsing .deb archive files
func NewArchiveCataloger() pkg.Cataloger {
return NewDpkgDBCataloger(DefaultCatalogerConfig())
}
// NewDpkgArchiveCataloger returns a new Debian package cataloger object capable of parsing .deb archive files with syft configuration.
func NewDpkgArchiveCataloger(cfg CatalogerConfig) pkg.Cataloger {
return generic.NewCataloger("deb-archive-cataloger").
WithParserByGlobs(parseDebArchive(cfg), "**/*.deb")
}