diff --git a/AUTHORS.rst b/AUTHORS.rst index e84e4b9eaf9..a8e99cfc0be 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -8,6 +8,7 @@ The following organizations or individuals have contributed to ScanCode: - Alex Blekhman @a-tinsmith - Alexander Gschrei @agschrei - Armijn Hemmel @armijnhemel +- Armin Tänzer @armintaenzertng - Arnaud Jeansen @ajeans - Arnav Mandal @arnav-mandal1234 - Aryan Kenchappagol @aryanxk02 diff --git a/tests/formattedcode/data/spdx/license_known/expected.rdf b/tests/formattedcode/data/spdx/license_known/expected.rdf index 1930a53d5dd..085fefa63de 100644 --- a/tests/formattedcode/data/spdx/license_known/expected.rdf +++ b/tests/formattedcode/data/spdx/license_known/expected.rdf @@ -59,7 +59,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "2b8b815229aa8a61e483fb4ba0588b8b6c491890", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/apache-2.0.LICENSE", @@ -80,7 +80,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "172444e7c137eb5cd3cae530aca0879c90f7fada", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/cc0-1.0.LICENSE", @@ -88,6 +88,26 @@ } } ], + "ns1:relationship": [ + { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-2" + } + }, + { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-3" + } + } + ], "@rdf:about": "http://www.spdx.org/tools#SPDXRef-DOCUMENT", "ns1:specVersion": "SPDX-2.2" }, diff --git a/tests/formattedcode/data/spdx/license_known/expected_with_text.rdf b/tests/formattedcode/data/spdx/license_known/expected_with_text.rdf index 1930a53d5dd..085fefa63de 100644 --- a/tests/formattedcode/data/spdx/license_known/expected_with_text.rdf +++ b/tests/formattedcode/data/spdx/license_known/expected_with_text.rdf @@ -59,7 +59,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "2b8b815229aa8a61e483fb4ba0588b8b6c491890", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/apache-2.0.LICENSE", @@ -80,7 +80,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "172444e7c137eb5cd3cae530aca0879c90f7fada", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/cc0-1.0.LICENSE", @@ -88,6 +88,26 @@ } } ], + "ns1:relationship": [ + { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-2" + } + }, + { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-3" + } + } + ], "@rdf:about": "http://www.spdx.org/tools#SPDXRef-DOCUMENT", "ns1:specVersion": "SPDX-2.2" }, diff --git a/tests/formattedcode/data/spdx/license_ref/expected.rdf b/tests/formattedcode/data/spdx/license_ref/expected.rdf index f754b1d7eef..1d18dff8684 100644 --- a/tests/formattedcode/data/spdx/license_ref/expected.rdf +++ b/tests/formattedcode/data/spdx/license_ref/expected.rdf @@ -46,8 +46,8 @@ ], "ns1:checksum": { "ns1:Checksum": { - "ns1:algorithm": "SHA1", - "ns1:checksumValue": "f9c28fa2714ad0c2e36d3e5561afb0031fa76831" + "ns1:checksumValue": "f9c28fa2714ad0c2e36d3e5561afb0031fa76831", + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/NOTICE", @@ -109,6 +109,15 @@ "ns1:name": "scan" } }, + "ns1:relationship": { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-2" + } + }, "ns1:hasExtractedLicensingInfo": [ { "ns1:ExtractedLicensingInfo": { diff --git a/tests/formattedcode/data/spdx/license_ref/expected_with_text.rdf b/tests/formattedcode/data/spdx/license_ref/expected_with_text.rdf index b8945381724..5f82f5fba81 100644 --- a/tests/formattedcode/data/spdx/license_ref/expected_with_text.rdf +++ b/tests/formattedcode/data/spdx/license_ref/expected_with_text.rdf @@ -46,8 +46,8 @@ ], "ns1:checksum": { "ns1:Checksum": { - "ns1:algorithm": "SHA1", - "ns1:checksumValue": "f9c28fa2714ad0c2e36d3e5561afb0031fa76831" + "ns1:checksumValue": "f9c28fa2714ad0c2e36d3e5561afb0031fa76831", + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/NOTICE", @@ -109,6 +109,15 @@ "ns1:name": "scan" } }, + "ns1:relationship": { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-2" + } + }, "ns1:hasExtractedLicensingInfo": [ { "ns1:ExtractedLicensingInfo": { diff --git a/tests/formattedcode/data/spdx/or_later/expected.rdf b/tests/formattedcode/data/spdx/or_later/expected.rdf index 347acededec..ffcc65d831e 100644 --- a/tests/formattedcode/data/spdx/or_later/expected.rdf +++ b/tests/formattedcode/data/spdx/or_later/expected.rdf @@ -18,7 +18,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "0c5bf934430394112921e7a1a8128176606d32ca", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./test.java", @@ -51,6 +51,15 @@ "ns1:name": "or_later" } }, + "ns1:relationship": { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-1" + } + }, "@rdf:about": "http://www.spdx.org/tools#SPDXRef-DOCUMENT", "ns1:specVersion": "SPDX-2.2" }, diff --git a/tests/formattedcode/data/spdx/tree/expected.rdf b/tests/formattedcode/data/spdx/tree/expected.rdf index 41d4b9ef26f..decaeaffb73 100644 --- a/tests/formattedcode/data/spdx/tree/expected.rdf +++ b/tests/formattedcode/data/spdx/tree/expected.rdf @@ -64,7 +64,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "3922760d8492eb8f853c10a627f5a73f9eaec6ff", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/copy1.c", @@ -83,7 +83,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "3922760d8492eb8f853c10a627f5a73f9eaec6ff", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/copy2.c", @@ -101,8 +101,8 @@ }, "ns1:checksum": { "ns1:Checksum": { - "ns1:algorithm": "SHA1", - "ns1:checksumValue": "c91811eb5fdc7ab440355f9f8d1580e1518b0c2f" + "ns1:checksumValue": "c91811eb5fdc7ab440355f9f8d1580e1518b0c2f", + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/copy3.c", @@ -121,7 +121,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "3922760d8492eb8f853c10a627f5a73f9eaec6ff", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/subdir/copy1.c", @@ -140,7 +140,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "3922760d8492eb8f853c10a627f5a73f9eaec6ff", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/subdir/copy2.c", @@ -159,7 +159,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "389af7e629a9853056e42b262d5e30bf4579a74f", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/subdir/copy3.c", @@ -178,7 +178,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "58748872d25374160692f1ed7075d0fe80a544b1", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:fileName": "./scan/subdir/copy4.c", @@ -187,6 +187,71 @@ } } ], + "ns1:relationship": [ + { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-2" + } + }, + { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-3" + } + }, + { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-4" + } + }, + { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-6" + } + }, + { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-7" + } + }, + { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-8" + } + }, + { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-9" + } + } + ], "@rdf:about": "http://www.spdx.org/tools#SPDXRef-DOCUMENT", "ns1:specVersion": "SPDX-2.2" }, diff --git a/tests/formattedcode/data/spdx/unicode/expected.rdf b/tests/formattedcode/data/spdx/unicode/expected.rdf index 62d7ff612f5..720448a7400 100644 --- a/tests/formattedcode/data/spdx/unicode/expected.rdf +++ b/tests/formattedcode/data/spdx/unicode/expected.rdf @@ -23,7 +23,7 @@ "ns1:checksum": { "ns1:Checksum": { "ns1:checksumValue": "3903b654c47ea95203567230d72093ad1c5c4b90", - "ns1:algorithm": "SHA1" + "ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1" } }, "ns1:licenseInfoInFile": { @@ -69,6 +69,15 @@ "ns1:name": "unicode" } }, + "ns1:relationship": { + "ns1:Relationship": { + "ns1:relationshipType": { + "@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains" + }, + "ns1:spdxElementId": "SPDXRef-001", + "ns1:relatedSpdxElement": "SPDXRef-1" + } + }, "@rdf:about": "http://www.spdx.org/tools#SPDXRef-DOCUMENT", "ns1:specVersion": "SPDX-2.2" }, diff --git a/tests/formattedcode/test_output_spdx.py b/tests/formattedcode/test_output_spdx.py index c2730b7df2f..3ad099a2b91 100644 --- a/tests/formattedcode/test_output_spdx.py +++ b/tests/formattedcode/test_output_spdx.py @@ -127,7 +127,6 @@ def check_rdf_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES): else: with io.open(expected_file, encoding='utf-8') as i: expected = json.load(i) - expected = load_and_clean_rdf(result_file) assert json.dumps(result, indent=2) == json.dumps(expected, indent=2)