Skip to content

Commit 6007301

Browse files
Merge pull request #3096 from nexB/3081-correct-type-cocoapods
Correct purl type for cocoapods #3081
2 parents f056c59 + bf78589 commit 6007301

20 files changed

+214
-207
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ Package detection:
3232

3333
https://github.com/nexB/scancode-toolkit/issues/3083
3434

35+
- Fix issue where we were returning incorrect purl package ``type`` for cocoapods.
36+
``pods`` was being returned as a purl type for cocoapods, it should be
37+
``cocoapods`` instead.
38+
https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#cocoapods
39+
40+
https://github.com/nexB/scancode-toolkit/issues/3081
41+
3542
License detection:
3643
~~~~~~~~~~~~~~~~~~~
3744

src/packagedcode/cocoapods.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def assemble(cls, package_data, resource, codebase, package_adder):
194194
class PodspecHandler(BasePodHandler):
195195
datasource_id = 'cocoapods_podspec'
196196
path_patterns = ('*.podspec',)
197-
default_package_type = 'pods'
197+
default_package_type = 'cocoapods'
198198
default_primary_language = 'Objective-C'
199199
description = 'Cocoapods .podspec'
200200
documentation_url = 'https://guides.cocoapods.org/syntax/podspec.html'
@@ -266,7 +266,7 @@ def parse(cls, location):
266266
class PodfileHandler(PodspecHandler):
267267
datasource_id = 'cocoapods_podfile'
268268
path_patterns = ('*Podfile',)
269-
default_package_type = 'pods'
269+
default_package_type = 'cocoapods'
270270
default_primary_language = 'Objective-C'
271271
description = 'Cocoapods Podfile'
272272
documentation_url = 'https://guides.cocoapods.org/using/the-podfile.html'
@@ -275,7 +275,7 @@ class PodfileHandler(PodspecHandler):
275275
class PodfileLockHandler(BasePodHandler):
276276
datasource_id = 'cocoapods_podfile_lock'
277277
path_patterns = ('*Podfile.lock',)
278-
default_package_type = 'pods'
278+
default_package_type = 'cocoapods'
279279
default_primary_language = 'Objective-C'
280280
description = 'Cocoapods Podfile.lock'
281281
documentation_url = 'https://guides.cocoapods.org/using/the-podfile.html'
@@ -336,7 +336,7 @@ def parse(cls, location):
336336
class PodspecJsonHandler(models.DatafileHandler):
337337
datasource_id = 'cocoapods_podspec_json'
338338
path_patterns = ('*.podspec.json',)
339-
default_package_type = 'pods'
339+
default_package_type = 'cocoapods'
340340
default_primary_language = 'Objective-C'
341341
description = 'Cocoapods .podspec.json'
342342
documentation_url = 'https://guides.cocoapods.org/syntax/podspec.html'
@@ -523,14 +523,14 @@ def parse_dep_requirements(dep):
523523
524524
For example:
525525
526-
>>> expected = PackageURL.from_string('pkg:pods/OHHTTPStubs@9.0.0'), '9.0.0'
526+
>>> expected = PackageURL.from_string('pkg:cocoapods/OHHTTPStubs@9.0.0'), '9.0.0'
527527
>>> assert parse_dep_requirements('OHHTTPStubs (9.0.0)') == expected
528528
529-
>>> expected = PackageURL.from_string('pkg:pods/OHHTTPStubs/NSURLSession'), None
529+
>>> expected = PackageURL.from_string('pkg:cocoapods/OHHTTPStubs/NSURLSession'), None
530530
>>> result = parse_dep_requirements('OHHTTPStubs/NSURLSession')
531531
>>> assert result == expected, result
532532
533-
>>> expected = PackageURL.from_string('pkg:pods/AFNetworking/Serialization@3.0.4'), '= 3.0.4'
533+
>>> expected = PackageURL.from_string('pkg:cocoapods/AFNetworking/Serialization@3.0.4'), '= 3.0.4'
534534
>>> result = parse_dep_requirements(' AFNetworking/Serialization (= 3.0.4) ')
535535
>>> assert result == expected, result
536536
"""
@@ -552,7 +552,7 @@ def parse_dep_requirements(dep):
552552
namespace = None
553553

554554
purl = PackageURL(
555-
type='pods',
555+
type='cocoapods',
556556
namespace=namespace,
557557
name=name,
558558
version=version,

tests/packagedcode/data/cocoapods/assemble/many-podspecs-expected.json

Lines changed: 72 additions & 72 deletions
Large diffs are not rendered by default.

tests/packagedcode/data/cocoapods/assemble/multiple-podspec-expected.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
{
22
"dependencies": [
33
{
4-
"purl": "pkg:pods/boost@1.76.0",
4+
"purl": "pkg:cocoapods/boost@1.76.0",
55
"extracted_requirement": "1.76.0",
66
"scope": "requires",
77
"is_runtime": false,
88
"is_optional": true,
99
"is_resolved": true,
1010
"resolved_package": {},
1111
"extra_data": {},
12-
"dependency_uid": "pkg:pods/boost@1.76.0?uuid=fixed-uid-done-for-testing-5642512d1758",
13-
"for_package_uid": "pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
12+
"dependency_uid": "pkg:cocoapods/boost@1.76.0?uuid=fixed-uid-done-for-testing-5642512d1758",
13+
"for_package_uid": "pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
1414
"datafile_path": "multiple-podspec/Podfile.lock",
1515
"datasource_id": "cocoapods_podfile_lock"
1616
},
1717
{
18-
"purl": "pkg:pods/Yoga@1.14.0",
18+
"purl": "pkg:cocoapods/Yoga@1.14.0",
1919
"extracted_requirement": "1.14.0",
2020
"scope": "requires",
2121
"is_runtime": false,
2222
"is_optional": true,
2323
"is_resolved": true,
2424
"resolved_package": {},
2525
"extra_data": {},
26-
"dependency_uid": "pkg:pods/Yoga@1.14.0?uuid=fixed-uid-done-for-testing-5642512d1758",
27-
"for_package_uid": "pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
26+
"dependency_uid": "pkg:cocoapods/Yoga@1.14.0?uuid=fixed-uid-done-for-testing-5642512d1758",
27+
"for_package_uid": "pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
2828
"datafile_path": "multiple-podspec/Podfile.lock",
2929
"datasource_id": "cocoapods_podfile_lock"
3030
},
3131
{
32-
"purl": "pkg:pods/YogaKit@1.18.1",
32+
"purl": "pkg:cocoapods/YogaKit@1.18.1",
3333
"extracted_requirement": "1.18.1",
3434
"scope": "requires",
3535
"is_runtime": false,
3636
"is_optional": true,
3737
"is_resolved": true,
3838
"resolved_package": {},
3939
"extra_data": {},
40-
"dependency_uid": "pkg:pods/YogaKit@1.18.1?uuid=fixed-uid-done-for-testing-5642512d1758",
41-
"for_package_uid": "pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
40+
"dependency_uid": "pkg:cocoapods/YogaKit@1.18.1?uuid=fixed-uid-done-for-testing-5642512d1758",
41+
"for_package_uid": "pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
4242
"datafile_path": "multiple-podspec/Podfile.lock",
4343
"datasource_id": "cocoapods_podfile_lock"
4444
}
4545
],
4646
"packages": [
4747
{
48-
"type": "pods",
48+
"type": "cocoapods",
4949
"namespace": null,
5050
"name": "RxDataSources",
5151
"version": "4.0.1",
@@ -83,17 +83,17 @@
8383
"repository_homepage_url": "https://cocoapods.org/pods/RxDataSources",
8484
"repository_download_url": "https://github.com/RxSwiftCommunity/RxDataSources/archive/refs/tags/4.0.1.zip",
8585
"api_data_url": "https://raw.githubusercontent.com/CocoaPods/Specs/blob/master/Specs/9/a/4/RxDataSources/4.0.1/RxDataSources.podspec.json",
86-
"package_uid": "pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
86+
"package_uid": "pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
8787
"datafile_paths": [
8888
"multiple-podspec/RxDataSources.podspec"
8989
],
9090
"datasource_ids": [
9191
"cocoapods_podspec"
9292
],
93-
"purl": "pkg:pods/RxDataSources@4.0.1"
93+
"purl": "pkg:cocoapods/RxDataSources@4.0.1"
9494
},
9595
{
96-
"type": "pods",
96+
"type": "cocoapods",
9797
"namespace": null,
9898
"name": "Differentiator",
9999
"version": "4.0.1",
@@ -131,14 +131,14 @@
131131
"repository_homepage_url": "https://cocoapods.org/pods/Differentiator",
132132
"repository_download_url": "https://github.com/RxSwiftCommunity/RxDataSources/archive/refs/tags/4.0.1.zip",
133133
"api_data_url": "https://raw.githubusercontent.com/CocoaPods/Specs/blob/master/Specs/5/9/8/Differentiator/4.0.1/Differentiator.podspec.json",
134-
"package_uid": "pkg:pods/Differentiator@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
134+
"package_uid": "pkg:cocoapods/Differentiator@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758",
135135
"datafile_paths": [
136136
"multiple-podspec/Differentiator.podspec"
137137
],
138138
"datasource_ids": [
139139
"cocoapods_podspec"
140140
],
141-
"purl": "pkg:pods/Differentiator@4.0.1"
141+
"purl": "pkg:cocoapods/Differentiator@4.0.1"
142142
}
143143
],
144144
"files": [
@@ -154,7 +154,7 @@
154154
"type": "file",
155155
"package_data": [
156156
{
157-
"type": "pods",
157+
"type": "cocoapods",
158158
"namespace": null,
159159
"name": "Differentiator",
160160
"version": "4.0.1",
@@ -195,11 +195,11 @@
195195
"repository_download_url": "https://github.com/RxSwiftCommunity/RxDataSources/archive/refs/tags/4.0.1.zip",
196196
"api_data_url": "https://raw.githubusercontent.com/CocoaPods/Specs/blob/master/Specs/5/9/8/Differentiator/4.0.1/Differentiator.podspec.json",
197197
"datasource_id": "cocoapods_podspec",
198-
"purl": "pkg:pods/Differentiator@4.0.1"
198+
"purl": "pkg:cocoapods/Differentiator@4.0.1"
199199
}
200200
],
201201
"for_packages": [
202-
"pkg:pods/Differentiator@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
202+
"pkg:cocoapods/Differentiator@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
203203
],
204204
"scan_errors": []
205205
},
@@ -208,7 +208,7 @@
208208
"type": "file",
209209
"package_data": [
210210
{
211-
"type": "pods",
211+
"type": "cocoapods",
212212
"namespace": null,
213213
"name": null,
214214
"version": null,
@@ -245,7 +245,7 @@
245245
}
246246
],
247247
"for_packages": [
248-
"pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
248+
"pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
249249
],
250250
"scan_errors": []
251251
},
@@ -254,7 +254,7 @@
254254
"type": "file",
255255
"package_data": [
256256
{
257-
"type": "pods",
257+
"type": "cocoapods",
258258
"namespace": null,
259259
"name": null,
260260
"version": null,
@@ -284,7 +284,7 @@
284284
"extra_data": {},
285285
"dependencies": [
286286
{
287-
"purl": "pkg:pods/boost@1.76.0",
287+
"purl": "pkg:cocoapods/boost@1.76.0",
288288
"extracted_requirement": "1.76.0",
289289
"scope": "requires",
290290
"is_runtime": false,
@@ -294,7 +294,7 @@
294294
"extra_data": {}
295295
},
296296
{
297-
"purl": "pkg:pods/Yoga@1.14.0",
297+
"purl": "pkg:cocoapods/Yoga@1.14.0",
298298
"extracted_requirement": "1.14.0",
299299
"scope": "requires",
300300
"is_runtime": false,
@@ -304,7 +304,7 @@
304304
"extra_data": {}
305305
},
306306
{
307-
"purl": "pkg:pods/YogaKit@1.18.1",
307+
"purl": "pkg:cocoapods/YogaKit@1.18.1",
308308
"extracted_requirement": "1.18.1",
309309
"scope": "requires",
310310
"is_runtime": false,
@@ -322,7 +322,7 @@
322322
}
323323
],
324324
"for_packages": [
325-
"pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
325+
"pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
326326
],
327327
"scan_errors": []
328328
},
@@ -331,7 +331,7 @@
331331
"type": "file",
332332
"package_data": [
333333
{
334-
"type": "pods",
334+
"type": "cocoapods",
335335
"namespace": null,
336336
"name": "RxDataSources",
337337
"version": "4.0.1",
@@ -372,11 +372,11 @@
372372
"repository_download_url": "https://github.com/RxSwiftCommunity/RxDataSources/archive/refs/tags/4.0.1.zip",
373373
"api_data_url": "https://raw.githubusercontent.com/CocoaPods/Specs/blob/master/Specs/9/a/4/RxDataSources/4.0.1/RxDataSources.podspec.json",
374374
"datasource_id": "cocoapods_podspec",
375-
"purl": "pkg:pods/RxDataSources@4.0.1"
375+
"purl": "pkg:cocoapods/RxDataSources@4.0.1"
376376
}
377377
],
378378
"for_packages": [
379-
"pkg:pods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
379+
"pkg:cocoapods/RxDataSources@4.0.1?uuid=fixed-uid-done-for-testing-5642512d1758"
380380
],
381381
"scan_errors": []
382382
}

0 commit comments

Comments
 (0)