diff --git a/src/packagedcode/cargo.py b/src/packagedcode/cargo.py index ffe8dea5159..fe955a279f8 100644 --- a/src/packagedcode/cargo.py +++ b/src/packagedcode/cargo.py @@ -7,6 +7,7 @@ # See https://aboutcode.org for more information about nexB OSS projects. # +import os import re import saneyaml @@ -31,8 +32,8 @@ class CargoTomlHandler(models.DatafileHandler): @classmethod def parse(cls, location): package_data = toml.load(location, _dict=dict) - core_package_data = package_data.get('package', {}) + workspace = package_data.get('workspace', {}) name = core_package_data.get('name') version = core_package_data.get('version') @@ -66,6 +67,9 @@ def parse(cls, location): repository_homepage_url = name and f'https://crates.io/crates/{name}' repository_download_url = name and version and f'https://crates.io/api/v1/crates/{name}/{version}/download' api_data_url = name and f'https://crates.io/api/v1/crates/{name}' + extra_data = {} + if workspace: + extra_data["workspace"] = workspace yield models.PackageData( datasource_id=cls.datasource_id, @@ -82,20 +86,92 @@ def parse(cls, location): repository_download_url=repository_download_url, api_data_url=api_data_url, dependencies=dependencies, + extra_data=extra_data, ) @classmethod def assemble(cls, package_data, resource, codebase, package_adder): """ - Assemble Cargo.toml and possible Cargo.lock datafiles + Assemble Cargo.toml and possible Cargo.lock datafiles. Also + support cargo workspaces where we have multiple packages from + a repository and some shared information present at top-level. """ - yield from cls.assemble_from_many_datafiles( - datafile_name_patterns=('Cargo.toml', 'cargo.toml', 'Cargo.lock', 'cargo.lock'), - directory=resource.parent(codebase), - codebase=codebase, - package_adder=package_adder, - ) + workspace = package_data.extra_data.get("workspace", {}) + workspace_members = workspace.get("members", []) + workspace_package_data = workspace.get("package", {}) + attributes_to_copy = [ + "license_detections", + "declared_license_expression", + "declared_license_expression_spdx" + ] + if "license" in workspace_package_data: + for attribute in attributes_to_copy: + workspace_package_data[attribute] = getattr(package_data, attribute) + + workspace_root_path = resource.parent(codebase).path + if workspace_package_data and workspace_members: + for workspace_member_path in workspace_members: + workspace_directory_path = os.path.join(workspace_root_path, workspace_member_path) + workspace_directory = codebase.get_resource(path=workspace_directory_path) + if not workspace_directory: + continue + + # Update the package data for all members with the + # workspace package data + for resource in workspace_directory.children(codebase): + if cls.is_datafile(location=resource.location): + if not resource.package_data: + continue + + updated_package_data = cls.update_resource_package_data( + package_data=workspace_package_data, + old_package_data=resource.package_data.pop(), + mapping=CARGO_ATTRIBUTE_MAPPING, + ) + resource.package_data.append(updated_package_data) + resource.save(codebase) + + yield from cls.assemble_from_many_datafiles( + datafile_name_patterns=('Cargo.toml', 'cargo.toml', 'Cargo.lock', 'cargo.lock'), + directory=workspace_directory, + codebase=codebase, + package_adder=package_adder, + ) + else: + yield from cls.assemble_from_many_datafiles( + datafile_name_patterns=('Cargo.toml', 'cargo.toml', 'Cargo.lock', 'cargo.lock'), + directory=resource.parent(codebase), + codebase=codebase, + package_adder=package_adder, + ) + @classmethod + def update_resource_package_data(cls, package_data, old_package_data, mapping=None): + + for attribute in old_package_data.keys(): + if attribute in mapping: + replace_by_attribute = mapping.get(attribute) + old_package_data[attribute] = package_data.get(replace_by_attribute) + elif attribute == "parties": + old_package_data[attribute] = list(get_parties( + person_names=package_data.get("authors"), + party_role='author', + )) + + return old_package_data + + +CARGO_ATTRIBUTE_MAPPING = { + # Fields in PackageData model: Fields in cargo + "homepage_url": "homepage", + "vcs_url": "repository", + "keywords": "categories", + "extracted_license_statement": "license", + # These are fields carried over to avoid re-detection of licenses + "license_detections": "license_detections", + "declared_license_expression": "declared_license_expression", + "declared_license_expression_spdx": "declared_license_expression_spdx", +} class CargoLockHandler(models.DatafileHandler): datasource_id = 'cargo_lock' @@ -185,11 +261,13 @@ def dependency_mapper(dependencies, scope='dependencies'): ) -def get_parties(person_names, party_role): +def get_parties(person_names, party_role, debug=False): """ Yields Party of `party_role` given a list of ``person_names`` strings. https://doc.rust-lang.org/cargo/reference/manifest.html#the-authors-field-optional """ + if debug: + raise Exception(person_names) for person_name in person_names: name, email = parse_person(person_name) yield models.Party( @@ -197,7 +275,7 @@ def get_parties(person_names, party_role): name=name, role=party_role, email=email, - ) + ).to_dict() person_parser = re.compile( diff --git a/tests/packagedcode/data/cargo/cargo-with-workspace.expected.json b/tests/packagedcode/data/cargo/cargo-with-workspace.expected.json index 5529d5c8dc3..ed5264755e7 100644 --- a/tests/packagedcode/data/cargo/cargo-with-workspace.expected.json +++ b/tests/packagedcode/data/cargo/cargo-with-workspace.expected.json @@ -1,5 +1,309 @@ { "packages": [ + { + "type": "cargo", + "namespace": null, + "name": "tauri", + "version": "2.0.0-alpha.17", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "Make tiny, secure apps for all desktop platforms with Tauri", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Tauri Programme within The Commons Conservancy", + "email": null, + "url": null + } + ], + "keywords": [ + "gui", + "web-programming" + ], + "homepage_url": "https://tauri.app/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": "https://github.com/tauri-apps/tauri", + "copyright": null, + "holder": null, + "declared_license_expression": "apache-2.0 OR mit", + "declared_license_expression_spdx": "Apache-2.0 OR MIT", + "license_detections": [ + { + "license_expression": "apache-2.0 OR mit", + "matches": [ + { + "score": 100.0, + "start_line": 17, + "end_line": 17, + "matched_length": 6, + "match_coverage": 100.0, + "matcher": "2-aho", + "license_expression": "apache-2.0 OR mit", + "rule_identifier": "apache-2.0_or_mit_37.RULE", + "rule_relevance": 100, + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_37.RULE" + } + ], + "identifier": "apache_2_0_or_mit-8028b724-ab19-ab66-3288-312e7edc4fd9" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "Apache-2.0 OR MIT", + "notice_text": null, + "source_packages": [], + "extra_data": {}, + "repository_homepage_url": "https://crates.io/crates/tauri", + "repository_download_url": "https://crates.io/api/v1/crates/tauri/2.0.0-alpha.17/download", + "api_data_url": "https://crates.io/api/v1/crates/tauri", + "package_uid": "pkg:cargo/tauri@2.0.0-alpha.17?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "cargo-with-workspace/core/tauri/Cargo.toml" + ], + "datasource_ids": [ + "cargo_toml" + ], + "purl": "pkg:cargo/tauri@2.0.0-alpha.17" + }, + { + "type": "cargo", + "namespace": null, + "name": "tauri-runtime", + "version": "1.0.0-alpha.4", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "Runtime for Tauri applications", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Tauri Programme within The Commons Conservancy", + "email": null, + "url": null + } + ], + "keywords": [ + "gui", + "web-programming" + ], + "homepage_url": "https://tauri.app/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": "https://github.com/tauri-apps/tauri", + "copyright": null, + "holder": null, + "declared_license_expression": "apache-2.0 OR mit", + "declared_license_expression_spdx": "Apache-2.0 OR MIT", + "license_detections": [ + { + "license_expression": "apache-2.0 OR mit", + "matches": [ + { + "score": 100.0, + "start_line": 17, + "end_line": 17, + "matched_length": 6, + "match_coverage": 100.0, + "matcher": "2-aho", + "license_expression": "apache-2.0 OR mit", + "rule_identifier": "apache-2.0_or_mit_37.RULE", + "rule_relevance": 100, + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_37.RULE" + } + ], + "identifier": "apache_2_0_or_mit-8028b724-ab19-ab66-3288-312e7edc4fd9" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "Apache-2.0 OR MIT", + "notice_text": null, + "source_packages": [], + "extra_data": {}, + "repository_homepage_url": "https://crates.io/crates/tauri-runtime", + "repository_download_url": "https://crates.io/api/v1/crates/tauri-runtime/1.0.0-alpha.4/download", + "api_data_url": "https://crates.io/api/v1/crates/tauri-runtime", + "package_uid": "pkg:cargo/tauri-runtime@1.0.0-alpha.4?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "cargo-with-workspace/core/tauri-runtime/Cargo.toml" + ], + "datasource_ids": [ + "cargo_toml" + ], + "purl": "pkg:cargo/tauri-runtime@1.0.0-alpha.4" + }, + { + "type": "cargo", + "namespace": null, + "name": "tauri-build", + "version": "2.0.0-alpha.11", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "build time code to pair with https://crates.io/crates/tauri", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Tauri Programme within The Commons Conservancy", + "email": null, + "url": null + } + ], + "keywords": [ + "gui", + "web-programming" + ], + "homepage_url": "https://tauri.app/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": "https://github.com/tauri-apps/tauri", + "copyright": null, + "holder": null, + "declared_license_expression": "apache-2.0 OR mit", + "declared_license_expression_spdx": "Apache-2.0 OR MIT", + "license_detections": [ + { + "license_expression": "apache-2.0 OR mit", + "matches": [ + { + "score": 100.0, + "start_line": 17, + "end_line": 17, + "matched_length": 6, + "match_coverage": 100.0, + "matcher": "2-aho", + "license_expression": "apache-2.0 OR mit", + "rule_identifier": "apache-2.0_or_mit_37.RULE", + "rule_relevance": 100, + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_37.RULE" + } + ], + "identifier": "apache_2_0_or_mit-8028b724-ab19-ab66-3288-312e7edc4fd9" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "Apache-2.0 OR MIT", + "notice_text": null, + "source_packages": [], + "extra_data": {}, + "repository_homepage_url": "https://crates.io/crates/tauri-build", + "repository_download_url": "https://crates.io/api/v1/crates/tauri-build/2.0.0-alpha.11/download", + "api_data_url": "https://crates.io/api/v1/crates/tauri-build", + "package_uid": "pkg:cargo/tauri-build@2.0.0-alpha.11?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "cargo-with-workspace/core/tauri-build/Cargo.toml" + ], + "datasource_ids": [ + "cargo_toml" + ], + "purl": "pkg:cargo/tauri-build@2.0.0-alpha.11" + }, + { + "type": "cargo", + "namespace": null, + "name": "restart", + "version": "0.1.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Tauri Programme within The Commons Conservancy", + "email": null, + "url": null + } + ], + "keywords": [ + "gui", + "web-programming" + ], + "homepage_url": "https://tauri.app/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": "https://github.com/tauri-apps/tauri", + "copyright": null, + "holder": null, + "declared_license_expression": "apache-2.0 OR mit", + "declared_license_expression_spdx": "Apache-2.0 OR MIT", + "license_detections": [ + { + "license_expression": "apache-2.0 OR mit", + "matches": [ + { + "score": 100.0, + "start_line": 17, + "end_line": 17, + "matched_length": 6, + "match_coverage": 100.0, + "matcher": "2-aho", + "license_expression": "apache-2.0 OR mit", + "rule_identifier": "apache-2.0_or_mit_37.RULE", + "rule_relevance": 100, + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_37.RULE" + } + ], + "identifier": "apache_2_0_or_mit-8028b724-ab19-ab66-3288-312e7edc4fd9" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "Apache-2.0 OR MIT", + "notice_text": null, + "source_packages": [], + "extra_data": {}, + "repository_homepage_url": "https://crates.io/crates/restart", + "repository_download_url": "https://crates.io/api/v1/crates/restart/0.1.0/download", + "api_data_url": "https://crates.io/api/v1/crates/restart", + "package_uid": "pkg:cargo/restart@0.1.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "cargo-with-workspace/core/tests/restart/Cargo.toml" + ], + "datasource_ids": [ + "cargo_toml" + ], + "purl": "pkg:cargo/restart@0.1.0" + }, { "type": "npm", "namespace": null, @@ -152,12 +456,12 @@ { "identifier": "apache_2_0_or_mit-8028b724-ab19-ab66-3288-312e7edc4fd9", "license_expression": "apache-2.0 OR mit", - "detection_count": 4 + "detection_count": 8 }, { "identifier": "apache_2_0_or_mit-70d858d7-8968-9e7f-b90f-18b72fb96bef", "license_expression": "apache-2.0 OR mit", - "detection_count": 2 + "detection_count": 1 }, { "identifier": "cc0_1_0-309b9888-634d-163a-1eaa-15f7837d2907", @@ -168,11 +472,6 @@ "identifier": "mit-9967e727-165e-9bb5-f090-7de5e47a3929", "license_expression": "mit", "detection_count": 1 - }, - { - "identifier": "unknown-91d148c3-19ed-e6b1-0d37-5f588dcd6a94", - "license_expression": "unknown", - "detection_count": 3 } ], "files": [ @@ -245,7 +544,53 @@ "notice_text": null, "source_packages": [], "file_references": [], - "extra_data": {}, + "extra_data": { + "workspace": { + "resolver": "2", + "members": [ + "core/tauri", + "core/tauri-runtime", + "core/tauri-build", + "core/tests/restart" + ], + "package": { + "authors": [ + "Tauri Programme within The Commons Conservancy" + ], + "homepage": "https://tauri.app/", + "repository": "https://github.com/tauri-apps/tauri", + "categories": [ + "gui", + "web-programming" + ], + "license": "Apache-2.0 OR MIT", + "edition": "2021", + "rust-version": "1.70", + "license_detections": [ + { + "license_expression": "apache-2.0 OR mit", + "matches": [ + { + "score": 100.0, + "start_line": 17, + "end_line": 17, + "matched_length": 6, + "match_coverage": 100.0, + "matcher": "2-aho", + "license_expression": "apache-2.0 OR mit", + "rule_identifier": "apache-2.0_or_mit_37.RULE", + "rule_relevance": 100, + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_37.RULE" + } + ], + "identifier": "apache_2_0_or_mit-8028b724-ab19-ab66-3288-312e7edc4fd9" + } + ], + "declared_license_expression": "apache-2.0 OR mit", + "declared_license_expression_spdx": "Apache-2.0 OR MIT" + } + } + }, "dependencies": [], "repository_homepage_url": null, "repository_download_url": null, @@ -505,15 +850,16 @@ { "type": "person", "role": "author", - "name": "workspace", + "name": "Tauri Programme within The Commons Conservancy", "email": null, "url": null } ], - "keywords": [], - "homepage_url": { - "workspace": true - }, + "keywords": [ + "gui", + "web-programming" + ], + "homepage_url": "https://tauri.app/", "download_url": null, "size": null, "sha1": null, @@ -522,38 +868,35 @@ "sha512": null, "bug_tracking_url": null, "code_view_url": null, - "vcs_url": { - "workspace": true - }, + "vcs_url": "https://github.com/tauri-apps/tauri", "copyright": null, "holder": null, - "declared_license_expression": "unknown", - "declared_license_expression_spdx": "LicenseRef-scancode-unknown", + "declared_license_expression": "apache-2.0 OR mit", + "declared_license_expression_spdx": "Apache-2.0 OR MIT", "license_detections": [ { - "license_expression": "unknown", + "license_expression": "apache-2.0 OR mit", "matches": [ { "score": 100.0, - "start_line": 1, - "end_line": 1, - "matched_length": 3, + "start_line": 17, + "end_line": 17, + "matched_length": 6, "match_coverage": 100.0, - "matcher": "5-undetected", - "license_expression": "unknown", - "rule_identifier": "package-manifest-unknown-06e9bf2862e301d2e03347936ee156170df84855", + "matcher": "2-aho", + "license_expression": "apache-2.0 OR mit", + "rule_identifier": "apache-2.0_or_mit_37.RULE", "rule_relevance": 100, - "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/package-manifest-unknown-06e9bf2862e301d2e03347936ee156170df84855", - "matched_text": "license {'workspace': True}" + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_37.RULE" } ], - "identifier": "unknown-91d148c3-19ed-e6b1-0d37-5f588dcd6a94" + "identifier": "apache_2_0_or_mit-8028b724-ab19-ab66-3288-312e7edc4fd9" } ], "other_license_expression": null, "other_license_expression_spdx": null, "other_license_detections": [], - "extracted_license_statement": "workspace: yes\n", + "extracted_license_statement": "Apache-2.0 OR MIT", "notice_text": null, "source_packages": [], "file_references": [], @@ -567,6 +910,7 @@ } ], "for_packages": [ + "pkg:cargo/tauri-build@2.0.0-alpha.11?uuid=fixed-uid-done-for-testing-5642512d1758", "pkg:npm/tauri-workspace@0.0.0?uuid=fixed-uid-done-for-testing-5642512d1758" ], "detected_license_expression": null, @@ -608,15 +952,16 @@ { "type": "person", "role": "author", - "name": "workspace", + "name": "Tauri Programme within The Commons Conservancy", "email": null, "url": null } ], - "keywords": [], - "homepage_url": { - "workspace": true - }, + "keywords": [ + "gui", + "web-programming" + ], + "homepage_url": "https://tauri.app/", "download_url": null, "size": null, "sha1": null, @@ -625,38 +970,35 @@ "sha512": null, "bug_tracking_url": null, "code_view_url": null, - "vcs_url": { - "workspace": true - }, + "vcs_url": "https://github.com/tauri-apps/tauri", "copyright": null, "holder": null, - "declared_license_expression": "unknown", - "declared_license_expression_spdx": "LicenseRef-scancode-unknown", + "declared_license_expression": "apache-2.0 OR mit", + "declared_license_expression_spdx": "Apache-2.0 OR MIT", "license_detections": [ { - "license_expression": "unknown", + "license_expression": "apache-2.0 OR mit", "matches": [ { "score": 100.0, - "start_line": 1, - "end_line": 1, - "matched_length": 3, + "start_line": 17, + "end_line": 17, + "matched_length": 6, "match_coverage": 100.0, - "matcher": "5-undetected", - "license_expression": "unknown", - "rule_identifier": "package-manifest-unknown-06e9bf2862e301d2e03347936ee156170df84855", + "matcher": "2-aho", + "license_expression": "apache-2.0 OR mit", + "rule_identifier": "apache-2.0_or_mit_37.RULE", "rule_relevance": 100, - "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/package-manifest-unknown-06e9bf2862e301d2e03347936ee156170df84855", - "matched_text": "license {'workspace': True}" + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_37.RULE" } ], - "identifier": "unknown-91d148c3-19ed-e6b1-0d37-5f588dcd6a94" + "identifier": "apache_2_0_or_mit-8028b724-ab19-ab66-3288-312e7edc4fd9" } ], "other_license_expression": null, "other_license_expression_spdx": null, "other_license_detections": [], - "extracted_license_statement": "workspace: yes\n", + "extracted_license_statement": "Apache-2.0 OR MIT", "notice_text": null, "source_packages": [], "file_references": [], @@ -670,6 +1012,7 @@ } ], "for_packages": [ + "pkg:cargo/tauri-runtime@1.0.0-alpha.4?uuid=fixed-uid-done-for-testing-5642512d1758", "pkg:npm/tauri-workspace@0.0.0?uuid=fixed-uid-done-for-testing-5642512d1758" ], "detected_license_expression": null, @@ -697,15 +1040,16 @@ { "type": "person", "role": "author", - "name": "workspace", + "name": "Tauri Programme within The Commons Conservancy", "email": null, "url": null } ], - "keywords": [], - "homepage_url": { - "workspace": true - }, + "keywords": [ + "gui", + "web-programming" + ], + "homepage_url": "https://tauri.app/", "download_url": null, "size": null, "sha1": null, @@ -714,38 +1058,35 @@ "sha512": null, "bug_tracking_url": null, "code_view_url": null, - "vcs_url": { - "workspace": true - }, + "vcs_url": "https://github.com/tauri-apps/tauri", "copyright": null, "holder": null, - "declared_license_expression": "unknown", - "declared_license_expression_spdx": "LicenseRef-scancode-unknown", + "declared_license_expression": "apache-2.0 OR mit", + "declared_license_expression_spdx": "Apache-2.0 OR MIT", "license_detections": [ { - "license_expression": "unknown", + "license_expression": "apache-2.0 OR mit", "matches": [ { "score": 100.0, - "start_line": 1, - "end_line": 1, - "matched_length": 3, + "start_line": 17, + "end_line": 17, + "matched_length": 6, "match_coverage": 100.0, - "matcher": "5-undetected", - "license_expression": "unknown", - "rule_identifier": "package-manifest-unknown-06e9bf2862e301d2e03347936ee156170df84855", + "matcher": "2-aho", + "license_expression": "apache-2.0 OR mit", + "rule_identifier": "apache-2.0_or_mit_37.RULE", "rule_relevance": 100, - "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/package-manifest-unknown-06e9bf2862e301d2e03347936ee156170df84855", - "matched_text": "license {'workspace': True}" + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_37.RULE" } ], - "identifier": "unknown-91d148c3-19ed-e6b1-0d37-5f588dcd6a94" + "identifier": "apache_2_0_or_mit-8028b724-ab19-ab66-3288-312e7edc4fd9" } ], "other_license_expression": null, "other_license_expression_spdx": null, "other_license_detections": [], - "extracted_license_statement": "workspace: yes\n", + "extracted_license_statement": "Apache-2.0 OR MIT", "notice_text": null, "source_packages": [], "file_references": [], @@ -759,6 +1100,7 @@ } ], "for_packages": [ + "pkg:cargo/tauri@2.0.0-alpha.17?uuid=fixed-uid-done-for-testing-5642512d1758", "pkg:npm/tauri-workspace@0.0.0?uuid=fixed-uid-done-for-testing-5642512d1758" ], "detected_license_expression": null, @@ -819,8 +1161,11 @@ "url": null } ], - "keywords": [], - "homepage_url": null, + "keywords": [ + "gui", + "web-programming" + ], + "homepage_url": "https://tauri.app/", "download_url": null, "size": null, "sha1": null, @@ -829,7 +1174,7 @@ "sha512": null, "bug_tracking_url": null, "code_view_url": null, - "vcs_url": null, + "vcs_url": "https://github.com/tauri-apps/tauri", "copyright": null, "holder": null, "declared_license_expression": "apache-2.0 OR mit", @@ -840,19 +1185,18 @@ "matches": [ { "score": 100.0, - "start_line": 1, - "end_line": 1, - "matched_length": 5, + "start_line": 17, + "end_line": 17, + "matched_length": 6, "match_coverage": 100.0, - "matcher": "1-hash", + "matcher": "2-aho", "license_expression": "apache-2.0 OR mit", - "rule_identifier": "apache-2.0_or_mit_36.RULE", + "rule_identifier": "apache-2.0_or_mit_37.RULE", "rule_relevance": 100, - "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_36.RULE", - "matched_text": "Apache-2.0 OR MIT" + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_37.RULE" } ], - "identifier": "apache_2_0_or_mit-70d858d7-8968-9e7f-b90f-18b72fb96bef" + "identifier": "apache_2_0_or_mit-8028b724-ab19-ab66-3288-312e7edc4fd9" } ], "other_license_expression": null, @@ -872,6 +1216,7 @@ } ], "for_packages": [ + "pkg:cargo/restart@0.1.0?uuid=fixed-uid-done-for-testing-5642512d1758", "pkg:npm/tauri-workspace@0.0.0?uuid=fixed-uid-done-for-testing-5642512d1758" ], "detected_license_expression": "apache-2.0 OR mit", diff --git a/tests/packagedcode/data/cargo/scan.expected.json b/tests/packagedcode/data/cargo/scan.expected.json index bf4c6c1c862..178914cfbb2 100644 --- a/tests/packagedcode/data/cargo/scan.expected.json +++ b/tests/packagedcode/data/cargo/scan.expected.json @@ -142,7 +142,14 @@ "extracted_license_statement": "MIT OR Apache-2.0", "notice_text": null, "source_packages": [], - "extra_data": {}, + "extra_data": { + "workspace": { + "members": [ + "bench", + "daacfind" + ] + } + }, "repository_homepage_url": "https://crates.io/crates/daachorse", "repository_download_url": "https://crates.io/api/v1/crates/daachorse/0.4.1/download", "api_data_url": "https://crates.io/api/v1/crates/daachorse", @@ -883,7 +890,14 @@ "notice_text": null, "source_packages": [], "file_references": [], - "extra_data": {}, + "extra_data": { + "workspace": { + "members": [ + "bench", + "daacfind" + ] + } + }, "dependencies": [], "repository_homepage_url": "https://crates.io/crates/daachorse", "repository_download_url": "https://crates.io/api/v1/crates/daachorse/0.4.1/download",