Skip to content

Commit

Permalink
Add files import from SPDX
Browse files Browse the repository at this point in the history
  • Loading branch information
jedevc committed Aug 19, 2022
1 parent 3ce5991 commit d221bdf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sbom.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Package struct {
DownloadURL string
HomepageURL string
License []string
Files []string

CPEs []string
}
Expand Down Expand Up @@ -113,6 +114,15 @@ func addSPDX(img *Image, doc *spdx.Document2_2) {
}

for _, p := range doc.Packages {
var files []string
for _, f := range p.Files {
if f == nil {
// HACK: the SPDX parser is broken with multiple files in hasFiles
continue
}
files = append(files, f.FileName)
}

pkg := Package{
Name: p.PackageName,
Version: p.PackageVersion,
Expand All @@ -121,6 +131,7 @@ func addSPDX(img *Image, doc *spdx.Document2_2) {
HomepageURL: p.PackageHomePage,
DownloadURL: p.PackageDownloadLocation,
License: strings.Split(p.PackageLicenseConcluded, " AND "),
Files: files,
}

typ := pkgTypeUnknown
Expand Down

0 comments on commit d221bdf

Please sign in to comment.