Skip to content

Commit

Permalink
Add other_license* attributes for packages #2065
Browse files Browse the repository at this point in the history
- Add `other_license_expression` attribute
- Add `other_license_expression_spdx` attribute
- Add `other_license_detections` attribute

For debian copyright files `declared_license_expression` is
set to the primary license, if present, and other licenses
are set to the `other_license_expression` introduced here.

Reference: #2065
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
  • Loading branch information
AyanSinhaMahapatra committed Aug 8, 2022
1 parent dca0371 commit 174a097
Show file tree
Hide file tree
Showing 1,249 changed files with 15,072 additions and 6,564 deletions.
3 changes: 3 additions & 0 deletions src/licensedcode/data/rules/apache-2.0_1112.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
license_expression: apache-2.0
is_license_notice: yes
relevance: 100
ignorable_urls:
- http://www.apache.org/licenses/LICENSE-2.0.html

198 changes: 165 additions & 33 deletions src/packagedcode/debian_copyright.py

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion src/packagedcode/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ class PackageData(IdentifiablePackageData):
declared_license_expression_spdx = String(
label='SPDX license expression',
help='The SPDX license expression for this package converted '
'from its declared_license_Expression.')
'from its declared_license_expression.')

license_detections = List(
item_type=dict,
Expand All @@ -630,6 +630,26 @@ class PackageData(IdentifiablePackageData):
'routine or convention.'
)

other_license_expression = String(
label='other license expression',
help='The license expression for this package which is different from the '
'declared_license_expression, (i.e. not the primary license) '
'routine or convention.')

other_license_expression_spdx = String(
label='other SPDX license expression',
help='The other SPDX license expression for this package converted '
'from its other_license_expression.')

other_license_detections = List(
item_type=dict,
label='List of other LicenseDetections',
help='A list of LicenseDetection mappings which is different from the '
'declared_license_expression, (i.e. not the primary license) '
'These are detections for the detection for the license expressions '
'in other_license_expression. '
)

extracted_license_statement = String(
label='extracted license statement',
help='The license statement mention, tag or text as found in a '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"is_optional": false,
"is_resolved": false,
"resolved_package": {},
"extra_data": {},
"dependency_uid": "pkg:npm/dicer?uuid=fixed-uid-done-for-testing-5642512d1758",
"for_package_uid": "pkg:npm/busboy@0.2.14?uuid=fixed-uid-done-for-testing-5642512d1758",
"datafile_path": "package.json",
Expand All @@ -21,6 +22,7 @@
"is_optional": false,
"is_resolved": false,
"resolved_package": {},
"extra_data": {},
"dependency_uid": "pkg:npm/readable-stream?uuid=fixed-uid-done-for-testing-5642512d1758",
"for_package_uid": "pkg:npm/busboy@0.2.14?uuid=fixed-uid-done-for-testing-5642512d1758",
"datafile_path": "package.json",
Expand Down Expand Up @@ -113,6 +115,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "[{'type': 'MIT', 'url': 'http://github.com/mscdex/busboy/raw/master/LICENSE'}]",
"notice_text": null,
"source_packages": [],
Expand Down Expand Up @@ -270,6 +275,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "[{'type': 'MIT', 'url': 'http://github.com/mscdex/busboy/raw/master/LICENSE'}]",
"notice_text": null,
"source_packages": [],
Expand All @@ -283,7 +291,8 @@
"is_runtime": true,
"is_optional": false,
"is_resolved": false,
"resolved_package": {}
"resolved_package": {},
"extra_data": {}
},
{
"purl": "pkg:npm/readable-stream",
Expand All @@ -292,7 +301,8 @@
"is_runtime": true,
"is_optional": false,
"is_resolved": false,
"resolved_package": {}
"resolved_package": {},
"extra_data": {}
}
],
"repository_homepage_url": "https://www.npmjs.com/package/busboy",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "['Artistic-2.0 OR MIT']",
"notice_text": null,
"source_packages": [],
Expand Down Expand Up @@ -384,6 +387,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "['Artistic-2.0 OR MIT']",
"notice_text": null,
"source_packages": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "['Artistic-2.0 OR MIT']",
"notice_text": null,
"source_packages": [],
Expand Down Expand Up @@ -381,6 +384,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "['Artistic-2.0 OR MIT']",
"notice_text": null,
"source_packages": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "['Artistic-2.0 OR MIT']",
"notice_text": null,
"source_packages": [],
Expand Down Expand Up @@ -400,6 +403,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "['Artistic-2.0 OR MIT']",
"notice_text": null,
"source_packages": [],
Expand Down
12 changes: 12 additions & 0 deletions tests/packagedcode/data/about/aboutfiles.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "mit",
"notice_text": null,
"source_packages": [],
Expand Down Expand Up @@ -177,6 +180,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "mit",
"notice_text": null,
"source_packages": [],
Expand Down Expand Up @@ -307,6 +313,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "mit",
"notice_text": null,
"source_packages": [],
Expand Down Expand Up @@ -419,6 +428,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "mit",
"notice_text": null,
"source_packages": [],
Expand Down
3 changes: 3 additions & 0 deletions tests/packagedcode/data/about/apipkg.ABOUT-expected
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "mit",
"notice_text": null,
"source_packages": [],
Expand Down
3 changes: 3 additions & 0 deletions tests/packagedcode/data/about/appdirs.ABOUT-expected
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "mit",
"notice_text": null,
"source_packages": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "GPL-2.0-only",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -312,6 +315,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "MIT",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -435,6 +441,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "GPL-2.0-only",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -603,6 +612,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "GPL-2.0-only",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -834,6 +846,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "MIT",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -1324,6 +1339,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "MPL-2.0 AND MIT",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -1447,6 +1465,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "OpenSSL",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -1660,6 +1681,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "OpenSSL",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -1783,6 +1807,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "GPL-2.0-only",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -1894,6 +1921,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "Zlib",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -2017,6 +2047,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "GPL-2.0-only",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -2137,6 +2170,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "GPL-2.0-only",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -2280,6 +2316,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "MIT BSD GPL2+",
"notice_text": null,
"source_packages": [
Expand Down Expand Up @@ -2443,6 +2482,9 @@
]
}
],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "BSD-2-Clause AND BSD-3-Clause",
"notice_text": null,
"source_packages": [
Expand Down
Loading

0 comments on commit 174a097

Please sign in to comment.