aboutsummaryrefslogtreecommitdiff
path: root/spdx
diff options
context:
space:
mode:
authorSteve Winslow <steve@swinslow.net>2020-06-07 13:37:16 -0400
committerSteve Winslow <steve@swinslow.net>2020-06-07 13:37:16 -0400
commitfcf840b61558d5a35bf8194602b07c468daeb6eb (patch)
treec82578c1b438333280acfe12b8c3ade021681b65 /spdx
parentb6365e345b8f84f32452886440321121dc0ff3fa (diff)
downloadspdx-tools-fcf840b61558d5a35bf8194602b07c468daeb6eb.tar.gz
Update 2.2 version of data structures
Signed-off-by: Steve Winslow <steve@swinslow.net>
Diffstat (limited to 'spdx')
-rw-r--r--spdx/annotation.go26
-rw-r--r--spdx/file.go90
-rw-r--r--spdx/other_license.go29
-rw-r--r--spdx/package.go2
-rw-r--r--spdx/relationship.go18
-rw-r--r--spdx/review.go22
-rw-r--r--spdx/snippet.go50
7 files changed, 236 insertions, 1 deletions
diff --git a/spdx/annotation.go b/spdx/annotation.go
index 9687a28..ede9c8a 100644
--- a/spdx/annotation.go
+++ b/spdx/annotation.go
@@ -27,3 +27,29 @@ type Annotation2_1 struct {
// Cardinality: conditional (mandatory, one) if there is an Annotation
AnnotationComment string
}
+
+// Annotation2_2 is an Annotation section of an SPDX Document for version 2.2 of the spec.
+type Annotation2_2 struct {
+
+ // 8.1: Annotator
+ // Cardinality: conditional (mandatory, one) if there is an Annotation
+ Annotator string
+ // including AnnotatorType: one of "Person", "Organization" or "Tool"
+ AnnotatorType string
+
+ // 8.2: Annotation Date: YYYY-MM-DDThh:mm:ssZ
+ // Cardinality: conditional (mandatory, one) if there is an Annotation
+ AnnotationDate string
+
+ // 8.3: Annotation Type: "REVIEW" or "OTHER"
+ // Cardinality: conditional (mandatory, one) if there is an Annotation
+ AnnotationType string
+
+ // 8.4: SPDX Identifier Reference
+ // Cardinality: conditional (mandatory, one) if there is an Annotation
+ AnnotationSPDXIdentifier DocElementID
+
+ // 8.5: Annotation Comment
+ // Cardinality: conditional (mandatory, one) if there is an Annotation
+ AnnotationComment string
+}
diff --git a/spdx/file.go b/spdx/file.go
index f7c1b42..a324fdb 100644
--- a/spdx/file.go
+++ b/spdx/file.go
@@ -87,3 +87,93 @@ type ArtifactOfProject2_1 struct {
// Cardinality: optional, one per AOP
URI string
}
+
+// File2_2 is a File section of an SPDX Document for version 2.2 of the spec.
+type File2_2 struct {
+
+ // 4.1: File Name
+ // Cardinality: mandatory, one
+ FileName string
+
+ // 4.2: File SPDX Identifier: "SPDXRef-[idstring]"
+ // Cardinality: mandatory, one
+ FileSPDXIdentifier ElementID
+
+ // 4.3: File Type
+ // Cardinality: optional, multiple
+ FileType []string
+
+ // 4.4: File Checksum: may have keys for SHA1, SHA256 and/or MD5
+ // Cardinality: mandatory, one SHA1, others may be optionally provided
+ FileChecksumSHA1 string
+ FileChecksumSHA256 string
+ FileChecksumMD5 string
+
+ // 4.5: Concluded License: SPDX License Expression, "NONE" or "NOASSERTION"
+ // Cardinality: mandatory, one
+ LicenseConcluded string
+
+ // 4.6: License Information in File: SPDX License Expression, "NONE" or "NOASSERTION"
+ // Cardinality: mandatory, one or many
+ LicenseInfoInFile []string
+
+ // 4.7: Comments on License
+ // Cardinality: optional, one
+ LicenseComments string
+
+ // 4.8: Copyright Text: copyright notice(s) text, "NONE" or "NOASSERTION"
+ // Cardinality: mandatory, one
+ FileCopyrightText string
+
+ // DEPRECATED in version 2.1 of spec
+ // 4.9-4.11: Artifact of Project variables (defined below)
+ // Cardinality: optional, one or many
+ ArtifactOfProjects []*ArtifactOfProject2_2
+
+ // 4.12: File Comment
+ // Cardinality: optional, one
+ FileComment string
+
+ // 4.13: File Notice
+ // Cardinality: optional, one
+ FileNotice string
+
+ // 4.14: File Contributor
+ // Cardinality: optional, one or many
+ FileContributor []string
+
+ // 4.15: File Attribution Text
+ // Cardinality: optional, one or many
+ FileAttributionText []string
+
+ // DEPRECATED in version 2.0 of spec
+ // 4.16: File Dependencies
+ // Cardinality: optional, one or many
+ FileDependencies []string
+
+ // Snippets contained in this File
+ // Note that Snippets could be defined in a different Document! However,
+ // the only ones that _THIS_ document can contain are this ones that are
+ // defined here -- so this should just be an ElementID.
+ Snippets map[ElementID]*Snippet2_2
+}
+
+// ArtifactOfProject2_2 is a DEPRECATED collection of data regarding
+// a Package, as defined in sections 4.9-4.11 in version 2.2 of the spec.
+type ArtifactOfProject2_2 struct {
+
+ // DEPRECATED in version 2.1 of spec
+ // 4.9: Artifact of Project Name
+ // Cardinality: conditional, required if present, one per AOP
+ Name string
+
+ // DEPRECATED in version 2.1 of spec
+ // 4.10: Artifact of Project Homepage: URL or "UNKNOWN"
+ // Cardinality: optional, one per AOP
+ HomePage string
+
+ // DEPRECATED in version 2.1 of spec
+ // 4.11: Artifact of Project Uniform Resource Identifier
+ // Cardinality: optional, one per AOP
+ URI string
+}
diff --git a/spdx/other_license.go b/spdx/other_license.go
index 8d15d7f..a509c47 100644
--- a/spdx/other_license.go
+++ b/spdx/other_license.go
@@ -30,3 +30,32 @@ type OtherLicense2_1 struct {
// Cardinality: optional, one
LicenseComment string
}
+
+// OtherLicense2_2 is an Other License Information section of an
+// SPDX Document for version 2.2 of the spec.
+type OtherLicense2_2 struct {
+
+ // 6.1: License Identifier: "LicenseRef-[idstring]"
+ // Cardinality: conditional (mandatory, one) if license is not
+ // on SPDX License List
+ LicenseIdentifier string
+
+ // 6.2: Extracted Text
+ // Cardinality: conditional (mandatory, one) if there is a
+ // License Identifier assigned
+ ExtractedText string
+
+ // 6.3: License Name: single line of text or "NOASSERTION"
+ // Cardinality: conditional (mandatory, one) if license is not
+ // on SPDX License List
+ LicenseName string
+
+ // 6.4: License Cross Reference
+ // Cardinality: conditional (optional, one or many) if license
+ // is not on SPDX License List
+ LicenseCrossReferences []string
+
+ // 6.5: License Comment
+ // Cardinality: optional, one
+ LicenseComment string
+}
diff --git a/spdx/package.go b/spdx/package.go
index dd793ab..d319608 100644
--- a/spdx/package.go
+++ b/spdx/package.go
@@ -247,7 +247,7 @@ type Package2_2 struct {
// 3.23: Package Attribution Text
// Cardinality: optional, one or many
- PackageAttributionText string
+ PackageAttributionText []string
// Files contained in this Package
Files []*File2_2
diff --git a/spdx/relationship.go b/spdx/relationship.go
index ef524a3..9e06838 100644
--- a/spdx/relationship.go
+++ b/spdx/relationship.go
@@ -19,3 +19,21 @@ type Relationship2_1 struct {
// Cardinality: optional, one
RelationshipComment string
}
+
+// Relationship2_2 is a Relationship section of an SPDX Document for
+// version 2.2 of the spec.
+type Relationship2_2 struct {
+
+ // 7.1: Relationship
+ // Cardinality: optional, one or more; one per Relationship2_2
+ // one mandatory for SPDX Document with multiple packages
+ // RefA and RefB are first and second item
+ // Relationship is type from 7.1.1
+ RefA DocElementID
+ RefB DocElementID
+ Relationship string
+
+ // 7.2: Relationship Comment
+ // Cardinality: optional, one
+ RelationshipComment string
+}
diff --git a/spdx/review.go b/spdx/review.go
index 36a6ea7..8ca6a77 100644
--- a/spdx/review.go
+++ b/spdx/review.go
@@ -23,3 +23,25 @@ type Review2_1 struct {
// Cardinality: optional, one
ReviewComment string
}
+
+// Review2_2 is a Review section of an SPDX Document for version 2.2 of the spec.
+// DEPRECATED in version 2.0 of spec; retained here for compatibility.
+type Review2_2 struct {
+
+ // DEPRECATED in version 2.0 of spec
+ // 9.1: Reviewer
+ // Cardinality: optional, one
+ Reviewer string
+ // including AnnotatorType: one of "Person", "Organization" or "Tool"
+ ReviewerType string
+
+ // DEPRECATED in version 2.0 of spec
+ // 9.2: Review Date: YYYY-MM-DDThh:mm:ssZ
+ // Cardinality: conditional (mandatory, one) if there is a Reviewer
+ ReviewDate string
+
+ // DEPRECATED in version 2.0 of spec
+ // 9.3: Review Comment
+ // Cardinality: optional, one
+ ReviewComment string
+}
diff --git a/spdx/snippet.go b/spdx/snippet.go
index 89680c5..6031b8a 100644
--- a/spdx/snippet.go
+++ b/spdx/snippet.go
@@ -47,3 +47,53 @@ type Snippet2_1 struct {
// Cardinality: optional, one
SnippetName string
}
+
+// Snippet2_2 is a Snippet section of an SPDX Document for version 2.2 of the spec.
+type Snippet2_2 struct {
+
+ // 5.1: Snippet SPDX Identifier: "SPDXRef-[idstring]"
+ // Cardinality: mandatory, one
+ SnippetSPDXIdentifier ElementID
+
+ // 5.2: Snippet from File SPDX Identifier
+ // Cardinality: mandatory, one
+ SnippetFromFileSPDXIdentifier DocElementID
+
+ // 5.3: Snippet Byte Range: [start byte]:[end byte]
+ // Cardinality: mandatory, one
+ SnippetByteRangeStart int
+ SnippetByteRangeEnd int
+
+ // 5.4: Snippet Line Range: [start line]:[end line]
+ // Cardinality: optional, one
+ SnippetLineRangeStart int
+ SnippetLineRangeEnd int
+
+ // 5.5: Snippet Concluded License: SPDX License Expression, "NONE" or "NOASSERTION"
+ // Cardinality: mandatory, one
+ SnippetLicenseConcluded string
+
+ // 5.6: License Information in Snippet: SPDX License Expression, "NONE" or "NOASSERTION"
+ // Cardinality: optional, one or many
+ LicenseInfoInSnippet []string
+
+ // 5.7: Snippet Comments on License
+ // Cardinality: optional, one
+ SnippetLicenseComments string
+
+ // 5.8: Snippet Copyright Text: copyright notice(s) text, "NONE" or "NOASSERTION"
+ // Cardinality: mandatory, one
+ SnippetCopyrightText string
+
+ // 5.9: Snippet Comment
+ // Cardinality: optional, one
+ SnippetComment string
+
+ // 5.10: Snippet Name
+ // Cardinality: optional, one
+ SnippetName string
+
+ // 5.11: Snippet Attribution Text
+ // Cardinality: optional, one or many
+ SnippetAttributionText []string
+}