Skip to content

Commit

Permalink
Adds noAsseration to license data
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Ramirez-Villarreal <[email protected]>
  • Loading branch information
corvramirez committed Jun 11, 2021
1 parent d3ef498 commit 629f432
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions internal/format/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ func (f *Format) Render() error {
func generatePackage(file *os.File, pkg models.Package) {
file.WriteString(fmt.Sprintf("PackageName: %s\n", pkg.PackageName))
file.WriteString(fmt.Sprintf("SPDXID: %s\n", pkg.SPDXID))
file.WriteString(fmt.Sprintf("PackageVersion: %s\n", pkg.PackageVersion))
if pkg.PackageVersion != "" {
file.WriteString(fmt.Sprintf("PackageVersion: %s\n", pkg.PackageVersion))
}

file.WriteString(fmt.Sprintf("PackageSupplier: %s\n", pkg.PackageSupplier))
file.WriteString(fmt.Sprintf("PackageDownloadLocation: %s\n", pkg.PackageDownloadLocation))
file.WriteString(fmt.Sprintf("FilesAnalyzed: %v\n", pkg.FilesAnalyzed))
Expand Down Expand Up @@ -181,9 +184,9 @@ func (f *Format) convertToPackage(module models.Module) (models.Package, error)
FilesAnalyzed: false,
PackageChecksum: module.CheckSum.String(),
PackageHomePage: buildHomepageURL(module.PackageURL),
PackageLicenseConcluded: setPkgValue(module.LicenseConcluded),
PackageLicenseDeclared: setPkgValue(module.LicenseDeclared),
PackageCopyrightText: setPkgValue(module.Copyright),
PackageLicenseConcluded: noAssertion, // setPkgValue(module.LicenseConcluded),
PackageLicenseDeclared: noAssertion, // setPkgValue(module.LicenseDeclared),
PackageCopyrightText: noAssertion, // setPkgValue(module.Copyright),
PackageLicenseComments: setPkgValue(""),
PackageComment: setPkgValue(""),
RootPackage: module.Root,
Expand Down Expand Up @@ -225,17 +228,21 @@ func buildVersion(module models.Module) string {
if module.Version != "" {
return module.Version
}

if !module.Root {
return module.Version
}

localGit, err := git.PlainOpen(module.LocalPath)
if err != nil {
return ""
}

head, err := localGit.Head()
if err != nil {
return ""
}

return head.Hash().String()[0:7]
}

Expand Down

0 comments on commit 629f432

Please sign in to comment.