Skip to content

Commit

Permalink
Update nix def for the latest syft definition
Browse files Browse the repository at this point in the history
  • Loading branch information
juliosueiras committed Jul 21, 2022
1 parent e7e50a7 commit 7952dc9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions syft/pkg/cataloger/nixstore/cataloger.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (c *Cataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, []arti
p.Name = name
p.Version = version
p.FoundBy = c.Name()
p.Locations = []source.Location{storeLocation}
p.Locations = source.NewLocationSet(storeLocation)
p.SetID()

log.Debug(p)
Expand All @@ -51,7 +51,7 @@ func (c *Cataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, []arti

} else {
nixLookupPkg := nixLookupPkg.(pkg.Package)
nixLookupPkg.Locations = append(nixLookupPkg.Locations, storeLocation)
nixLookupPkg.Locations = source.NewLocationSet(append(nixLookupPkg.Locations.ToSlice(), storeLocation)...)
pkgMap[fmt.Sprintf("%s-%s", name, version)] = nixLookupPkg
}
}
Expand Down
6 changes: 3 additions & 3 deletions syft/pkg/nix_store_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package pkg

import (
"github.com/anchore/packageurl-go"
"github.com/anchore/syft/syft/distro"
"github.com/anchore/syft/syft/linux"
)

const NixStoreGlob = "/nix/store/**"
Expand All @@ -15,15 +15,15 @@ type NixStoreMetadata struct {
SourceVersion string `mapstructure:"SourceVersion" json:"sourceVersion"`
}

func (m NixStoreMetadata) PackageURL(d *distro.Distro) string {
func (m NixStoreMetadata) PackageURL(d *linux.Release) string {
if d == nil {
return ""
}
pURL := packageurl.NewPackageURL(
// TODO: replace with `packageurl.TypeDebian` upon merge of https://github.com/package-url/packageurl-go/pull/21
// TODO: or, since we're now using an Anchore fork of this module, we could do this sooner.
"nix",
d.Type.String(),
"",
m.Package,
m.Version,
packageurl.Qualifiers{
Expand Down

0 comments on commit 7952dc9

Please sign in to comment.