fix(organize): use the part's install directories
Metadata
Current evaluation
Merged fix for organize_files() which incorrectly used relative paths, organizing files in cwd instead of base_dir. The function now accepts the part's install directories directly. Approved by two reviewers and passed CI.
Suggested action: —
No scores available.
Issue body
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
-----
Fixes an issue discovered via https://github.com/canonical/snapcraft/pull/4654 where `organize_files()` would organize in the `cwd` instead of the project's `base_dir`.
The problem was that `organize_files()` was redefining a part's install directories incorrectly by creating relative filepaths.
To fix this, `organize_files` now accepts the part's install directories instead of redefining them.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for organize_files() which incorrectly used relative paths, organizing files in cwd instead of base_dir. The function now accepts the part's install directories directly. Approved by two reviewers and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for organize_files() which incorrectly organized files in the current working directory. The function now accepts the part's install directories directly, resolving the relative path bug. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #690 fix(organize): use the part's install directories (#689) | craft-parts | merged | Merged fix for organize_files() using the current working directory instead of the project base directory. The function now accepts the part's install directories directly, eliminating relative path redefinition. | |
| #1562 fix(organize): reject sources outside install dir | craft-parts | merged | Merged fix preventing the organize step from processing sources outside the part install directory. Blocks absolute paths and directory traversal while preserving symlink behavior. Unrelated CI failures did not block the merge. | |
| #1525 Directory traversal issue when organizing a part | craft-parts | closed | Fixed via PR #1562. Added validation to reject organize source paths escaping the part install directory, blocking directory traversal and absolute path misuse. Merged and closed. | |
| #1201 fix: handle trying to organize a file to itself | craft-parts | merged | Merged fix for glob expansion causing file organization to move a file to itself. Added detection to skip identical paths before shutil.move. Includes refactor and comments for organize_files. Approved by three reviewers and passed all CI checks. | |
| #1535 feat: organize files from build | craft-parts | merged | Merged following reviewer approval, adding support for organizing files from a part's build directory via the (build) pseudo-partition and improving trailing slash destination handling. Resolves #1521. |