1// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 2 3package spdx_yaml 4 5import ( 6 "bytes" 7 "flag" 8 "fmt" 9 "os" 10 "testing" 11 12 "github.com/google/go-cmp/cmp" 13 14 "github.com/spdx/tools-golang/spdx/common" 15 "github.com/spdx/tools-golang/spdx/v2_3" 16) 17 18var update = *flag.Bool("update-snapshots", false, "update the example snapshot") 19 20func TestLoad2_3(t *testing.T) { 21 fileName := "../examples/sample-docs/yaml/SPDXYAMLExample-2.3.spdx.yaml" 22 23 if update { 24 f, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) 25 if err != nil { 26 t.Errorf("unable to write SPDX 2.3 example to YAML: %v", err) 27 } 28 err = Save2_3(&want2_3, f) 29 if err != nil { 30 t.Errorf("unable to serialize SPDX 2.3 example to YAML: %v", err) 31 } 32 } 33 34 file, err := os.Open(fileName) 35 if err != nil { 36 panic(fmt.Errorf("error opening File: %s", err)) 37 } 38 39 got, err := Load2_3(file) 40 if err != nil { 41 t.Errorf("yaml.parser.Load2_3() error = %v", err) 42 return 43 } 44 45 // get a copy of the handwritten struct so we don't mutate it on accident 46 handwrittenExample := want2_3 47 48 if cmp.Equal(handwrittenExample, got) { 49 t.Errorf("got incorrect struct after parsing YAML example") 50 return 51 } 52} 53 54func TestWrite2_3(t *testing.T) { 55 w := &bytes.Buffer{} 56 // get a copy of the handwritten struct so we don't mutate it on accident 57 handwrittenExample := want2_3 58 if err := Save2_3(&handwrittenExample, w); err != nil { 59 t.Errorf("Save2_3() error = %v", err.Error()) 60 return 61 } 62 63 // we should be able to parse what the writer wrote, and it should be identical to the original handwritten struct 64 parsedDoc, err := Load2_3(bytes.NewReader(w.Bytes())) 65 if err != nil { 66 t.Errorf("failed to parse written document: %v", err.Error()) 67 return 68 } 69 70 if cmp.Equal(handwrittenExample, parsedDoc) { 71 t.Errorf("got incorrect struct after writing and re-parsing YAML example") 72 return 73 } 74} 75 76// want is handwritten translation of the official example YAML SPDX v2.2 document into a Go struct. 77// We expect that the result of parsing the official document should be this value. 78// We expect that the result of writing this struct should match the official example document. 79var want2_3 = v2_3.Document{ 80 DataLicense: "CC0-1.0", 81 SPDXVersion: "SPDX-2.2", 82 SPDXIdentifier: "SPDXRef-DOCUMENT", 83 DocumentName: "SPDX-Tools-v2.0", 84 DocumentNamespace: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301", 85 CreationInfo: &v2_3.CreationInfo{ 86 LicenseListVersion: "3.9", 87 Creators: []common.Creator{ 88 {CreatorType: "Tool", Creator: "LicenseFind-1.0"}, 89 {CreatorType: "Organization", Creator: "ExampleCodeInspect ()"}, 90 {CreatorType: "Person", Creator: "Jane Doe ()"}, 91 }, 92 Created: "2010-01-29T18:30:22Z", 93 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.", 94 }, 95 DocumentComment: "This document was created using SPDX 2.0 using licenses from the web site.", 96 ExternalDocumentReferences: []v2_3.ExternalDocumentRef{ 97 { 98 DocumentRefID: "DocumentRef-spdx-tool-1.2", 99 URI: "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", 100 Checksum: common.Checksum{ 101 Algorithm: common.SHA1, 102 Value: "d6a770ba38583ed4bb4525bd96e50461655d2759", 103 }, 104 }, 105 }, 106 OtherLicenses: []*v2_3.OtherLicense{ 107 { 108 LicenseIdentifier: "LicenseRef-1", 109 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*/", 110 }, 111 { 112 LicenseIdentifier: "LicenseRef-2", 113 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.", 114 }, 115 { 116 LicenseIdentifier: "LicenseRef-4", 117 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*/", 118 }, 119 { 120 LicenseIdentifier: "LicenseRef-Beerware-4.2", 121 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", 122 LicenseComment: "The beerware license has a couple of other standard variants.", 123 LicenseName: "Beer-Ware License (Version 42)", 124 LicenseCrossReferences: []string{"http://people.freebsd.org/~phk/"}, 125 }, 126 { 127 LicenseIdentifier: "LicenseRef-3", 128 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.", 129 LicenseName: "CyberNeko License", 130 LicenseCrossReferences: []string{ 131 "http://people.apache.org/~andyc/neko/LICENSE", 132 "http://justasample.url.com", 133 }, 134 LicenseComment: "This is tye CyperNeko License", 135 }, 136 }, 137 Annotations: []*v2_3.Annotation{ 138 { 139 Annotator: common.Annotator{ 140 Annotator: "Jane Doe ()", 141 AnnotatorType: "Person", 142 }, 143 AnnotationDate: "2010-01-29T18:30:22Z", 144 AnnotationType: "OTHER", 145 AnnotationComment: "Document level annotation", 146 }, 147 { 148 Annotator: common.Annotator{ 149 Annotator: "Joe Reviewer", 150 AnnotatorType: "Person", 151 }, 152 AnnotationDate: "2010-02-10T00:00:00Z", 153 AnnotationType: "REVIEW", 154 AnnotationComment: "This is just an example. Some of the non-standard licenses look like they are actually BSD 3 clause licenses", 155 }, 156 { 157 Annotator: common.Annotator{ 158 Annotator: "Suzanne Reviewer", 159 AnnotatorType: "Person", 160 }, 161 AnnotationDate: "2011-03-13T00:00:00Z", 162 AnnotationType: "REVIEW", 163 AnnotationComment: "Another example reviewer.", 164 }, 165 }, 166 Packages: []*v2_3.Package{ 167 { 168 PackageName: "glibc", 169 PackageSPDXIdentifier: "SPDXRef-Package", 170 PackageVersion: "2.11.1", 171 PackageFileName: "glibc-2.11.1.tar.gz", 172 PackageSupplier: &common.Supplier{ 173 Supplier: "Jane Doe ([email protected])", 174 SupplierType: "Person", 175 }, 176 PackageOriginator: &common.Originator{ 177 Originator: "ExampleCodeInspect ([email protected])", 178 OriginatorType: "Organization", 179 }, 180 PackageDownloadLocation: "http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz", 181 FilesAnalyzed: true, 182 PackageVerificationCode: &common.PackageVerificationCode{ 183 Value: "d6a770ba38583ed4bb4525bd96e50461655d2758", 184 ExcludedFiles: []string{"./package.spdx"}, 185 }, 186 PackageChecksums: []common.Checksum{ 187 { 188 Algorithm: "MD5", 189 Value: "624c1abb3664f4b35547e7c73864ad24", 190 }, 191 { 192 Algorithm: "SHA1", 193 Value: "85ed0817af83a24ad8da68c2b5094de69833983c", 194 }, 195 { 196 Algorithm: "SHA256", 197 Value: "11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd", 198 }, 199 }, 200 PackageHomePage: "http://ftp.gnu.org/gnu/glibc", 201 PackageSourceInfo: "uses glibc-2_11-branch from git://sourceware.org/git/glibc.git.", 202 PackageLicenseConcluded: "(LGPL-2.0-only OR LicenseRef-3)", 203 PackageLicenseInfoFromFiles: []string{ 204 "GPL-2.0-only", 205 "LicenseRef-2", 206 "LicenseRef-1", 207 }, 208 PackageLicenseDeclared: "(LGPL-2.0-only AND LicenseRef-3)", 209 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.", 210 PackageCopyrightText: "Copyright 2008-2010 John Smith", 211 PackageSummary: "GNU C library.", 212 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.", 213 PackageComment: "", 214 PackageExternalReferences: []*v2_3.PackageExternalReference{ 215 { 216 Category: "SECURITY", 217 RefType: "cpe23Type", 218 Locator: "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*", 219 }, 220 { 221 Category: "OTHER", 222 RefType: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge", 223 Locator: "acmecorp/acmenator/4.1.3-alpha", 224 ExternalRefComment: "This is the external ref for Acme", 225 }, 226 }, 227 PackageAttributionTexts: []string{ 228 "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.", 229 }, 230 Files: nil, 231 Annotations: []v2_3.Annotation{ 232 { 233 Annotator: common.Annotator{ 234 Annotator: "Package Commenter", 235 AnnotatorType: "Person", 236 }, 237 AnnotationDate: "2011-01-29T18:30:22Z", 238 AnnotationType: "OTHER", 239 AnnotationComment: "Package level annotation", 240 }, 241 }, 242 }, 243 { 244 PackageSPDXIdentifier: "SPDXRef-fromDoap-1", 245 PackageCopyrightText: "NOASSERTION", 246 PackageDownloadLocation: "NOASSERTION", 247 FilesAnalyzed: false, 248 PackageHomePage: "http://commons.apache.org/proper/commons-lang/", 249 PackageLicenseConcluded: "NOASSERTION", 250 PackageLicenseDeclared: "NOASSERTION", 251 PackageName: "Apache Commons Lang", 252 }, 253 { 254 PackageName: "Jena", 255 PackageSPDXIdentifier: "SPDXRef-fromDoap-0", 256 PackageCopyrightText: "NOASSERTION", 257 PackageDownloadLocation: "https://search.maven.org/remotecontent?filepath=org/apache/jena/apache-jena/3.12.0/apache-jena-3.12.0.tar.gz", 258 PackageExternalReferences: []*v2_3.PackageExternalReference{ 259 { 260 Category: "PACKAGE_MANAGER", 261 RefType: "purl", 262 Locator: "pkg:maven/org.apache.jena/apache-jena@3.12.0", 263 }, 264 }, 265 FilesAnalyzed: false, 266 PackageHomePage: "http://www.openjena.org/", 267 PackageLicenseConcluded: "NOASSERTION", 268 PackageLicenseDeclared: "NOASSERTION", 269 PackageVersion: "3.12.0", 270 }, 271 { 272 PackageSPDXIdentifier: "SPDXRef-Saxon", 273 PackageChecksums: []common.Checksum{ 274 { 275 Algorithm: "SHA1", 276 Value: "85ed0817af83a24ad8da68c2b5094de69833983c", 277 }, 278 }, 279 PackageCopyrightText: "Copyright Saxonica Ltd", 280 PackageDescription: "The Saxon package is a collection of tools for processing XML documents.", 281 PackageDownloadLocation: "https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download", 282 FilesAnalyzed: false, 283 PackageHomePage: "http://saxon.sourceforge.net/", 284 PackageLicenseComments: "Other versions available for a commercial license", 285 PackageLicenseConcluded: "MPL-1.0", 286 PackageLicenseDeclared: "MPL-1.0", 287 PackageName: "Saxon", 288 PackageFileName: "saxonB-8.8.zip", 289 PackageVersion: "8.8", 290 }, 291 { 292 PrimaryPackagePurpose: "CONTAINER", 293 PackageSPDXIdentifier: "SPDXRef-CentOS-7", 294 PackageCopyrightText: "NOASSERTION", 295 PackageDescription: "The CentOS container used to run the application.", 296 PackageDownloadLocation: "NOASSERTION", 297 FilesAnalyzed: false, 298 PackageHomePage: "https://www.centos.org/", 299 PackageName: "centos", 300 PackageFileName: "saxonB-8.8.zip", 301 PackageVersion: "centos7.9.2009", 302 BuiltDate: "2021-09-15T02:38:00Z", 303 ValidUntilDate: "2022-10-15T02:38:00Z", 304 ReleaseDate: "2021-10-15T02:38:00Z", 305 }, 306 }, 307 Files: []*v2_3.File{ 308 { 309 FileName: "./src/org/spdx/parser/DOAPProject.java", 310 FileSPDXIdentifier: "SPDXRef-DoapSource", 311 FileTypes: []string{ 312 "SOURCE", 313 }, 314 Checksums: []common.Checksum{ 315 { 316 Algorithm: "SHA1", 317 Value: "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12", 318 }, 319 }, 320 LicenseConcluded: "Apache-2.0", 321 LicenseInfoInFiles: []string{ 322 "Apache-2.0", 323 }, 324 FileCopyrightText: "Copyright 2010, 2011 Source Auditor Inc.", 325 FileContributors: []string{ 326 "Protecode Inc.", 327 "SPDX Technical Team Members", 328 "Open Logic Inc.", 329 "Source Auditor Inc.", 330 "Black Duck Software In.c", 331 }, 332 }, 333 { 334 FileSPDXIdentifier: "SPDXRef-CommonsLangSrc", 335 Checksums: []common.Checksum{ 336 { 337 Algorithm: "SHA1", 338 Value: "c2b4e1c67a2d28fced849ee1bb76e7391b93f125", 339 }, 340 }, 341 FileComment: "This file is used by Jena", 342 FileCopyrightText: "Copyright 2001-2011 The Apache Software Foundation", 343 FileContributors: []string{"Apache Software Foundation"}, 344 FileName: "./lib-source/commons-lang3-3.1-sources.jar", 345 FileTypes: []string{"ARCHIVE"}, 346 LicenseConcluded: "Apache-2.0", 347 LicenseInfoInFiles: []string{"Apache-2.0"}, 348 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())", 349 }, 350 { 351 FileSPDXIdentifier: "SPDXRef-JenaLib", 352 Checksums: []common.Checksum{ 353 { 354 Algorithm: "SHA1", 355 Value: "3ab4e1c67a2d28fced849ee1bb76e7391b93f125", 356 }, 357 }, 358 FileComment: "This file belongs to Jena", 359 FileCopyrightText: "(c) Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP", 360 FileContributors: []string{"Apache Software Foundation", "Hewlett Packard Inc."}, 361 FileName: "./lib-source/jena-2.6.3-sources.jar", 362 FileTypes: []string{"ARCHIVE"}, 363 LicenseComments: "This license is used by Jena", 364 LicenseConcluded: "LicenseRef-1", 365 LicenseInfoInFiles: []string{"LicenseRef-1"}, 366 }, 367 { 368 FileSPDXIdentifier: "SPDXRef-File", 369 Annotations: []v2_3.Annotation{ 370 { 371 Annotator: common.Annotator{ 372 Annotator: "File Commenter", 373 AnnotatorType: "Person", 374 }, 375 AnnotationDate: "2011-01-29T18:30:22Z", 376 AnnotationType: "OTHER", 377 AnnotationComment: "File level annotation", 378 }, 379 }, 380 Checksums: []common.Checksum{ 381 { 382 Algorithm: "SHA1", 383 Value: "d6a770ba38583ed4bb4525bd96e50461655d2758", 384 }, 385 { 386 Algorithm: "MD5", 387 Value: "624c1abb3664f4b35547e7c73864ad24", 388 }, 389 }, 390 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.", 391 FileCopyrightText: "Copyright 2008-2010 John Smith", 392 FileContributors: []string{"The Regents of the University of California", "Modified by Paul Mundt [email protected]", "IBM Corporation"}, 393 FileName: "./package/foo.c", 394 FileTypes: []string{"SOURCE"}, 395 LicenseComments: "The concluded license was taken from the package level that the file was included in.", 396 LicenseConcluded: "(LGPL-2.0-only OR LicenseRef-2)", 397 LicenseInfoInFiles: []string{"GPL-2.0-only", "LicenseRef-2"}, 398 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.", 399 }, 400 }, 401 Snippets: []v2_3.Snippet{ 402 { 403 SnippetSPDXIdentifier: "SPDXRef-Snippet", 404 SnippetFromFileSPDXIdentifier: "SPDXRef-DoapSource", 405 Ranges: []common.SnippetRange{ 406 { 407 StartPointer: common.SnippetRangePointer{ 408 Offset: 310, 409 FileSPDXIdentifier: "SPDXRef-DoapSource", 410 }, 411 EndPointer: common.SnippetRangePointer{ 412 Offset: 420, 413 FileSPDXIdentifier: "SPDXRef-DoapSource", 414 }, 415 }, 416 { 417 StartPointer: common.SnippetRangePointer{ 418 LineNumber: 5, 419 FileSPDXIdentifier: "SPDXRef-DoapSource", 420 }, 421 EndPointer: common.SnippetRangePointer{ 422 LineNumber: 23, 423 FileSPDXIdentifier: "SPDXRef-DoapSource", 424 }, 425 }, 426 }, 427 SnippetLicenseConcluded: "GPL-2.0-only", 428 LicenseInfoInSnippet: []string{"GPL-2.0-only"}, 429 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.", 430 SnippetCopyrightText: "Copyright 2008-2010 John Smith", 431 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.", 432 SnippetName: "from linux kernel", 433 SnippetAttributionTexts: []string{"Snippet attribution"}, 434 }, 435 }, 436 Relationships: []*v2_3.Relationship{ 437 { 438 RefA: common.MakeDocElementID("", "DOCUMENT"), 439 RefB: common.MakeDocElementID("", "Package"), 440 Relationship: "CONTAINS", 441 RelationshipComment: "A relationship comment", 442 }, 443 { 444 RefA: common.MakeDocElementID("", "DOCUMENT"), 445 RefB: common.MakeDocElementID("spdx-tool-1.2", "ToolsElement"), 446 Relationship: "COPY_OF", 447 }, 448 { 449 RefA: common.MakeDocElementID("", "DOCUMENT"), 450 RefB: common.MakeDocElementID("", "File"), 451 Relationship: "DESCRIBES", 452 }, 453 { 454 RefA: common.MakeDocElementID("", "DOCUMENT"), 455 RefB: common.MakeDocElementID("", "Package"), 456 Relationship: "DESCRIBES", 457 }, 458 { 459 RefA: common.MakeDocElementID("", "Package"), 460 RefB: common.MakeDocElementID("", "JenaLib"), 461 Relationship: "CONTAINS", 462 }, 463 { 464 RefA: common.MakeDocElementID("", "Package"), 465 RefB: common.MakeDocElementID("", "Saxon"), 466 Relationship: "DYNAMIC_LINK", 467 }, 468 { 469 RefA: common.MakeDocElementID("", "CommonsLangSrc"), 470 RefB: common.MakeDocElementSpecial("NOASSERTION"), 471 Relationship: "GENERATED_FROM", 472 }, 473 { 474 RefA: common.MakeDocElementID("", "JenaLib"), 475 RefB: common.MakeDocElementID("", "Package"), 476 Relationship: "CONTAINS", 477 }, 478 { 479 RefA: common.MakeDocElementID("", "File"), 480 RefB: common.MakeDocElementID("", "fromDoap-0"), 481 Relationship: "GENERATED_FROM", 482 }, 483 }, 484 Reviews: []*v2_3.Review{ 485 { 486 Reviewer: "[email protected]", 487 ReviewerType: "Person", 488 ReviewDate: "2021-11-03T05:43:21Z", 489 ReviewComment: "This is a review comment", 490 }, 491 }, 492} 493