Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert package data dict to PackageData #2971 #2973

Merged
merged 2 commits into from
May 20, 2022

Conversation

JonoYang
Copy link
Contributor

@JonoYang JonoYang commented May 20, 2022

This PR addresses the issue where scancode encountered errors when scanning for system packages from a distroless docker root filesystem. The issue was that the package data on the resource, which is in a dictionary, was being passed into Package.update() when Package.update() was expecting a PackageData object instead.

Signed-off-by: Jono Yang <jyang@nexb.com>
@JonoYang JonoYang requested a review from pombredanne May 20, 2022 01:11
@@ -402,10 +402,11 @@ def assemble(cls, package_data, resource, codebase):
continue

for pkgdt in res.package_data:
pkgdt = models.PackageData.from_dict(pkgdt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this could be done directly in package.update where we could accept package_data as a mapping or as an object and convert to object if needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I've updated Package.update() to convert the package data to a PackageData object if the incoming package data is in a dictionary.

Signed-off-by: Jono Yang <jyang@nexb.com>
Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Thank :)

@pombredanne pombredanne merged commit 175383f into develop May 20, 2022
@pombredanne pombredanne deleted the 2971-distroless-system-packages branch May 20, 2022 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants