Skip to content

Commit

Permalink
Set license_detections field #518
Browse files Browse the repository at this point in the history
Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed Aug 5, 2024
1 parent ec9b778 commit c281575
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions minecode/mappers/bower.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def build_packages_from_jsonfile(metadata, uri=None, purl=None):
keywords=keywords_content,
homepage_url=content.get('homepage'),
datasource_id='bower_json',
license_detections=[],
)

if extracted_license_statement:
Expand Down
1 change: 1 addition & 0 deletions minecode/mappers/cpan.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def build_packages_from_release_json(metadata, uri=None):
version=release.get('version'),
download_url=release.get('download_url'),
extracted_license_statement=extracted_license_statement,
license_detections=[],
# the date format passing is like:
# "2014-04-20T21:30:13"
release_date=parse_date(release.get('date')),
Expand Down
2 changes: 2 additions & 0 deletions minecode/mappers/googlecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def build_packages_from_projectsjson_v2(metadata, purl=None, uri=None):
license_name = metadata.get('license')
if license_name:
common_data['extracted_license_statement'] = license_name
common_data['license_detections'] = []

keywords = []
labels = metadata.get('labels')
Expand Down Expand Up @@ -100,6 +101,7 @@ def build_packages_from_projectsjson_v1(metadata, purl=None, uri=None):
license_name = metadata.get('license')
if license_name:
common_data['extracted_license_statement'] = license_name
common_data['license_detections'] = []

keywords = []
labels = metadata.get('labels')
Expand Down
2 changes: 2 additions & 0 deletions minecode/mappers/nuget.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def build_packages_with_json(metadata, purl=None):
homepage_url=metadata.get('projectUrl'),
description=description,
extracted_license_statement=licenseUrl,
license_detections=[],
copyright=copyr,
parties=authors,
keywords=keywords,
Expand Down Expand Up @@ -168,6 +169,7 @@ def build_packages_from_html(metadata, uri, purl=None):
description=description,
download_url=download_url,
extracted_license_statement=license_value,
license_detections=[],
copyright=copyright_value
)
package = scan_models.Package.from_package_data(
Expand Down
1 change: 1 addition & 0 deletions minecode/mappers/openssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def build_packages(resource_uri, purl=None):
size=resource_uri.size,
release_date=parse_date(resource_uri.last_modified_date),
extracted_license_statement='OpenSSL License',
license_detections=[],
homepage_url='https://www.openssl.org/',
download_url=uri,
copyright='Copyright (c) 1998-2018 The OpenSSL Project\nCopyright (c) 1995-1998 Eric A. Young, Tim J. Hudson\nAll rights reserved.',
Expand Down
1 change: 1 addition & 0 deletions minecode/mappers/packagist.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def build_packages_with_json(metadata, purl=None, uri=None):
extracted_license_statement.add(lic)
if extracted_license_statement:
common['extracted_license_statement'] = list(extracted_license_statement)
common['license_detections'] = []

dependencies = []
for name, version in version_content.get('require', {}).items():
Expand Down
1 change: 1 addition & 0 deletions minecode/mappers/sourceforge.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def build_packages_from_metafile(metadata, purl=None, uri=None):
name=metadata.get('shortname', metadata.get('name')),
description=description,
homepage_url=metadata.get('external_homepage', metadata.get('url')),
license_detections=[],
)

devs = metadata.get('developers') or []
Expand Down
2 changes: 2 additions & 0 deletions minecode/tests/testfiles/bower/expected_28msec_bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"extracted_license_statement":null,
"notice_text":null,
"source_packages":[],
"is_private":false,
"is_virtual":false,
"extra_data":{},
"repository_homepage_url":null,
"repository_download_url":null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"extracted_license_statement":"- NewBSD\n",
"notice_text":null,
"source_packages":[],
"is_private":false,
"is_virtual":false,
"extra_data":{},
"repository_homepage_url":null,
"repository_download_url":null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@
"extracted_license_statement":null,
"notice_text":null,
"source_packages":[],
"is_private":false,
"is_virtual":false,
"extra_data":{},
"repository_homepage_url":null,
"repository_download_url":null,
"api_data_url":null,
"package_uid":"pkg:sourceforge/odanur?uuid=fixed-uid-done-for-testing-5642512d1758",
"datafile_paths":[],
"datafile_paths":[
null
],
"datasource_ids":[
"sourceforge_metadata"
],
Expand Down

0 comments on commit c281575

Please sign in to comment.