| // SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
| |
| package core |
| |
| import "github.com/spdx/tools-golang/spdx/common" |
| |
| // Package is a Package section of an SPDX Document for version 2.2 of the spec. |
| type Package struct { |
| // CoreMetadata includes additional information to map back and forth |
| // to other SPDX types |
| CoreMetadata Metadata |
| |
| // NOT PART OF SPEC |
| // flag: does this "package" contain files that were in fact "unpackaged", |
| // e.g. included directly in the Document without being in a Package? |
| IsUnpackaged bool |
| |
| // 3.1: Package Name |
| // Cardinality: mandatory, one |
| PackageName string `json:"name"` |
| |
| // 3.2: Package SPDX Identifier: "SPDXRef-[idstring]" |
| // Cardinality: mandatory, one |
| PackageSPDXIdentifier common.ElementID `json:"SPDXID"` |
| |
| // 3.3: Package Version |
| // Cardinality: optional, one |
| PackageVersion string `json:"versionInfo,omitempty"` |
| |
| // 3.4: Package File Name |
| // Cardinality: optional, one |
| PackageFileName string `json:"packageFileName,omitempty"` |
| |
| // 3.5: Package Supplier: may have single result for either Person or Organization, |
| // or NOASSERTION |
| // Cardinality: optional, one |
| PackageSupplier *common.Supplier `json:"supplier,omitempty"` |
| |
| // 3.6: Package Originator: may have single result for either Person or Organization, |
| // or NOASSERTION |
| // Cardinality: optional, one |
| PackageOriginator *common.Originator `json:"originator,omitempty"` |
| |
| // 3.7: Package Download Location |
| // Cardinality: mandatory, one |
| PackageDownloadLocation string `json:"downloadLocation"` |
| |
| // 3.8: FilesAnalyzed |
| // Cardinality: optional, one; default value is "true" if omitted |
| FilesAnalyzed bool `json:"filesAnalyzed,omitempty"` |
| // NOT PART OF SPEC: did FilesAnalyzed tag appear? |
| IsFilesAnalyzedTagPresent bool |
| |
| // 3.9: Package Verification Code |
| PackageVerificationCode common.PackageVerificationCode `json:"packageVerificationCode"` |
| |
| // 3.10: Package Checksum: may have keys for SHA1, SHA256 and/or MD5 |
| // Cardinality: optional, one or many |
| PackageChecksums []common.Checksum `json:"checksums"` |
| |
| // 3.11: Package Home Page |
| // Cardinality: optional, one |
| PackageHomePage string `json:"homepage,omitempty"` |
| |
| // 3.12: Source Information |
| // Cardinality: optional, one |
| PackageSourceInfo string `json:"sourceInfo,omitempty"` |
| |
| // 3.13: Concluded License: SPDX License Expression, "NONE" or "NOASSERTION" |
| // Cardinality: mandatory, one |
| PackageLicenseConcluded string `json:"licenseConcluded"` |
| |
| // 3.14: All Licenses Info from Files: SPDX License Expression, "NONE" or "NOASSERTION" |
| // Cardinality: mandatory, one or many if filesAnalyzed is true / omitted; |
| // zero (must be omitted) if filesAnalyzed is false |
| PackageLicenseInfoFromFiles []string `json:"licenseInfoFromFiles"` |
| |
| // 3.15: Declared License: SPDX License Expression, "NONE" or "NOASSERTION" |
| // Cardinality: mandatory, one |
| PackageLicenseDeclared string `json:"licenseDeclared"` |
| |
| // 3.16: Comments on License |
| // Cardinality: optional, one |
| PackageLicenseComments string `json:"licenseComments,omitempty"` |
| |
| // 3.17: Copyright Text: copyright notice(s) text, "NONE" or "NOASSERTION" |
| // Cardinality: mandatory, one |
| PackageCopyrightText string `json:"copyrightText"` |
| |
| // 3.18: Package Summary Description |
| // Cardinality: optional, one |
| PackageSummary string `json:"summary,omitempty"` |
| |
| // 3.19: Package Detailed Description |
| // Cardinality: optional, one |
| PackageDescription string `json:"description,omitempty"` |
| |
| // 3.20: Package Comment |
| // Cardinality: optional, one |
| PackageComment string `json:"comment,omitempty"` |
| |
| // 3.21: Package External Reference |
| // Cardinality: optional, one or many |
| PackageExternalReferences []*PackageExternalReference `json:"externalRefs,omitempty"` |
| |
| // 3.22: Package External Reference Comment |
| // Cardinality: conditional (optional, one) for each External Reference |
| // contained within PackageExternalReference2_1 struct, if present |
| |
| // 3.23: Package Attribution Text |
| // Cardinality: optional, one or many |
| PackageAttributionTexts []string `json:"attributionTexts,omitempty"` |
| |
| // Files contained in this Package |
| Files []*File |
| |
| Annotations []Annotation `json:"annotations"` |
| } |
| |
| // PackageExternalReference is an External Reference to additional info |
| // about a Package, as defined in section 3.21 in version 2.2 of the spec. |
| type PackageExternalReference struct { |
| CoreMetadata Metadata |
| |
| // category is "SECURITY", "PACKAGE-MANAGER" or "OTHER" |
| Category string `json:"referenceCategory"` |
| |
| // type is an [idstring] as defined in Appendix VI; |
| // called RefType here due to "type" being a Golang keyword |
| RefType string `json:"referenceType"` |
| |
| // locator is a unique string to access the package-specific |
| // info, metadata or content within the target location |
| Locator string `json:"referenceLocator"` |
| |
| // 3.22: Package External Reference Comment |
| // Cardinality: conditional (optional, one) for each External Reference |
| ExternalRefComment string `json:"comment"` |
| } |