Skip to content

Convert package data dict to PackageData #2971 #2973

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

Merged
merged 2 commits into from
May 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/packagedcode/debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Member 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.

package.update(
package_data=pkgdt,
datafile_path=res.path,
)
)

res.for_packages.append(package_uid)
res.save(codebase)
Expand Down Expand Up @@ -545,7 +546,7 @@ def parse_debian_files_list(location, datasource_id, package_type):

ref = models.FileReference(path=path, md5=md5sum)
file_references.append(ref)

if not file_references:
return

Expand Down