lib: use scope instead of requiring images

Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
Alfredo Deza 2020-07-07 16:53:49 -04:00
parent d22c1d0838
commit 145bb95a2d

View File

@ -12,23 +12,19 @@ import (
"github.com/wagoodman/go-partybus" "github.com/wagoodman/go-partybus"
) )
func IdentifyDistro(img *image.Image) *distro.Distro { func IdentifyDistro(s scope.Scope) *distro.Distro {
return distro.Identify(img) return distro.Identify(s)
} }
func CatalogDir(d string, o scope.Option) (*pkg.Catalog, error) { func GetScopeFromDir(d string, o scope.Option) (scope.Scope, error) {
s, err := scope.NewDirScope(d, o) return scope.NewScopeFromDir(d, o)
if err != nil {
return nil, err
}
return cataloger.Catalog(s)
} }
func CatalogImg(img *image.Image, o scope.Option) (*pkg.Catalog, error) { func GetScopeFromImage(img *image.Image, o scope.Option) (scope.Scope, error) {
s, err := scope.NewImageScope(img, o) return scope.NewScopeFromImage(img, o)
if err != nil { }
return nil, err
} func Catalog(s scope.Scope) (*pkg.Catalog, error) {
return cataloger.Catalog(s) return cataloger.Catalog(s)
} }