Skip to content

Commit

Permalink
Correct purl type for cocoapods #3081
Browse files Browse the repository at this point in the history
* Modify purl type for cocoapods packages and deps from `pods`
  to the correct type `cocoapods`.

Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
  • Loading branch information
AyanSinhaMahapatra committed Sep 7, 2022
1 parent f056c59 commit 5647e26
Show file tree
Hide file tree
Showing 19 changed files with 207 additions and 207 deletions.
16 changes: 8 additions & 8 deletions src/packagedcode/cocoapods.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def assemble(cls, package_data, resource, codebase, package_adder):
class PodspecHandler(BasePodHandler):
datasource_id = 'cocoapods_podspec'
path_patterns = ('*.podspec',)
default_package_type = 'pods'
default_package_type = 'cocoapods'
default_primary_language = 'Objective-C'
description = 'Cocoapods .podspec'
documentation_url = 'https://guides.cocoapods.org/syntax/podspec.html'
Expand Down Expand Up @@ -266,7 +266,7 @@ def parse(cls, location):
class PodfileHandler(PodspecHandler):
datasource_id = 'cocoapods_podfile'
path_patterns = ('*Podfile',)
default_package_type = 'pods'
default_package_type = 'cocoapods'
default_primary_language = 'Objective-C'
description = 'Cocoapods Podfile'
documentation_url = 'https://guides.cocoapods.org/using/the-podfile.html'
Expand All @@ -275,7 +275,7 @@ class PodfileHandler(PodspecHandler):
class PodfileLockHandler(BasePodHandler):
datasource_id = 'cocoapods_podfile_lock'
path_patterns = ('*Podfile.lock',)
default_package_type = 'pods'
default_package_type = 'cocoapods'
default_primary_language = 'Objective-C'
description = 'Cocoapods Podfile.lock'
documentation_url = 'https://guides.cocoapods.org/using/the-podfile.html'
Expand Down Expand Up @@ -336,7 +336,7 @@ def parse(cls, location):
class PodspecJsonHandler(models.DatafileHandler):
datasource_id = 'cocoapods_podspec_json'
path_patterns = ('*.podspec.json',)
default_package_type = 'pods'
default_package_type = 'cocoapods'
default_primary_language = 'Objective-C'
description = 'Cocoapods .podspec.json'
documentation_url = 'https://guides.cocoapods.org/syntax/podspec.html'
Expand Down Expand Up @@ -523,14 +523,14 @@ def parse_dep_requirements(dep):
For example:
>>> expected = PackageURL.from_string('pkg:pods/OHHTTPStubs@9.0.0'), '9.0.0'
>>> expected = PackageURL.from_string('pkg:cocoapods/OHHTTPStubs@9.0.0'), '9.0.0'
>>> assert parse_dep_requirements('OHHTTPStubs (9.0.0)') == expected
>>> expected = PackageURL.from_string('pkg:pods/OHHTTPStubs/NSURLSession'), None
>>> expected = PackageURL.from_string('pkg:cocoapods/OHHTTPStubs/NSURLSession'), None
>>> result = parse_dep_requirements('OHHTTPStubs/NSURLSession')
>>> assert result == expected, result
>>> expected = PackageURL.from_string('pkg:pods/AFNetworking/Serialization@3.0.4'), '= 3.0.4'
>>> expected = PackageURL.from_string('pkg:cocoapods/AFNetworking/Serialization@3.0.4'), '= 3.0.4'
>>> result = parse_dep_requirements(' AFNetworking/Serialization (= 3.0.4) ')
>>> assert result == expected, result
"""
Expand All @@ -552,7 +552,7 @@ def parse_dep_requirements(dep):
namespace = None

purl = PackageURL(
type='pods',
type='cocoapods',
namespace=namespace,
name=name,
version=version,
Expand Down
144 changes: 72 additions & 72 deletions tests/packagedcode/data/cocoapods/assemble/many-podspecs-expected.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
{
"dependencies": [
{
"purl": "pkg:pods/boost@1.76.0",
"purl": "pkg:cocoapods/boost@1.76.0",
"extracted_requirement": "1.76.0",
"scope": "requires",
"is_runtime": false,
"is_optional": true,
"is_resolved": true,
"resolved_package": {},
"extra_data": {},
"dependency_uid": "pkg:pods/boost@1.76.0?uuid=fixed-uid-done-for-testing-5642512d1758",
"for_package_uid": "pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"dependency_uid": "pkg:cocoapods/boost@1.76.0?uuid=fixed-uid-done-for-testing-5642512d1758",
"for_package_uid": "pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"datafile_path": "multiple-podspec/Podfile.lock",
"datasource_id": "cocoapods_podfile_lock"
},
{
"purl": "pkg:pods/Yoga@1.14.0",
"purl": "pkg:cocoapods/Yoga@1.14.0",
"extracted_requirement": "1.14.0",
"scope": "requires",
"is_runtime": false,
"is_optional": true,
"is_resolved": true,
"resolved_package": {},
"extra_data": {},
"dependency_uid": "pkg:pods/Yoga@1.14.0?uuid=fixed-uid-done-for-testing-5642512d1758",
"for_package_uid": "pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"dependency_uid": "pkg:cocoapods/Yoga@1.14.0?uuid=fixed-uid-done-for-testing-5642512d1758",
"for_package_uid": "pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"datafile_path": "multiple-podspec/Podfile.lock",
"datasource_id": "cocoapods_podfile_lock"
},
{
"purl": "pkg:pods/YogaKit@1.18.1",
"purl": "pkg:cocoapods/YogaKit@1.18.1",
"extracted_requirement": "1.18.1",
"scope": "requires",
"is_runtime": false,
"is_optional": true,
"is_resolved": true,
"resolved_package": {},
"extra_data": {},
"dependency_uid": "pkg:pods/YogaKit@1.18.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"for_package_uid": "pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"dependency_uid": "pkg:cocoapods/YogaKit@1.18.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"for_package_uid": "pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"datafile_path": "multiple-podspec/Podfile.lock",
"datasource_id": "cocoapods_podfile_lock"
}
],
"packages": [
{
"type": "pods",
"type": "cocoapods",
"namespace": null,
"name": "RxDataSources",
"version": "4.0.1",
Expand Down Expand Up @@ -83,17 +83,17 @@
"repository_homepage_url": "https://cocoapods.org/pods/RxDataSources",
"repository_download_url": "https://github.com/RxSwiftCommunity/RxDataSources/archive/refs/tags/4.0.1.zip",
"api_data_url": "https://raw.githubusercontent.com/CocoaPods/Specs/blob/master/Specs/9/a/4/RxDataSources/4.0.1/RxDataSources.podspec.json",
"package_uid": "pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"package_uid": "pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"datafile_paths": [
"multiple-podspec/RxDataSources.podspec"
],
"datasource_ids": [
"cocoapods_podspec"
],
"purl": "pkg:pods/RxDataSources@4.0.1"
"purl": "pkg:cocoapods/RxDataSources@4.0.1"
},
{
"type": "pods",
"type": "cocoapods",
"namespace": null,
"name": "Differentiator",
"version": "4.0.1",
Expand Down Expand Up @@ -131,14 +131,14 @@
"repository_homepage_url": "https://cocoapods.org/pods/Differentiator",
"repository_download_url": "https://github.com/RxSwiftCommunity/RxDataSources/archive/refs/tags/4.0.1.zip",
"api_data_url": "https://raw.githubusercontent.com/CocoaPods/Specs/blob/master/Specs/5/9/8/Differentiator/4.0.1/Differentiator.podspec.json",
"package_uid": "pkg:pods/Differentiator@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"package_uid": "pkg:cocoapods/Differentiator@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
"datafile_paths": [
"multiple-podspec/Differentiator.podspec"
],
"datasource_ids": [
"cocoapods_podspec"
],
"purl": "pkg:pods/Differentiator@4.0.1"
"purl": "pkg:cocoapods/Differentiator@4.0.1"
}
],
"files": [
Expand All @@ -154,7 +154,7 @@
"type": "file",
"package_data": [
{
"type": "pods",
"type": "cocoapods",
"namespace": null,
"name": "Differentiator",
"version": "4.0.1",
Expand Down Expand Up @@ -195,11 +195,11 @@
"repository_download_url": "https://github.com/RxSwiftCommunity/RxDataSources/archive/refs/tags/4.0.1.zip",
"api_data_url": "https://raw.githubusercontent.com/CocoaPods/Specs/blob/master/Specs/5/9/8/Differentiator/4.0.1/Differentiator.podspec.json",
"datasource_id": "cocoapods_podspec",
"purl": "pkg:pods/Differentiator@4.0.1"
"purl": "pkg:cocoapods/Differentiator@4.0.1"
}
],
"for_packages": [
"pkg:pods/Differentiator@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
"pkg:cocoapods/Differentiator@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
],
"scan_errors": []
},
Expand All @@ -208,7 +208,7 @@
"type": "file",
"package_data": [
{
"type": "pods",
"type": "cocoapods",
"namespace": null,
"name": null,
"version": null,
Expand Down Expand Up @@ -245,7 +245,7 @@
}
],
"for_packages": [
"pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
"pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
],
"scan_errors": []
},
Expand All @@ -254,7 +254,7 @@
"type": "file",
"package_data": [
{
"type": "pods",
"type": "cocoapods",
"namespace": null,
"name": null,
"version": null,
Expand Down Expand Up @@ -284,7 +284,7 @@
"extra_data": {},
"dependencies": [
{
"purl": "pkg:pods/boost@1.76.0",
"purl": "pkg:cocoapods/boost@1.76.0",
"extracted_requirement": "1.76.0",
"scope": "requires",
"is_runtime": false,
Expand All @@ -294,7 +294,7 @@
"extra_data": {}
},
{
"purl": "pkg:pods/Yoga@1.14.0",
"purl": "pkg:cocoapods/Yoga@1.14.0",
"extracted_requirement": "1.14.0",
"scope": "requires",
"is_runtime": false,
Expand All @@ -304,7 +304,7 @@
"extra_data": {}
},
{
"purl": "pkg:pods/YogaKit@1.18.1",
"purl": "pkg:cocoapods/YogaKit@1.18.1",
"extracted_requirement": "1.18.1",
"scope": "requires",
"is_runtime": false,
Expand All @@ -322,7 +322,7 @@
}
],
"for_packages": [
"pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
"pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
],
"scan_errors": []
},
Expand All @@ -331,7 +331,7 @@
"type": "file",
"package_data": [
{
"type": "pods",
"type": "cocoapods",
"namespace": null,
"name": "RxDataSources",
"version": "4.0.1",
Expand Down Expand Up @@ -372,11 +372,11 @@
"repository_download_url": "https://github.com/RxSwiftCommunity/RxDataSources/archive/refs/tags/4.0.1.zip",
"api_data_url": "https://raw.githubusercontent.com/CocoaPods/Specs/blob/master/Specs/9/a/4/RxDataSources/4.0.1/RxDataSources.podspec.json",
"datasource_id": "cocoapods_podspec",
"purl": "pkg:pods/RxDataSources@4.0.1"
"purl": "pkg:cocoapods/RxDataSources@4.0.1"
}
],
"for_packages": [
"pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
"pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
],
"scan_errors": []
}
Expand Down
Loading

0 comments on commit 5647e26

Please sign in to comment.