1// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 2 3package spdx_json 4 5import ( 6 "bytes" 7 "fmt" 8 "os" 9 "testing" 10 11 "github.com/google/go-cmp/cmp" 12 13 "github.com/spdx/tools-golang/spdx/common" 14 "github.com/spdx/tools-golang/spdx/v2_2" 15) 16 17func TestLoad2_2(t *testing.T) { 18 file, err := os.Open("../examples/sample-docs/json/SPDXJSONExample-v2.2.spdx.json") 19 if err != nil { 20 panic(fmt.Errorf("error opening File: %s", err)) 21 } 22 23 got, err := Load2_2(file) 24 if err != nil { 25 t.Errorf("json.parser.Load2_2() error = %v", err) 26 return 27 } 28 29 // get a copy of the handwritten struct so we don't mutate it on accident 30 handwrittenExample := want2_2 31 32 if cmp.Equal(handwrittenExample, got) { 33 t.Errorf("Got incorrect struct after parsing JSON example") 34 return 35 } 36} 37 38func TestWrite2_2(t *testing.T) { 39 w := &bytes.Buffer{} 40 // get a copy of the handwritten struct so we don't mutate it on accident 41 handwrittenExample := want2_2 42 if err := Save2_2(&handwrittenExample, w); err != nil { 43 t.Errorf("Save2_2() error = %v", err.Error()) 44 return 45 } 46 47 // we should be able to parse what the writer wrote, and it should be identical to the original struct we wrote 48 parsedDoc, err := Load2_2(bytes.NewReader(w.Bytes())) 49 if err != nil { 50 t.Errorf("failed to parse written document: %v", err.Error()) 51 return 52 } 53 54 if cmp.Equal(handwrittenExample, parsedDoc) { 55 t.Errorf("Got incorrect struct after writing and re-parsing JSON example") 56 return 57 } 58} 59 60// want is handwritten translation of the official example JSON SPDX v2.2 document into a Go struct. 61// We expect that the result of parsing the official document should be this value. 62// We expect that the result of writing this struct should match the official example document. 63var want2_2 = v2_2.Document{ 64 DataLicense: "CC0-1.0", 65 SPDXVersion: "SPDX-2.2", 66 SPDXIdentifier: "SPDXRef-DOCUMENT", 67 DocumentName: "SPDX-Tools-v2.0", 68 DocumentNamespace: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301", 69 CreationInfo: &v2_2.CreationInfo{ 70 LicenseListVersion: "3.9", 71 Creators: []common.Creator{ 72 {CreatorType: "Tool", Creator: "LicenseFind-1.0"}, 73 {CreatorType: "Organization", Creator: "ExampleCodeInspect ()"}, 74 {CreatorType: "Person", Creator: "Jane Doe ()"}, 75 }, 76 Created: "2010-01-29T18:30:22Z", 77 CreatorComment: "This package has been shipped in source and binary form.\nThe binaries were created with gcc 4.5.1 and expect to link to\ncompatible system run time libraries.", 78 }, 79 DocumentComment: "This document was created using SPDX 2.0 using licenses from the web site.", 80 ExternalDocumentReferences: []v2_2.ExternalDocumentRef{ 81 { 82 DocumentRefID: "DocumentRef-spdx-tool-1.2", 83 URI: "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", 84 Checksum: common.Checksum{ 85 Algorithm: common.SHA1, 86 Value: "d6a770ba38583ed4bb4525bd96e50461655d2759", 87 }, 88 }, 89 }, 90 OtherLicenses: []*v2_2.OtherLicense{ 91 { 92 LicenseIdentifier: "LicenseRef-1", 93 ExtractedText: "/*\n * (c) Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n * derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/", 94 }, 95 { 96 LicenseIdentifier: "LicenseRef-2", 97 ExtractedText: "This package includes the GRDDL parser developed by Hewlett Packard under the following license:\n� Copyright 2007 Hewlett-Packard Development Company, LP\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: \n\nRedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. \nRedistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. \nThe name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. \nTHIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", 98 }, 99 { 100 LicenseIdentifier: "LicenseRef-4", 101 ExtractedText: "/*\n * (c) Copyright 2009 University of Bristol\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n * derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/", 102 }, 103 { 104 LicenseIdentifier: "LicenseRef-Beerware-4.2", 105 ExtractedText: "\"THE BEER-WARE LICENSE\" (Revision 42):\[email protected] wrote this file. As long as you retain this notice you\ncan do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp", 106 LicenseComment: "The beerware license has a couple of other standard variants.", 107 LicenseName: "Beer-Ware License (Version 42)", 108 LicenseCrossReferences: []string{"http://people.freebsd.org/~phk/"}, 109 }, 110 { 111 LicenseIdentifier: "LicenseRef-3", 112 ExtractedText: "The CyberNeko Software License, Version 1.0\n\n \n(C) Copyright 2002-2005, Andy Clark. All rights reserved.\n \nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer. \n\n2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in\n the documentation and/or other materials provided with the\n distribution.\n\n3. The end-user documentation included with the redistribution,\n if any, must include the following acknowledgment: \n \"This product includes software developed by Andy Clark.\"\n Alternately, this acknowledgment may appear in the software itself,\n if and wherever such third-party acknowledgments normally appear.\n\n4. The names \"CyberNeko\" and \"NekoHTML\" must not be used to endorse\n or promote products derived from this software without prior \n written permission. For written permission, please contact \n [email protected].\n\n5. Products derived from this software may not be called \"CyberNeko\",\n nor may \"CyberNeko\" appear in their name, without prior written\n permission of the author.\n\nTHIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED\nWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS\nBE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, \nOR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT \nOF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR \nBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE \nOR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, \nEVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", 113 LicenseName: "CyberNeko License", 114 LicenseCrossReferences: []string{ 115 "http://people.apache.org/~andyc/neko/LICENSE", 116 "http://justasample.url.com", 117 }, 118 LicenseComment: "This is tye CyperNeko License", 119 }, 120 }, 121 Annotations: []*v2_2.Annotation{ 122 { 123 Annotator: common.Annotator{ 124 Annotator: "Jane Doe ()", 125 AnnotatorType: "Person", 126 }, 127 AnnotationDate: "2010-01-29T18:30:22Z", 128 AnnotationType: "OTHER", 129 AnnotationComment: "Document level annotation", 130 }, 131 { 132 Annotator: common.Annotator{ 133 Annotator: "Joe Reviewer", 134 AnnotatorType: "Person", 135 }, 136 AnnotationDate: "2010-02-10T00:00:00Z", 137 AnnotationType: "REVIEW", 138 AnnotationComment: "This is just an example. Some of the non-standard licenses look like they are actually BSD 3 clause licenses", 139 }, 140 { 141 Annotator: common.Annotator{ 142 Annotator: "Suzanne Reviewer", 143 AnnotatorType: "Person", 144 }, 145 AnnotationDate: "2011-03-13T00:00:00Z", 146 AnnotationType: "REVIEW", 147 AnnotationComment: "Another example reviewer.", 148 }, 149 }, 150 Packages: []*v2_2.Package{ 151 { 152 PackageName: "glibc", 153 PackageSPDXIdentifier: "SPDXRef-Package", 154 PackageVersion: "2.11.1", 155 PackageFileName: "glibc-2.11.1.tar.gz", 156 PackageSupplier: &common.Supplier{ 157 Supplier: "Jane Doe ([email protected])", 158 SupplierType: "Person", 159 }, 160 PackageOriginator: &common.Originator{ 161 Originator: "ExampleCodeInspect ([email protected])", 162 OriginatorType: "Organization", 163 }, 164 PackageDownloadLocation: "http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz", 165 FilesAnalyzed: true, 166 PackageVerificationCode: common.PackageVerificationCode{ 167 Value: "d6a770ba38583ed4bb4525bd96e50461655d2758", 168 ExcludedFiles: []string{"./package.spdx"}, 169 }, 170 PackageChecksums: []common.Checksum{ 171 { 172 Algorithm: "MD5", 173 Value: "624c1abb3664f4b35547e7c73864ad24", 174 }, 175 { 176 Algorithm: "SHA1", 177 Value: "85ed0817af83a24ad8da68c2b5094de69833983c", 178 }, 179 { 180 Algorithm: "SHA256", 181 Value: "11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd", 182 }, 183 }, 184 PackageHomePage: "http://ftp.gnu.org/gnu/glibc", 185 PackageSourceInfo: "uses glibc-2_11-branch from git://sourceware.org/git/glibc.git.", 186 PackageLicenseConcluded: "(LGPL-2.0-only OR LicenseRef-3)", 187 PackageLicenseInfoFromFiles: []string{ 188 "GPL-2.0-only", 189 "LicenseRef-2", 190 "LicenseRef-1", 191 }, 192 PackageLicenseDeclared: "(LGPL-2.0-only AND LicenseRef-3)", 193 PackageLicenseComments: "The license for this project changed with the release of version x.y. The version of the project included here post-dates the license change.", 194 PackageCopyrightText: "Copyright 2008-2010 John Smith", 195 PackageSummary: "GNU C library.", 196 PackageDescription: "The GNU C Library defines functions that are specified by the ISO C standard, as well as additional features specific to POSIX and other derivatives of the Unix operating system, and extensions specific to GNU systems.", 197 PackageComment: "", 198 PackageExternalReferences: []*v2_2.PackageExternalReference{ 199 { 200 Category: "SECURITY", 201 RefType: "cpe23Type", 202 Locator: "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*", 203 }, 204 { 205 Category: "OTHER", 206 RefType: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge", 207 Locator: "acmecorp/acmenator/4.1.3-alpha", 208 ExternalRefComment: "This is the external ref for Acme", 209 }, 210 }, 211 PackageAttributionTexts: []string{ 212 "The GNU C Library is free software. See the file COPYING.LIB for copying conditions, and LICENSES for notices about a few contributions that require these additional notices to be distributed. License copyright years may be listed using range notation, e.g., 1996-2015, indicating that every year in the range, inclusive, is a copyrightable year that would otherwise be listed individually.", 213 }, 214 Files: nil, 215 Annotations: []v2_2.Annotation{ 216 { 217 Annotator: common.Annotator{ 218 Annotator: "Package Commenter", 219 AnnotatorType: "Person", 220 }, 221 AnnotationDate: "2011-01-29T18:30:22Z", 222 AnnotationType: "OTHER", 223 AnnotationComment: "Package level annotation", 224 }, 225 }, 226 }, 227 { 228 PackageSPDXIdentifier: "SPDXRef-fromDoap-1", 229 PackageCopyrightText: "NOASSERTION", 230 PackageDownloadLocation: "NOASSERTION", 231 FilesAnalyzed: false, 232 PackageHomePage: "http://commons.apache.org/proper/commons-lang/", 233 PackageLicenseConcluded: "NOASSERTION", 234 PackageLicenseDeclared: "NOASSERTION", 235 PackageName: "Apache Commons Lang", 236 }, 237 { 238 PackageName: "Jena", 239 PackageSPDXIdentifier: "SPDXRef-fromDoap-0", 240 PackageCopyrightText: "NOASSERTION", 241 PackageDownloadLocation: "https://search.maven.org/remotecontent?filepath=org/apache/jena/apache-jena/3.12.0/apache-jena-3.12.0.tar.gz", 242 PackageExternalReferences: []*v2_2.PackageExternalReference{ 243 { 244 Category: "PACKAGE_MANAGER", 245 RefType: "purl", 246 Locator: "pkg:maven/org.apache.jena/apache-jena@3.12.0", 247 }, 248 }, 249 FilesAnalyzed: false, 250 PackageHomePage: "http://www.openjena.org/", 251 PackageLicenseConcluded: "NOASSERTION", 252 PackageLicenseDeclared: "NOASSERTION", 253 PackageVersion: "3.12.0", 254 }, 255 { 256 PackageSPDXIdentifier: "SPDXRef-Saxon", 257 PackageChecksums: []common.Checksum{ 258 { 259 Algorithm: "SHA1", 260 Value: "85ed0817af83a24ad8da68c2b5094de69833983c", 261 }, 262 }, 263 PackageCopyrightText: "Copyright Saxonica Ltd", 264 PackageDescription: "The Saxon package is a collection of tools for processing XML documents.", 265 PackageDownloadLocation: "https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download", 266 FilesAnalyzed: false, 267 PackageHomePage: "http://saxon.sourceforge.net/", 268 PackageLicenseComments: "Other versions available for a commercial license", 269 PackageLicenseConcluded: "MPL-1.0", 270 PackageLicenseDeclared: "MPL-1.0", 271 PackageName: "Saxon", 272 PackageFileName: "saxonB-8.8.zip", 273 PackageVersion: "8.8", 274 }, 275 }, 276 Files: []*v2_2.File{ 277 { 278 FileName: "./src/org/spdx/parser/DOAPProject.java", 279 FileSPDXIdentifier: "SPDXRef-DoapSource", 280 FileTypes: []string{ 281 "SOURCE", 282 }, 283 Checksums: []common.Checksum{ 284 { 285 Algorithm: "SHA1", 286 Value: "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12", 287 }, 288 }, 289 LicenseConcluded: "Apache-2.0", 290 LicenseInfoInFiles: []string{ 291 "Apache-2.0", 292 }, 293 FileCopyrightText: "Copyright 2010, 2011 Source Auditor Inc.", 294 FileContributors: []string{ 295 "Protecode Inc.", 296 "SPDX Technical Team Members", 297 "Open Logic Inc.", 298 "Source Auditor Inc.", 299 "Black Duck Software In.c", 300 }, 301 }, 302 { 303 FileSPDXIdentifier: "SPDXRef-CommonsLangSrc", 304 Checksums: []common.Checksum{ 305 { 306 Algorithm: "SHA1", 307 Value: "c2b4e1c67a2d28fced849ee1bb76e7391b93f125", 308 }, 309 }, 310 FileComment: "This file is used by Jena", 311 FileCopyrightText: "Copyright 2001-2011 The Apache Software Foundation", 312 FileContributors: []string{"Apache Software Foundation"}, 313 FileName: "./lib-source/commons-lang3-3.1-sources.jar", 314 FileTypes: []string{"ARCHIVE"}, 315 LicenseConcluded: "Apache-2.0", 316 LicenseInfoInFiles: []string{"Apache-2.0"}, 317 FileNotice: "Apache Commons Lang\nCopyright 2001-2011 The Apache Software Foundation\n\nThis product includes software developed by\nThe Apache Software Foundation (http://www.apache.org/).\n\nThis product includes software from the Spring Framework,\nunder the Apache License 2.0 (see: StringUtils.containsWhitespace())", 318 }, 319 { 320 FileSPDXIdentifier: "SPDXRef-JenaLib", 321 Checksums: []common.Checksum{ 322 { 323 Algorithm: "SHA1", 324 Value: "3ab4e1c67a2d28fced849ee1bb76e7391b93f125", 325 }, 326 }, 327 FileComment: "This file belongs to Jena", 328 FileCopyrightText: "(c) Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP", 329 FileContributors: []string{"Apache Software Foundation", "Hewlett Packard Inc."}, 330 FileName: "./lib-source/jena-2.6.3-sources.jar", 331 FileTypes: []string{"ARCHIVE"}, 332 LicenseComments: "This license is used by Jena", 333 LicenseConcluded: "LicenseRef-1", 334 LicenseInfoInFiles: []string{"LicenseRef-1"}, 335 }, 336 { 337 FileSPDXIdentifier: "SPDXRef-File", 338 Annotations: []v2_2.Annotation{ 339 { 340 Annotator: common.Annotator{ 341 Annotator: "File Commenter", 342 AnnotatorType: "Person", 343 }, 344 AnnotationDate: "2011-01-29T18:30:22Z", 345 AnnotationType: "OTHER", 346 AnnotationComment: "File level annotation", 347 }, 348 }, 349 Checksums: []common.Checksum{ 350 { 351 Algorithm: "SHA1", 352 Value: "d6a770ba38583ed4bb4525bd96e50461655d2758", 353 }, 354 { 355 Algorithm: "MD5", 356 Value: "624c1abb3664f4b35547e7c73864ad24", 357 }, 358 }, 359 FileComment: "The concluded license was taken from the package level that the file was included in.\nThis information was found in the COPYING.txt file in the xyz directory.", 360 FileCopyrightText: "Copyright 2008-2010 John Smith", 361 FileContributors: []string{"The Regents of the University of California", "Modified by Paul Mundt [email protected]", "IBM Corporation"}, 362 FileName: "./package/foo.c", 363 FileTypes: []string{"SOURCE"}, 364 LicenseComments: "The concluded license was taken from the package level that the file was included in.", 365 LicenseConcluded: "(LGPL-2.0-only OR LicenseRef-2)", 366 LicenseInfoInFiles: []string{"GPL-2.0-only", "LicenseRef-2"}, 367 FileNotice: "Copyright (c) 2001 Aaron Lehmann [email protected]\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the �Software�), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: \nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED �AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", 368 }, 369 }, 370 Snippets: []v2_2.Snippet{ 371 { 372 SnippetSPDXIdentifier: "SPDXRef-Snippet", 373 SnippetFromFileSPDXIdentifier: "SPDXRef-DoapSource", 374 Ranges: []common.SnippetRange{ 375 { 376 StartPointer: common.SnippetRangePointer{ 377 Offset: 310, 378 FileSPDXIdentifier: "SPDXRef-DoapSource", 379 }, 380 EndPointer: common.SnippetRangePointer{ 381 Offset: 420, 382 FileSPDXIdentifier: "SPDXRef-DoapSource", 383 }, 384 }, 385 { 386 StartPointer: common.SnippetRangePointer{ 387 LineNumber: 5, 388 FileSPDXIdentifier: "SPDXRef-DoapSource", 389 }, 390 EndPointer: common.SnippetRangePointer{ 391 LineNumber: 23, 392 FileSPDXIdentifier: "SPDXRef-DoapSource", 393 }, 394 }, 395 }, 396 SnippetLicenseConcluded: "GPL-2.0-only", 397 LicenseInfoInSnippet: []string{"GPL-2.0-only"}, 398 SnippetLicenseComments: "The concluded license was taken from package xyz, from which the snippet was copied into the current file. The concluded license information was found in the COPYING.txt file in package xyz.", 399 SnippetCopyrightText: "Copyright 2008-2010 John Smith", 400 SnippetComment: "This snippet was identified as significant and highlighted in this Apache-2.0 file, when a commercial scanner identified it as being derived from file foo.c in package xyz which is licensed under GPL-2.0.", 401 SnippetName: "from linux kernel", 402 }, 403 }, 404 Relationships: []*v2_2.Relationship{ 405 { 406 RefA: common.MakeDocElementID("", "DOCUMENT"), 407 RefB: common.MakeDocElementID("", "Package"), 408 Relationship: "CONTAINS", 409 }, 410 { 411 RefA: common.MakeDocElementID("", "DOCUMENT"), 412 RefB: common.MakeDocElementID("spdx-tool-1.2", "ToolsElement"), 413 Relationship: "COPY_OF", 414 }, 415 { 416 RefA: common.MakeDocElementID("", "DOCUMENT"), 417 RefB: common.MakeDocElementID("", "File"), 418 Relationship: "DESCRIBES", 419 }, 420 { 421 RefA: common.MakeDocElementID("", "DOCUMENT"), 422 RefB: common.MakeDocElementID("", "Package"), 423 Relationship: "DESCRIBES", 424 }, 425 { 426 RefA: common.MakeDocElementID("", "Package"), 427 RefB: common.MakeDocElementID("", "JenaLib"), 428 Relationship: "CONTAINS", 429 }, 430 { 431 RefA: common.MakeDocElementID("", "Package"), 432 RefB: common.MakeDocElementID("", "Saxon"), 433 Relationship: "DYNAMIC_LINK", 434 }, 435 { 436 RefA: common.MakeDocElementID("", "CommonsLangSrc"), 437 RefB: common.MakeDocElementSpecial("NOASSERTION"), 438 Relationship: "GENERATED_FROM", 439 }, 440 { 441 RefA: common.MakeDocElementID("", "JenaLib"), 442 RefB: common.MakeDocElementID("", "Package"), 443 Relationship: "CONTAINS", 444 }, 445 { 446 RefA: common.MakeDocElementID("", "File"), 447 RefB: common.MakeDocElementID("", "fromDoap-0"), 448 Relationship: "GENERATED_FROM", 449 }, 450 }, 451} 452