fix: make the -p and -o arguments work correctly
Metadata
Current evaluation
Merged PR #2600 (commit 868da353), fixing charmcraft pack to honor --project-dir and apply --output outside the container; this closes #1930.
Resolution: closed resolved
Reason: PR #2600 was merged as commit 868da353. The fix makes pack honor -p/--project-dir and handles -o/--output on the host filesystem, resolving issue #1930.
Evaluated by: mr-cal-bot
No scores available.
Issue body
For the `-o` output directory option, ensure that this applies outside of the container (where it likely does not exist and is not the point of the option). For the `-p` option, ensure the requested path is used.
Together, this allows running `charmcraft pack -p /some/other/place -o /another/different/place` so that the packing can point to a project location not in the pwd and the charm(s) written to a third place.
Fixes #1930
---
- [x] I've followed the [contribution guidelines](https://github.com/canonical/charmcraft/blob/main/CONTRIBUTING.md).
- [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/).
- [x] I've successfully run `make lint && make test`. (`lint` and `test_uv` fail but also on main)
- [x] I've added or updated any relevant documentation.
- [x] I've updated the relevant release notes.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2600 (commit 868da353), fixing charmcraft pack to honor --project-dir and apply --output outside the container; this closes #1930. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2600 fixes `charmcraft pack -o` and `-p`, resolving #1930 by applying the output path outside the container and honoring the requested project path. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for charmcraft pack CLI arguments. Corrects -o to function outside the container and -p to properly set the project directory, resolving issue #1930. Approved by reviewers and merged after CI validation. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for charmcraft pack CLI arguments. The -o output directory option now correctly applies outside the container, and the -p project directory option properly uses the specified path. Resolves #1930. |
Update history
No update history recorded yet.
Related work
-
Related To:
charmcraft#1930
(confidence 100%)
PR #2600 explicitly fixes this issue, which is now closed.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2361 charmcraft errors out when mixing -p and -o flags | charmcraft | closed | Fixed by merged PR #2600 (commit 868da353): pack now handles matching project/output directories correctly. Regression coverage was added by merged PR #2735 (commit 8ef26978). | |
| #1930 `charmcraft pack -o` fails: `FileNotFoundError` | charmcraft | closed | Fixed by merged PR #2600 (commit 868da353): pack -p and -o paths are now applied outside the build container, preventing FileNotFoundError with custom output directories. | |
| #2672 fix: use `charmcraft pack` instead of `charmcraft pull` in different-dir-metadata spread test | charmcraft | closed | Closed unmerged: the charmcraft pull -> pack fix for the different-dir-metadata spread test was superseded by PR #2694, merged as commit dd684338 using `charmcraft pack --verbose --project-dir=charm` plus output/restore checks. | |
| #2498 fix: `charmcraft pack --project-dir` with metadata.yaml | charmcraft | closed | Closed unmerged; superseded by #2644, which fixed metadata lookup for --project-dir and shipped in Charmcraft 4.2.1. | |
| #253 fix(application): Only allow --project-dir for init and pack | craft-application | closed | Closed unmerged after changes were requested, with two unresolved comments and no activity for 946 days; an equivalent fix later merged in charmcraft#1565 via #1592 (06c485fc). | |
| #1482 fix: set the correct working directory | charmcraft | closed | Merged PR #1482 corrected the lifecycle working directory, fixing #1475 where parts directories were created inside the project; the fix shipped in Charmcraft 3.1. | |
| #434 Output path changed with charmcraft 1.1.0 | charmcraft | closed | Charmcraft’s 1.1.0 pack regression was fixed, again writing the packed charm to the current working directory rather than the --project-dir directory. | |
| #1367 fix: make application handle a nonexistent project dir | charmcraft | merged | Merged PR #1367 updated Charmcraft’s application to handle nonexistent project directories after two-reviewer approval. | |
| #2427 fix(lifecycle): fix --project-dir and --output | charmcraft | merged | Merged PR #2427 as commit 3dfba830, fixing pack artifact placement to respect --project-dir and --output. |