forked from aboutcode-org/scancode-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request aboutcode-org#3682 from nexB/update-package-handlers
Update package handlers
- Loading branch information
Showing
30 changed files
with
232 additions
and
13,679 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -582,7 +582,10 @@ def parse_debian_files_list(location, datasource_id, package_type): | |
name, _, arch = filename.partition(':') | ||
qualifiers['arch'] = arch | ||
else: | ||
name = filename | ||
name = None | ||
# For DebianMd5sumFilelistInPackageHandler we cannot infer name | ||
if not name == "md5sums": | ||
name = filename | ||
|
||
file_references = [] | ||
with open(location) as info_file: | ||
|
@@ -643,12 +646,14 @@ def build_package_data(debian_data, datasource_id, package_type='deb', distro=No | |
|
||
maintainer = debian_data.get('maintainer') | ||
if maintainer: | ||
party = models.Party(role='maintainer', name=maintainer) | ||
maintainer_name, maintainer_email = parse_debian_maintainers(maintainer) | ||
party = models.Party(role='maintainer', name=maintainer_name, email=maintainer_email) | ||
parties.append(party) | ||
|
||
orig_maintainer = debian_data.get('original_maintainer') | ||
if orig_maintainer: | ||
party = models.Party(role='original_maintainer', name=orig_maintainer) | ||
maintainer_name, maintainer_email = parse_debian_maintainers(orig_maintainer) | ||
party = models.Party(role='maintainer', name=maintainer_name, email=maintainer_email) | ||
parties.append(party) | ||
|
||
keywords = [] | ||
|
@@ -708,6 +713,26 @@ def build_package_data(debian_data, datasource_id, package_type='deb', distro=No | |
) | ||
|
||
|
||
def parse_debian_maintainers(maintainer): | ||
""" | ||
Get name and email values from a debian maintainer string. | ||
Example string: | ||
Debian systemd Maintainers <[email protected]> | ||
""" | ||
email_wrappers = ["<", ">"] | ||
has_email = "@" in maintainer and all([ | ||
True | ||
for char in email_wrappers | ||
if char in maintainer | ||
]) | ||
if not has_email: | ||
return maintainer, None | ||
|
||
name, _, email = maintainer.rpartition("<") | ||
return name.rstrip(" "), email.rstrip(">") | ||
|
||
|
||
def populate_debian_namespace(packages): | ||
""" | ||
For an iterable of debian `packages`, populate the | ||
|
36 changes: 0 additions & 36 deletions
36
tests/formattedcode/data/cyclonedx/simple-icu-expected.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.