-
Notifications
You must be signed in to change notification settings - Fork 109
Implement package assembly in scancode.io #485
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
Conversation
@JonoYang thanks for splitting those PR, much easier to review and test.
|
@JonoYang Did you have the chance to investigate the issue reported above? |
@tdruez The issue is caused by This is my PR on scancode-toolkit that modifies |
Sorting the items yielded by |
901737b
to
3da7a4e
Compare
I've updated |
3da7a4e
to
6bc7a2b
Compare
Looking at it again, I now realize there is no need to normalize the |
a5f926d
to
db94a74
Compare
@JonoYang I'm not sure your latest changes were intended to fix #485 (comment) but I'm still getting the same issue with the latest code. |
The PR with this fix has been merged into scancode-toolkit and should be available in the next version and I'll bump the scancode version in scio when it comes out. (aboutcode-org/scancode-toolkit#3042) |
db94a74
to
bca9ecb
Compare
@JonoYang I've merged the latest main branch including the ScanCode-toolkit v31.0.1 version.
I'm seeing an extra resource associated to the second package using the main branch that I do not see in this current branch: Also, shouldn't we only detect 1 package here?
|
This error is happening because we do not create the directory Resources when we create Resources from a docker image. The fix for this is to set After fixing that issue, the pipeline failed from a syntax error in After fixing the syntax error in |
With the current logic we have in packagedcode, there should be two Packages detected: 1 from the wheel itself and 1 from the extracted METADATA file. We would have 1 detected package if the
I guess we could be a bit more clever by update the package assembly code upstream to not process METADATA or other Package manifest files for an extracted wheel. Regarding the extra resource associated with the second package, I may have overlooked assigning a resource to a package somewhere. I will have to check in depth. This is due to |
a56250c
to
aef3e07
Compare
* Update test expectations Signed-off-by: Jono Yang <[email protected]>
Signed-off-by: Jono Yang <[email protected]>
Signed-off-by: Thomas Druez <[email protected]>
Signed-off-by: Jono Yang <[email protected]>
This reverts commit c9b8bed. Sorting Packages, Dependencies, and Resources from DatafileHandler.assemble() will never work. The code needs to be changed in scancode-toolkit. Signed-off-by: Jono Yang <[email protected]>
Signed-off-by: Jono Yang <[email protected]>
* This is so we are consistent with scancode-toolkit JSON output * Update expected test results Signed-off-by: Jono Yang <[email protected]>
Signed-off-by: Jono Yang <[email protected]>
Signed-off-by: Jono Yang <[email protected]>
* Update test expectations Signed-off-by: Jono Yang <[email protected]>
Signed-off-by: Jono Yang <[email protected]>
13da352
to
ef1e853
Compare
Signed-off-by: Jono Yang <[email protected]>
Signed-off-by: Jono Yang <[email protected]>
ef1e853
to
bb6757d
Compare
@JonoYang with the latest toolkit 31.0.2 the DoesNotExist is now properly fixed. |
* Update test expectations Signed-off-by: Jono Yang <[email protected]>
* Implement package assembly in scancode.io #447 Signed-off-by: Jono Yang <[email protected]> * Minor formatting changes for consistency #447 Signed-off-by: Thomas Druez <[email protected]> * Create DiscoveredPackages before other models #447 Signed-off-by: Jono Yang <[email protected]> * Revert "Create DiscoveredPackages before other models #447" This reverts commit c9b8bed. Sorting Packages, Dependencies, and Resources from DatafileHandler.assemble() will never work. The code needs to be changed in scancode-toolkit. Signed-off-by: Jono Yang <[email protected]> * Update migration #444 Signed-off-by: Jono Yang <[email protected]> * Return package_uids in for_packages #444 * This is so we are consistent with scancode-toolkit JSON output * Update expected test results Signed-off-by: Jono Yang <[email protected]> * Create directory Resources in docker pipeline #485 * Update test expectations Signed-off-by: Jono Yang <[email protected]> * Implement package assembly in scancode.io #447 Signed-off-by: Jono Yang <[email protected]> * Implement package assembly in scancode.io #447 Signed-off-by: Jono Yang <[email protected]> * Create DiscoveredDependency model #447 * Create new dependency list and detail views * Update assemble_packages() to create DiscoveredDependencies * Update test expectations Signed-off-by: Jono Yang <[email protected]> * Update fields on DiscoveredDependency #447 * Remove for_package_uid and replace with ForeignKey for_package * Remove datafile_path and replace with ForeignKey datafile_resource * Create properties for the two removed fields * Update dependency views to link to datafile_resource * Update expected test results Signed-off-by: Jono Yang <[email protected]> * Properly pluralize verbose name #447 Signed-off-by: Jono Yang <[email protected]> * Create new argument for create_from_data #447 * Add strip_datafile_path_root to DiscoveredDependency.create_from_data * This argument strips the root path segment from `datafile_path` before using the path to look up the corresponding CodebaseResource * This is used in the case where we are importing a scan from scancode-toolkit, where the root path segments are not stripped by default * Update expected test results Signed-off-by: Jono Yang <[email protected]> * Update prefetch_related #447 * Used cached_property for DiscoveredDependency properties Signed-off-by: Jono Yang <[email protected]> * Prefetch related models in output code #447 Signed-off-by: Jono Yang <[email protected]> * Import scancode.io 30.2.0 scans in load_codebase * Order DiscoveredDependencies by is_runtime, is_optional, is_resolved, and dependency_uid * Do not show dependency_uid value in DiscoveredDependency list view Signed-off-by: Jono Yang <[email protected]> * Revert changes for importing old scancode.io scans Signed-off-by: Jono Yang <[email protected]> * Regen migrations for DiscoveredDependency #447 Signed-off-by: Jono Yang <[email protected]> * Migrate DiscoveredPackage.dependencies #447 * Create migrations to generate new DiscoveredDependency objects from DiscoveredPackage.dependencies before removing the dependencies field Signed-off-by: Jono Yang <[email protected]> * Update test expectations #447 Signed-off-by: Jono Yang <[email protected]> * Remove accidentally committed files #447 Signed-off-by: Jono Yang <[email protected]> * Update migration logic #447 * Remove unnecessary else from DiscoveredDependency properties Signed-off-by: Jono Yang <[email protected]> * Add PackageURLMixin to DiscoveredDependency #447 Signed-off-by: Jono Yang <[email protected]> * Set DiscoveredDependencies purl fields #447 * Create migration that populates purl fields for existing DiscoveredDependencies Signed-off-by: Jono Yang <[email protected]> * Store purl values in purl fields #447 * Do not store dependency_uid in purl fields Signed-off-by: Jono Yang <[email protected]> * Remove purl field from DiscoveredDependency #447 * We are already storing this info in the purl fields * Create purl property on DiscoveredDependency for compatibility Signed-off-by: Jono Yang <[email protected]> * Update DependencyFilterSet #447 * Add search and purl fields Signed-off-by: Jono Yang <[email protected]> * Don't show DiscoveredDependencies purl fields #447 Signed-off-by: Jono Yang <[email protected]> * Update package detail view dependencies tab #447 Signed-off-by: Jono Yang <[email protected]> * Add package_type to dependency serializer #511 * Update test expectations Signed-off-by: Jono Yang <[email protected]> * Update expected test results Signed-off-by: Jono Yang <[email protected]> * Add dependency table column #447 Signed-off-by: Jono Yang <[email protected]> * Use tabset in dependency detail view #447 * Add package_type property to DiscoveredDependency Signed-off-by: Jono Yang <[email protected]> * Update dependency list view #447 * Use updated table header include * Update dependency presentation in package detail view * Show package uid on hover on for package tab Signed-off-by: Jono Yang <[email protected]> * Set DiscoveredDependency serializer fields #511 * Update DiscoveredDependency ordering Signed-off-by: Jono Yang <[email protected]> * Create donut chart for package type #447 Signed-off-by: Jono Yang <[email protected]> * Consolidate migrations #447 * Update DiscoveredDependency ordering * Update daglib test expectations Signed-off-by: Jono Yang <[email protected]> * Update dependency JSON ordering #447 * Update test expectations Signed-off-by: Jono Yang <[email protected]> * Set proper discovereddependencies related_name #447 Signed-off-by: Thomas Druez <[email protected]> * Fix template indentation #447 Signed-off-by: Thomas Druez <[email protected]> * Refactor update_from_data method into a UpdateFromDataMixin #447 Signed-off-by: Thomas Druez <[email protected]> * Fix the ProjectSerializer fields #447 Signed-off-by: Thomas Druez <[email protected]> * Fix test_scanpipe_api_project_detail unit test #447 Signed-off-by: Thomas Druez <[email protected]> * Add HTML title for list views #506 Signed-off-by: Thomas Druez <[email protected]> * Update dependency tabs #447 * Only show links in dependency for_package tab or dependency datafile_resource tab if there is a value Signed-off-by: Jono Yang <[email protected]> * Use UpdateFromDataMixin #447 * Use UpdateFromDataMixin in DiscoveredDependency * Create test for DiscoveredDependency.update_from_data() Signed-off-by: Jono Yang <[email protected]> * Fix formatting #447 Signed-off-by: Thomas Druez <[email protected]> Signed-off-by: Jono Yang <[email protected]> Signed-off-by: Thomas Druez <[email protected]> Co-authored-by: Thomas Druez <[email protected]>
This PR updates the application package scanning step in scancode.io to reflect the updates made to package scanning in scancode-toolkit. Package scanning is now a two step process, where we first detect Package data from CodebaseResources, then we iterate through all the Resources with Package data and process them using the new Package handlers from scancode-toolkit.